[Biopython] Writing into a PDB file using PDBIO module

Peter biopython at maubp.freeserve.co.uk
Mon Jul 20 17:14:50 EDT 2009


On Mon, Jul 20, 2009 at 10:08 PM, life happy<iitlife2008 at gmail.com> wrote:
> Hi there,
>
> I am new to Biopython and have been working for a couple of weeks on Bio.PDB
> module.I would appreciate any clue or help in the following matter.
>
> I have some short ,closely related peptide sequences.I want to align these
> short peptides and send the aligned structures into a new PDB file.I used
> set_atoms class in Superimposer module to align the short peptides. I tried
> using PDBIO module, and send the aligned structures into a new PDB file. But
> when I see the output PDB file, I get the whole proteins not the short
> peptides. I like to have output PDB file with all the short peptides aligned
> to any particular short peptide.
>
>
> #This is the part of my code. B is list of atoms of peptides. C is a list
> with PDB ids of each peptide.
>
> from Bio.PDB.Superimposer import Superimposer
> fixed = B[0:1*(stop-start+1)]
> sup = Superimposer()
> for i in range(1,5) :
>        moving = B[i*(stop-start+1):(i+1)*(stop-start+1)]
>        sup.set_atoms(fixed, moving)
>        print "RMS(%s file %s chain, %s file %s model) = %0.2f" %
> (C[0][0].split("'")[1],C[0][2].split("'")[1],C[i][0].split("'")[1],C[i][2].split("'")[1],
> sup.rms)
>        print "Saving %s aligned structure as PDB file %s" %
> (C[0][2].split("'")[1], pdb_out_filename)
>        io=Bio.PDB.PDBIO()
>        io.set_structure(structure)
>        io.save(pdb_out_filename)
>
> thanks in advance!!

Your example never defines the "structure" variable. I guess it should
be pointing at something in the "C" data structure...

Peter


More information about the Biopython mailing list