MMapNextLevel

MMapNextLevel[ f , hexpr ]
applies f to each element of the next level of hexpr.
MMapNextLevel[ f , hexpr , hexprlev ]
applies f to each element of of hexpr. at level specified by hexprlev
  • f can be any function
  • hexprlev specifies a level of the molecular hierarchy. It could be "Model", "Chain", "Residue" or "Atom" if one of these levels is a sub-level of hexpr.
In[1]:=
Click for copyable input
Loads a sample chain:
In[2]:=
Click for copyable input
Out[2]=
The next level of chain is a list of residues. The first argument of MMapNextLevel should be a function which argument is a residue.
Lets add a new desciptor giving the coordinates of each residue:
In[3]:=
Click for copyable input
Out[3]=
We can check the addition of the new descriptor on the first residue:
In[4]:=
Click for copyable input
Out[4]=
We can check the addition of the new descriptor value on every residues:
In[5]:=
Click for copyable input
Out[5]=
 
But we can also submit a chain to a modification of its atoms using the level specification. Lets add a new desciptor giving the distance to the origin to all atoms of the chain. For so, we set hexprlev the level of application of the function to be "Atom":
In[1]:=
Click for copyable input
Out[1]=
We can check the addition of the new descriptor on the first atom:
In[2]:=
Click for copyable input
Out[2]=
and we can check its value:
In[3]:=
Click for copyable input
Out[3]=