From c3bee3ec6f5c67572ee5a056a61f41d546be7e23 Mon Sep 17 00:00:00 2001 From: Nilesh Patra Date: Sun, 29 Nov 2020 05:44:43 +0000 Subject: [PATCH 1/2] Replace Pathlib with os to fix write issues --- examples/evaluation.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/evaluation.py b/examples/evaluation.py index 9a3df43..ef888f6 100755 --- a/examples/evaluation.py +++ b/examples/evaluation.py @@ -1,4 +1,4 @@ -from pathlib import Path +import os import math from Bio.PDB import PDBIO @@ -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 = [] @@ -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 = [] @@ -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 = [] @@ -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 = "" @@ -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"] From b824df3c234189e1b0c9e55d0890cb5e41ecd143 Mon Sep 17 00:00:00 2001 From: Nilesh Patra Date: Sun, 29 Nov 2020 05:57:33 +0000 Subject: [PATCH 2/2] Refromat properly (fixes CI) --- PeptideBuilder/PeptideBuilder.py | 2 +- examples/evaluation.py | 33 +++++++++++++++----------------- setup.py | 4 +++- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/PeptideBuilder/PeptideBuilder.py b/PeptideBuilder/PeptideBuilder.py index b57f91d..c72a1d2 100644 --- a/PeptideBuilder/PeptideBuilder.py +++ b/PeptideBuilder/PeptideBuilder.py @@ -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 diff --git a/examples/evaluation.py b/examples/evaluation.py index ef888f6..23cb759 100755 --- a/examples/evaluation.py +++ b/examples/evaluation.py @@ -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 diff --git a/setup.py b/setup.py index 94fcd4f..a85d247 100644 --- a/setup.py +++ b/setup.py @@ -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)