I have been successfully using BioPython's functionality for extracting protein torsion angles using the IC_Chain
module. However, I am currently looking to use the inverse functionality as follows:
from Bio.PDB import PDBParser, internal_coords
# Read PDB entry.
parser = PDBParser(PERMISSIVE=1, QUIET=1)
structure = parser.get_structure('', 'example.pdb')
# Generate protein internal coordinates (angles).
ic_chain_bound = internal_coords.IC_Chain(structure)
ic_chain_bound.atom_to_internal_coordinates()
# Generate back 3D coordinates from angles.
ic_chain_bound.internal_to_atom_coordinates()
but this fails with the following error:
Traceback (most recent call last):
File "test_biopython_internal_coords.py", line 97, in <module>
main(args)
File "test_biopython_internal_coords.py", line 89, in main
ic_chain_bound.internal_to_atom_coordinates()
File "/software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 661, in internal_to_atom_coordinates
verbose=verbose, start=start, fin=fin
File "software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 415, in assemble_residues
Dict[AtomKey, numpy.array], ric.assemble(verbose=verbose)
File "/software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 1732, in assemble
atomCoords = self.get_startpos()
File "/software/anaconda/installation/envs/alphafold/lib/python3.7/site-packages/Bio/PDB/internal_coords.py", line 1632, in get_startpos
sp = self.residue.parent.internal_coord.initNCaC.get(self.rbase, None)
AttributeError: 'NoneType' object has no attribute 'initNCaC'
Is this not the intended use? Could someone help me figure out why this is failing?
I'm using this PDB file in my example, but the code previously failed for all other PDB files I tried.
Thanks!
ic_chain_bound.residue.parent.internal_coord
is None... So youric_chain_bound.residue.parent
needs to be given coordinates...help
anddir
on it may help $\endgroup$