Get form#
Identifying the form of a molecular system.
A single molecular system can be represented in different forms, such as a file, a string ID, or a Python object. These forms can be converted between one another depending on the attributes needed and the steps of a workflow.
The form of a molecular system can be obtained with the function molsysmt.basic.get_form()
.
Hint
Visit the section User guide > Introduction > Molecular System > Form in case you are not familiar with the concepts of “form” in MolSysMT.
Added in version 1.0.0.
How this function works#
API documentation
Follow this link for a detailed description of the input arguments, raised errors, and returned objects of this function:molsysmt.basic.get_form()
.
Let’s see some examples:
import molsysmt as msm
molsys = '181L'
msm.get_form(molsys)
'string:pdb_id'
Tip
All methods defined in the molsysmt.basic module can be invoked also from the main level of the library. Hence, molsysmt.get_form()
is the same method as molsysmt.basic.get_form()
.
Let’s try with other forms of this and other molecular systems:
molsys_B = msm.convert(molsys, to_form='openmm.Modeller')
msm.get_form(molsys_B)
'openmm.Modeller'
msm.get_form('AceAlaValTyrNme')
'string:amino_acids_3'
molsys = msm.systems['pentalanine']['pentalanine.inpcrd']
msm.get_form(molsys)
'file:inpcrd'
import numpy as np
molsys = np.zeros(shape=[10,4,3])*msm.pyunitwizard.unit('angstroms')
msm.get_form(molsys)
'XYZ'
molsys = ('HETATM 3274 C1 BEN A 302 -9.410 30.002 12.405 1.00 61.32 C \n'
'HETATM 3275 C2 BEN A 302 -10.677 29.482 12.626 1.00 58.40 C \n'
'HETATM 3276 C3 BEN A 302 -10.836 28.180 13.091 1.00 49.12 C \n'
'HETATM 3277 C4 BEN A 302 -9.725 27.387 13.331 1.00 56.99 C \n'
'HETATM 3278 C5 BEN A 302 -8.454 27.906 13.109 1.00 53.41 C \n'
'HETATM 3279 C6 BEN A 302 -8.298 29.207 12.650 1.00 55.79 C \n'
'HETATM 3280 C BEN A 302 -9.255 31.315 11.933 1.00 63.37 C \n'
'HETATM 3281 N1 BEN A 302 -8.925 31.552 10.675 1.00 73.79 N \n'
'HETATM 3282 N2 BEN A 302 -9.382 32.348 12.740 1.00 62.54 N ')
msm.get_form(molsys)
'string:pdb_text'
view = msm.view(molsys)
msm.get_form(view)
'nglview.NGLWidget'
See also
User guide > Introduction > Molecular System > Forms:
Describe the different data representations (forms) used for molecular systems.
User guide > Tools > Basic > Convert:
Convert a molecular system into another form or format.
User guide > Tools > Basic > View:
Visualize a molecular system.