Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Pathlib with os to fix write issues #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PeptideBuilder/PeptideBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ def make_structure_from_geos(geos: List[Geo]) -> Structure:
def add_terminal_OXT(structure: Structure, C_OXT_length: float = 1.23) -> Structure:
"""Adds a terminal oxygen atom ('OXT') to the last residue of chain A model 0 of the given structure, and returns the new structure. The OXT atom object will be contained in the last residue object of the structure.

This function should be used only when the structure object is completed and no further residues need to be appended."""
This function should be used only when the structure object is completed and no further residues need to be appended."""

rad = 180.0 / math.pi

Expand Down
49 changes: 23 additions & 26 deletions examples/evaluation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pathlib import Path
import os
import math

from Bio.PDB import PDBIO
Expand Down Expand Up @@ -38,7 +38,7 @@

def build_linear_model(pdb_filename):
parser = PDBParser()
structure = parser.get_structure("sample", Path(PDBdir, pdb_filename))
structure = parser.get_structure("sample", os.path.join(PDBdir, pdb_filename))
model = structure[0]
chain = model["A"]
model_structure_geo = []
Expand All @@ -58,13 +58,13 @@ def build_linear_model(pdb_filename):
def make_pdb_file(struct, file_nom):
outfile = PDBIO()
outfile.set_structure(struct)
outfile.save(Path(PDBdir, file_nom))
outfile.save(os.path.join(PDBdir, file_nom))
return file_nom


def build_backbone_model(pdb_filename):
parser = PDBParser()
structure = parser.get_structure("sample", Path(PDBdir, pdb_filename))
structure = parser.get_structure("sample", os.path.join(PDBdir, pdb_filename))
model = structure[0]
chain = model["A"]
model_structure_geo = []
Expand Down Expand Up @@ -134,7 +134,7 @@ def build_backbone_model(pdb_filename):

def build_all_angles_model(pdb_filename):
parser = PDBParser()
structure = parser.get_structure("sample", Path(PDBdir, pdb_filename))
structure = parser.get_structure("sample", os.path.join(PDBdir, pdb_filename))
model = structure[0]
chain = model["A"]
model_structure_geo = []
Expand Down Expand Up @@ -192,7 +192,7 @@ def build_all_angles_model(pdb_filename):

def build_phi_psi_model(pdb_filename):
parser = PDBParser()
structure = parser.get_structure("sample", Path(PDBdir, pdb_filename))
structure = parser.get_structure("sample", os.path.join(PDBdir, pdb_filename))
model = structure[0]
chain = model["A"]
seq = ""
Expand Down Expand Up @@ -244,8 +244,8 @@ def build_phi_psi_model(pdb_filename):
def compare_structure(reference, alternate):
parser = PDBParser()

ref_struct = parser.get_structure("Reference", Path(PDBdir, reference))
alt_struct = parser.get_structure("Alternate", Path(PDBdir, alternate))
ref_struct = parser.get_structure("Reference", os.path.join(PDBdir, reference))
alt_struct = parser.get_structure("Alternate", os.path.join(PDBdir, alternate))

ref_model = ref_struct[0]
ref_chain = ref_model["A"]
Expand Down Expand Up @@ -321,24 +321,21 @@ def test_PeptideBuilder(pdb_code):
RMS_all_angles_50, RMS_all_angles_150, RMS_all_angles, size = compare_structure(
pdb_file, make_pdb_file(structure_all_angles, "AllAngles_" + pdb_file)
)
output_line = (
"%s\t%i\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\n"
% (
pdb_code,
size,
RMS_phi_psi_50,
RMS_phi_psi_150,
RMS_phi_psi,
RMS_omega_50,
RMS_omega_150,
RMS_omega,
RMS_all_angles_50,
RMS_all_angles_150,
RMS_all_angles,
RMS_backbone_50,
RMS_backbone_150,
RMS_backbone,
)
output_line = "%s\t%i\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\t%0.1f\n" % (
pdb_code,
size,
RMS_phi_psi_50,
RMS_phi_psi_150,
RMS_phi_psi,
RMS_omega_50,
RMS_omega_150,
RMS_omega,
RMS_all_angles_50,
RMS_all_angles_150,
RMS_all_angles,
RMS_backbone_50,
RMS_backbone_150,
RMS_backbone,
)
return output_line

Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
platforms="Tested on Mac OS X and Windows 10",
packages=["PeptideBuilder"],
install_requires=INSTALL_REQUIRES,
extras_require={"test": TEST_REQUIRES + INSTALL_REQUIRES,},
extras_require={
"test": TEST_REQUIRES + INSTALL_REQUIRES,
},
classifiers=[
# Trove classifiers
# (https://pypi.python.org/pypi?%3Aaction=list_classifiers)
Expand Down