[Biopython-dev] changing PDB file chains

João Rodrigues anaryin at gmail.com
Fri Jun 14 09:05:41 UTC 2013


Hi,

If you simply want to update ids, you can just change them (chain.id =
newvalue) and then output the structure like David suggested. No need to
remove/add atoms. If you wish to play with the structure then you should
modify the SMCRA hierarchy indeed.

Cheers,

João


2013/6/13 David Cain <davidjosephcain at gmail.com>

> Yes, John, it's possible!
>
> You'll first want to modify the parsed structure. Add your water molecules
> to the desired chain (removing from the old, of course). To actually do
> this, you may want to look at the source (
> http://biopython.org/DIST/docs/api/Bio.PDB-module.html), specifically how
> the SMRCA hierarchy is constructed.
>
> Once you've modified your Structure (say it's in a variable `struct`), you
> should create an instance of PDBIO(), then save your structure like so:
>
> pdb_writer = PDB.PDBIO()
> pdb_writer.set_structure(struct)
> pdb_writer.save("output_path.pdb")
>
> Do not that PDBIO has some limitations (e.g. it cannot write out PDB header
> data). It should probably suffice for your needs, though.
>
> If you're not able to figure it out, feel free to email me back (preferably
> with your code!) and I can help you out.
> StackOverflow<http://stackoverflow.com> works
> particularly well for me, if you're amenable to that.
>
>
>
> David Cain
> +1 (339) 222 4452
>
>
> On Thu, Jun 13, 2013 at 3:01 PM, John Berrisford <jmb at ebi.ac.uk> wrote:
>
> > Hi
> >
> >
> >
> > I'm trying to use biopython to update a PDB file.
> >
> >
> >
> > I'm trying to update the chain ID of a series of waters in a PDB file. I
> > have the original chain ID, new chain ID and water residue number in an
> > mmcif file which I parse using a separate parser. Then for each water I
> > have
> > in the mmcif file I want to update the chain ID from the cif file.
> >
> > I then want to write out the updated water line (to test it works) or
> write
> > out the updated PDB file.
> >
> >
> >
> > Is this possible with biopython?
> >
> >
> >
> > Regards
> >
> >
> >
> > John
> >
> > _______________________________________________
> > Biopython-dev mailing list
> > Biopython-dev at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/biopython-dev
> >
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython-dev
>




More information about the Biopython-dev mailing list