MKeep

MKeep[ hexpr , lev→patt ]
keeps from hexpr only sub-hexpr matching specifications of lev → patt.
MKeep[ hexpr , { lev1→patt1 , lev2→patt2, ... } ]
keeps from hexpr only sub-hexpr that match iteratively each specifications of { lev1 → patt1 , lev2 → patt2, ... }.
MKeep[ {hexpr1, hexpr2, ...} , lev → patt ]
keeps only sub-hexpr matching specifications of lev → patt from each expression in {hexpr1, hexpr2, ...}.
MKeep[ {hexpr1, hexpr2, ...} , { lev1→patt1 , lev2→patt2, ... } ]
keeps from each expression in {hexpr1, hexpr2, ...} only the sub-hexpr that match iteratively each specifications of { lev1 → patt1 , lev2 → patt2, ... }.
  • {hexpr1, hexpr2, ...} is a list of hierarchical expressions.
  • lev → patt is a level specific pattern.
  • lev can be every sub-level: "Model", "Chain", "Residue", "Atom".
  • patt is a pattern identified to values of the name and/or the index number of every hepxr. Strings will be evaluated as hexpr labels, and integers as hexpr index numbers. Respectively, labels and index numbers are stored in descriptors "Label" and "Id" of each hexpr.
  • Some pattern functions can be used in patt such as Except or Alternatives to build more complex patterns.
  • The type of the returned expressions is the same as hepxr.
In[1]:=
Click for copyable input
Loads a sample model:
In[2]:=
Click for copyable input
Keeps only backbone atoms:
In[3]:=
Click for copyable input
Out[3]=
Then the backbone can be represented idependently:
In[4]:=
Click for copyable input
Out[4]=