[Biopython] Getting a list of residue numbers

Ahmad Abdelzaher underoath006 at gmail.com
Sun Apr 16 04:43:15 UTC 2017


Beautifully written in one line. Cheers.

On Sun, Apr 16, 2017 at 2:00 AM, João Rodrigues <
j.p.g.l.m.rodrigues at gmail.com> wrote:

> Hi there,
>
> Try residue.id[1]. The residue number is the second item in the id tuple,
> first being the HETATM/Water flag, and third the altloc.
>
> In short: resids = [r.id[1] for r in structure.get_residues()]
>
> 2017-04-15 16:27 GMT-07:00 Ahmad Abdelzaher <underoath006 at gmail.com>:
>
>> Hi,
>>
>> I know I can get residue names like this:
>>
>> name = '1gdw.pdb'
>> structure=p.get_structure(name, name)
>> residue_name = []
>> for model in structure:
>>     for chain in model:
>>         for i in *residue_number*:
>>                 residue_name.append(chain[i].resname)
>>
>> However, I don't know of a way to get a list of *residue_number,* so I
>> use Pymol to do it!
>>
>> import __main__
>> __main__.pymol_argv = ['pymol','-qc']
>> import pymol
>> from pymol import cmd, stored
>> pymol.finish_launching()
>> cmd.delete('all')
>> cmd.load(name)
>> stored.residues = []
>> cmd.iterate('name ca', 'stored.residues.append(resi)')
>> residue_number = [ int(x) for x in stored.residues ]
>>
>> What is the biopython way of getting the residue numbers?
>>
>>
>> _______________________________________________
>> 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/20170416/437d8488/attachment.html>


More information about the Biopython mailing list