clauswilke / PeptideBuilder

A simple Python library to generate model peptides
MIT License
79 stars 30 forks source link

Replace Pathlib with os to fix write issues #43

Open nileshpatra opened 3 years ago

nileshpatra commented 3 years ago

Currently, the evaluation.py file fails with:

$ python3 evaluation.py 
1aq7
/usr/lib/python3/dist-packages/Bio/PDB/PDBParser.py:395: PDBConstructionWarning: Ignoring unrecognized record 'TER' at line 1630
  warnings.warn(
/usr/lib/python3/dist-packages/Bio/PDB/PDBParser.py:395: PDBConstructionWarning: Ignoring unrecognized record 'TER' at line 1630
  warnings.warn(
/usr/lib/python3/dist-packages/Bio/PDB/PDBParser.py:395: PDBConstructionWarning: Ignoring unrecognized record 'TER' at line 1630
  warnings.warn(
Traceback (most recent call last):
  File "/home/nilesh/ups/PeptideBuilder/examples/evaluation.py", line 365, in <module>
    f_out.write(test_PeptideBuilder(i))
  File "/home/nilesh/ups/PeptideBuilder/examples/evaluation.py", line 313, in test_PeptideBuilder
    pdb_file, make_pdb_file(structure_backbone, "Backbone_" + pdb_file)
  File "/home/nilesh/ups/PeptideBuilder/examples/evaluation.py", line 61, in make_pdb_file
    outfile.save(Path(PDBdir, file_nom))
  File "/usr/lib/python3/dist-packages/Bio/PDB/PDBIO.py", line 380, in save
    fp.write(s)
AttributeError: 'PosixPath' object has no attribute 'write'

Biopython version: 1.78

This is an attempt to fix the problem, avoiding the use of POSIX path.

nileshpatra commented 3 years ago

Rest reformatting changes are done to make CI happy