From c3bee3ec6f5c67572ee5a056a61f41d546be7e23 Mon Sep 17 00:00:00 2001 From: Nilesh Patra Date: Sun, 29 Nov 2020 05:44:43 +0000 Subject: [PATCH] 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"]