[BioPython] Bio.PDB: possible to obtain chain identifier for atoms?

Christian Meesters meesters at uni-mainz.de
Fri Aug 17 03:15:39 EDT 2007


Hoi Katie,

apparently, yes. Life can be so easy ...

Thanks,
Christian

On Thu, 2007-08-16 at 15:17 -0400, Katie Edmonds wrote:
> Hi Christian,
> 
> are you looking for:
> chain1 = a.get_parent().get_parent()
> ?
> 
> Katie
> 
> On 8/16/07, Christian Meesters <meesters at uni-mainz.de> wrote:
>         Hi All,
>         
>         I'm trying to build a somewhat bigger app which needs to
>         calculate the 
>         distance distribution function of a protein several times. For
>         this
>         purpose I re-discovered BioPython today.
>         Speed is an issue, but since the protein in question isn't too
>         big the
>         overhead of Python and BioPython might be tolerable. 
>         
>         Still, in order to speed up my code I would need to access the
>         chain
>         identifier of atoms within a loop. To illustrate my question
>         some
>         pseudo-code:
>         
>         atoms = Selection.unfold_entities(structure, 'A') 
>         for i, a in enumerate(atoms):
>             for b in atoms[i+1:]:
>                 # do some calculations here ...
>         
>         Now, I cannot avoid the double loop, but if I could check
>         somehow
>         whether atoms a and b belong to the same chain (and which) I
>         would have 
>         to do this awkward looping only once this way.
>         
>         Does anybody know an approach? As far as I understand the code
>         of the
>         Atom class, there is no direct way, right?
>         
>         TIA
>         Christian
>         _______________________________________________ 
>         BioPython mailing list  -  BioPython at lists.open-bio.org
>         http://lists.open-bio.org/mailman/listinfo/biopython
> 


More information about the BioPython mailing list