[Biopython] Problem writing a PDB with multiple models
Claudia Millán Nebot
cmncri at ibmb.csic.es
Tue Oct 27 12:41:17 UTC 2015
Dear all,
I am trying to write a small function to fuse a number of pubs in a single
one,
by adding them as models to an structure object. The code looks like this:
def fuse_pdbs(list_of_filepaths,path_pdb):
list_of_structures=[]
parser=PDBParser()
for pdb_file in list_of_filepaths:
structure=parser.get_structure(pdb_file[:-4],pdb_file)
list_of_structures.append(structure)
main_structure=list_of_structures[0]
for x,structure in enumerate(list_of_structures):
#print "Processing ",structure," ",x
model=structure[0]
if x!=0:
model.id=x
main_structure.add(model)
print Selection.unfold_entities(main_structure,'M')
io=PDBIO()
io.set_structure(main_structure)
io.save(path_db)
The print statement shows the following output:
[<Model id=0>, <Model id=1>, <Model id=2>, <Model id=3>, <Model id=4>,
<Model id=5>, <Model id=6>, <Model id=7>, <Model id=8>, <Model id=9>,
<Model id=10>, <Model id=11>]
So I believe I have correctly generated the object. However, the pub file
generated is saving all models with id 0, plus it has some END keywords
that I think are not correct. It looks like this (I am showing the last
part of the first model and the first one from the second):
ATOM 168 N ILE D 99 -5.026 -38.437 15.960 1.00 22.23
N
ATOM 169 CA ILE D 99 -5.870 -37.247 15.926 1.00 20.60
C
ATOM 170 C ILE D 99 -6.803 -37.455 14.742 1.00 20.32
C
ATOM 171 O ILE D 99 -6.378 -37.412 13.580 1.00 21.10
O
ATOM 172 CB ILE D 99 -5.028 -35.954 15.704 1.00 20.81
C
TER
ENDMDL
END
MODEL 0
ATOM 1 N ILE D 25 -4.486 28.320 36.177 1.00 13.13
N
ATOM 2 CA ILE D 25 -3.263 27.547 36.087 1.00 15.38
C
ATOM 3 C ILE D 25 -3.596 26.073 36.119 1.00 16.87
C
ATOM 4 O ILE D 25 -4.286 25.599 37.026 1.00 17.23
O
I am not sure about what could be causing the problem, or if I can solve it
by adding some keyword to the write statement, indicating that it is like
an NMR model? Maybe I am missing something obvious, but I would be glad to
know it :)
Best,
Claudia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20151027/bdd304e7/attachment.html>
More information about the Biopython
mailing list