Is composed of#
Checking whether a molecular system is composed of specific elements.
The function molsysmt.basic.is_composed_of() checks whether a molecular system is made up exclusively of certain types or number of elements.
Hint
Visit the section Elements for a detailed overview of element hierarchy in MolSysMT.
Added in version 1.0.0.
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function: molsysmt.basic.is_composed_of().
Basic usage#
Let’s show how this function works using a PDB structure (181L):
import molsysmt as msm
molsys = msm.convert('181L')
msm.info(molsys)
| form | n_atoms | n_groups | n_components | n_chains | n_molecules | n_entities | n_waters | n_ions | n_small_molecules | n_proteins | n_structures |
|---|---|---|---|---|---|---|---|---|---|---|---|
| molsysmt.MolSys | 1441 | 302 | 141 | 6 | 141 | 5 | 136 | 2 | 2 | 1 | 1 |
We know in advance that the system includes multiple molecule types: proteins, ions, waters, and small molecules. Therefore, although it contains proteins, it is not composed solely of proteins:
msm.is_composed_of(molsys, proteins=True)
False
Tip
All methods defined in the molsysmt.basic module can also be invoked from the main level of the library. Hence, molsysmt.is_composed_of() is the same function as molsysmt.basic.is_composed_of().
Let’s see now if the molecular system is indeed composed of proteins, waters, small molecules and ions:
msm.is_composed_of(molsys, proteins=True, waters=True, small_molecules=True, ions=True)
True
You can also specify the exact number of each element type using keyword arguments. For example:
msm.is_composed_of(molsys, proteins=1, waters=True, small_molecules=2, ions=True)
True
msm.is_composed_of(molsys, proteins=1, small_molecules=1)
False
Other element types, such as atoms, groups, components or molecules, can also be checked using their respective attribute names:
msm.is_composed_of(molsys, n_atoms=1441, n_groups=302)
True
msm.is_composed_of(molsys, n_components=3, n_molecules=3)
False
Finally, you can apply this function to a selection of elements using the selection argument:
msm.is_composed_of(molsys, selection='molecule_type in ["ion", "water", "small molecule", "protein"]')
True
msm.is_composed_of(molsys, selection='molecule_type not in ["ion", "water", "small molecule"]', proteins=1)
True
See also
Related Tools & References
Elements: Describe the hierarchical structure of elements (atom, group, component, molecule, chain, entity, system) in a molecular system.
Convert: Convert a molecular system into another form or forms with
molsysmt.basic.convert().Info: Display summary information about the contents of a molecular system with
molsysmt.basic.info().Is composed of: Check whether a molecular system is composed of specific elements with
molsysmt.basic.is_composed_of().Contains: Check whether specific elements are present in a molecular system with
molsysmt.basic.contains().