[Biopython] Antwort: Re: PDB parsing

João Rodrigues anaryin at gmail.com
Tue May 10 09:27:37 UTC 2011


Hey Paul,

First of all, you should not call _parse on your own. That is called already
when you call get_structure(). Generally, if a method has an underscore
behind its name it means it shouldn't really be called unless you really
know what you want to do with it.

What version of Biopython are you using?

I'd do this:

structure_id = "1234"
> PDBFILE = open(filename,'r')
> p = PDBParser(PERMISSIVE=1)
> pp = p.get_structure(structure_id, PDBFILE)
>
> for atom in pp.get_atoms():
>  atom.bfactor = 10.0
>  print atom.bfactor
>

It works pretty well here, with version 1.57.

Cheers,

João [...] Rodrigues
http://nmr.chem.uu.nl/~joao



On Tue, May 10, 2011 at 11:19 AM, <Paul.Czodrowski at merck.de> wrote:

> Dear Joao,
>
> this one does not work:
> "
>
> structure_id = "1234"
> PDBFILE = open(filename,'r').read()
> p = PDBParser(PERMISSIVE=1)
> p._parse(PDBFILE)
> pp = p.get_structure(structure_id, PDBFILE)
>
>
> for atom in pp.get_atoms():
>  atom.bfactor = 10.0
>  print atom.bfactor
> "
>
>
> "p.get_structure(structure_id, PDBFILE)" seems to get the structural data,
> but setting the bfactor does not give any output.
>
>
>
>
> Cheers & Thanks,
> Paul
>
>
> > Hey Paul,
> >
> > When you parse a PDB file with PDBParser it automatically retrieves both
> > B-factor and occupancy. If it fails to do so for any reason, it defaults
> > those values to 0.
> >
> > After parsing, you can set those values explicitly by modifying the
> > corresponding attribute of the Atom object. So, for example, to change
> the
> > B-factor of all your atoms to 10.0, you just have to do:
> >
> > for atom in structure.get_atoms():
> > >   atom.bfactor = 10.0
> > >
> >
> > Hope this answered your question.
> >
> > Cheers,
> >
> > João [...] Rodrigues
> > http://nmr.chem.uu.nl/~joao
> >
> >
> >
> > On Tue, May 10, 2011 at 9:50 AM, <Paul.Czodrowski at merck.de> wrote:
> >
> > >
> > > Dear folks,
> > >
> > > how do I add a B-factor as well as an occupancy column to a PDB file?
> > >
> > > I guess Bio.PDB is the appropriate module.
> > > But I already fail with regards to a simple PDB load...
> > >
> > >
> > > Cheers,
> > > Paul
>
> This message and any attachment are confidential and may be privileged or
> otherwise protected from disclosure. If you are not the intended recipient,
> you must not copy this message or attachment or disclose the contents to
> any other person. If you have received this transmission in error, please
> notify the sender immediately and delete the message and any attachment
> from your system. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not accept liability for any omissions or errors in this
> message which may arise as a result of E-Mail-transmission or for damages
> resulting from any unauthorized changes of the content of this message and
> any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not guarantee that this message is free of viruses and does
> not accept liability for any damages caused by any virus transmitted
> therewith.
>
> Click http://disclaimer.merck.de to access the German, French, Spanish and
> Portuguese versions of this disclaimer.
>
>
> _______________________________________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>




More information about the Biopython mailing list