MolecularHierarchy inherits from Hierachy, so you can do operations
like get_parent and get_child. And by default, atoms are children of
residues. So you can do atomdecorator.get_parent().get_index() to find
which residue a given atom belongs to. Does that answer things?
On Jan 7, 2009, at 7:34 PM, Seung Joong Kim wrote:
Hi all,
This can be a very simple question, but I'm just wondering how to
correlate atoms and a residue in IMP molecular hierarchy.
First of all, I get "IMP::core::MolecularHierarchyDecorator mp" by
calling read_pdb function defined in IMP modeller module. It simply
reads contents of a pdb file and generates the molecular hierarchy.
mp = IMP.modeller.read_pdb('single_protein.pdb', m)
Then, I load particles by calling "molecular_hierarchy_get_by_type"
function as follows.
ps_ = IMP::core::molecular_hierarchy_get_by_type(mp_,
IMP::core::MolecularHierarchyDecorator::ATOM);
IMP::core::AtomDecorator ad =
IMP::core::AtomDecorator::cast(ps_[i]);
By doing this, I get only independent particle arrays of atom and
residue, without any relation between them.
What I want to know is a piece of linked information between atom
index and residue index, such that a Nitrogen atom (atom index 458)
is positioned at a LYS residue (residue index 56).
ATOM 458 N LYS 56 38.397 16.302 23.700 1.00
18.45 N
Is there any simple function defined in MolecularHierarchyDecorator
class for this purpose? (Input : atom index & Output : residue
index, and vice versa.) Or is there any other simple way to do this?