[Biopython] Save custom structure...

Yasser Almeida Hernández pedro.al at fenhi.uh.cu
Wed Jan 6 14:24:30 UTC 2010


I used the "add" method in the Residue class for add the atom object  
to the residue. That's right that i need a structure object, but how i  
build this object "de novo" and a how add a new residue on it???
I used the StructureBuilder class with the init_* methods (model,  
chain, residue etc.) and then the get_structure method, but it doesn't  
work:

# EXPERIMENTAL CODE
res.add(contact)   # Add a atom to the residue of interest

output_structure = StructureBuilder.StructureBuilder()
output_structure.init_structure('OUT_STRUCT')

output_structure.init_model(0)
output_structure.init_chain('X')
output_structure.get_structure()
output_structure[0]['X'].add(res)

io = PDBIO()
io.set_structure(output_structure)
pdb_out_filename = "cont_res_plus_contact.pdb"
io.save(pdb_out_filename, output_structure)

I'm processing a hundred of pdb files, and i need this code for write  
residues and atoms in different conformational states...

I hope for your help...
Thanks


> You need a structure object, and then pass that to PDBIO.
> I suggest you do this via a Select class - as in your related
> question about removing hydrogen atoms:
> http://lists.open-bio.org/pipermail/biopython/2009-December/006028.html
> http://lists.open-bio.org/pipermail/biopython/2010-January/006064.html
>
> If that doesn't make sense, then perhaps you could go into
> more detail? e.g. tell us which PDB file you are working with,
> and show us your code so far. You could use a similar example
> if you'd prefer not to talk about the real research topic.

> Peter

-- 
Lic. Yasser Almeida Hernández
Center of Molecular Inmunology (CIM)
Nanobiology Group
P.O.Box 16040, Havana, Cuba
Phone: (537) 271-7933, ext. 221

----------------------------------------------------------------
Correo FENHI







More information about the Biopython mailing list