[Biopython] Remove heteroatoms
João Rodrigues
anaryin at gmail.com
Fri Sep 5 06:09:27 UTC 2014
Hi Rojan,
The code looks o.k. to me. Waters are sometimes in ATOM records, which
would break the parser.
Another reason can be that you are iterating and removing the waters at the
same time. Try saving the ids of the heteroatoms you want to remove to a,
list and then iterate over this list and remove them.
Best,
João
Em 05/09/2014 07:21, "Rojan Shrestha" <rojan at riken.jp> escreveu:
> Hello,
>
> Can someone tell me about removing heteroatoms from PDB?
>
> Here is the code for removing the heteroatoms I took from the link -
> http://pelican.rsvs.ulaval.ca/mediawiki/index.php/Manipulating_PDB_files_using_BioPython but
> it did not work. I have tested with 1C4R.pdb. It removes some water but
> some still remain in PDB.
>
> for model in structure:
> for chain in model:
> for residue in chain:
> id = residue.id
> if id[0] != ' ':
> chain.detach_child(id)
> if len(chain) == 0:
> model.detach_child(chain.id)
>
>
> Regards,
>
> Rojan
>
> _______________________________________________
> Biopython mailing list - Biopython at mailman.open-bio.org
> http://mailman.open-bio.org/mailman/listinfo/biopython
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.open-bio.org/pipermail/biopython/attachments/20140905/1a026fba/attachment.html>
More information about the Biopython
mailing list