[Biopython] Save custom structure...

Yasser Almeida Hernández pedro.al at fenhi.uh.cu
Thu Jan 7 14:14:28 UTC 2010


Yes, out of entire chain. Here's the concrete example:
I have two pdb. The first is ligand-bounded (1BCX) and the other is  
ligand-free (1BVV). In the first i want to save the Tyr166 and the  
ligand atom O3B, both in a pdb file. In the second i want to save the  
same equivalent Tyr166 and the ligand atom of the first pdb file, both  
in other pdb file...
I hope this will more clear...

Thanks...


> So out of the entire chain, you just want atom CB from residue Arg519?
> Try this then, it will give you a tiny PDB file with just two atoms, the
> CB from Arg519 in the two chains.
>
> from Bio.PDB import Select, PDBIO
> from Bio.PDB.PDBParser import PDBParser
>
> class MySelector(Select):
>     def accept_residue(self, residue):
>         #Only want Arg519 (in any chain)
>         return residue.resname=="ARG" and residue.id[1]==519
>     def accept_atom(self, atom):
>         #Only want the CB atom (in residue Arg519)
>         return atom.name == "CB"
>
> s=PDBParser().get_structure("1XYZ", "1XYZ.pdb")
> io=PDBIO()
> io.set_structure(s)
> io.save("1XYZ-interesting.pdb", select=MySelector())
> print "Done"
>
> 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