Molecule
Molecule()
¶
Loads, saves, and manipulates molecular models. The main pymolecule class.
Initializes the variables of the Molecule class.
atoms_and_bonds = AtomsAndBonds(self)
instance-attribute
¶
geometry = Geometry(self)
instance-attribute
¶
information = Information(self)
instance-attribute
¶
io = FileIO(self)
instance-attribute
¶
manipulation = Manipulation(self)
instance-attribute
¶
other_molecule = OtherMolecules(self)
instance-attribute
¶
selections = Selections(self)
instance-attribute
¶
__is_number(s)
¶
Determines whether or not a string represents a number.
PARAMETER | DESCRIPTION |
---|---|
s
|
A string (e.g., "5.4").
|
RETURNS | DESCRIPTION |
---|---|
A boolean, whether or not the string can be represented by a float. |
numpy_structured_array_remove_field(narray, field_names)
¶
Removes a specific field name from a structured numpy array.
PARAMETER | DESCRIPTION |
---|---|
narray
|
A structured numpy array.
|
field_names
|
A list of strings, where each string is one of the field names of narray.
|
RETURNS | DESCRIPTION |
---|---|
A structured numpy array identical to narray, but with the field names in field_names removed. |
Selections(parent_molecule_object)
¶
A class for selecting atoms
Initializes the pymolecule.Selections class.
PARAMETER | DESCRIPTION |
---|---|
parent_molecule_object
|
The pymolecule.Molecule object associated with this class.
|
parent_molecule = parent_molecule_object
instance-attribute
¶
copy()
¶
Returns an exact copy (pymolecule.Molecule) of this Molecule object. Undo points are NOT copied.
RETURNS | DESCRIPTION |
---|---|
A pymolecule.Molecule, containing to the same atomic information as this pymolecule.Molecule object. |
create_molecule_from_selection(selection, serial_reindex=True, resseq_reindex=False)
¶
Creates a pymolecule.Molecule from a user-defined atom selection.
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the atoms in the user-defined selection.
|
serial_reindex
|
An optional boolean, whether or not to reindex the atom serial fields. Default is True.
DEFAULT:
|
resseq_reindex
|
An optional boolean, whether or not to reindex the atom resseq fields. Default is False.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
A pymolecule.Molecule object containing the atoms of the user-defined selection. |
get_chain_selections()
¶
Identifies the atom selections of each chain.
RETURNS | DESCRIPTION |
---|---|
A dictionary. The keys of the dictionary correspond to the chainids, and the values are np.array objects containing the indices of the associated chain atoms. |
get_molecule_from_selection(selection)
¶
Creates a Molecule from a user-defined atom selection.
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the atoms in the user-defined selection.
|
RETURNS | DESCRIPTION |
---|---|
A Molecule object containing the atoms of the user-defined selection. |
get_residue_selections()
¶
Identifies the atom selections of each residue.
RETURNS | DESCRIPTION |
---|---|
A dictionary. The keys of this dictionary correspond to the unique resname-resseq-chainid residue identifiers, and the values are np.array objects containing the indices of the associated residue atoms. |
get_selections_of_constituent_molecules()
¶
Identifies the indices of atoms belonging to separate molecules, assuming that the pymolecule.Molecule object actually contains multiple physically distinct molecules that are not bound to each other via covalent bonds.
RETURNS | DESCRIPTION |
---|---|
A python list of np.array objects containing the indices of the atoms belonging to each molecule of the composite pymolecule.Molecule object. |
invert_selection(selection)
¶
Inverts a user-defined selection (i.e., identifies all atoms that are not in the seleciton).
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the user-defined selection.
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of all atoms that are not in the user-defined seleciton. |
select_all()
¶
Selects all the atoms in a pymolecule.Molecule object.
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of all atoms in the pymolecule.Molecule object. |
select_all_atoms_bound_to_selection(selection)
¶
Selects all the atoms that are bound to a user-specified selection.
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the user-specified selection.
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of the atoms that are bound to the user-specified selection. Note that this new selection does not necessarily include the indices of the original user-specified selection. |
select_atoms(selection_criteria)
¶
Select a set of atoms based on user-specified criteria.
PARAMETER | DESCRIPTION |
---|---|
selection_criteria
|
An dictionary, where the keys correspond to keys in the self.parent_molecule.information.atom_information structured numpy array, and the values are lists of acceptable matches. The selection is a logical "AND" between dictionary entries, but "OR" within the value lists themselves. For example: {'atom':['CA','O'], 'chain':'A', 'resname':'PRO'} would select all atoms with the names CA or O that are located in the PRO residues of chain A.
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of the atoms of the selection. |
select_atoms_from_same_molecule(selection)
¶
Selects all the atoms that belong to the same molecule as a user-defined selection, assuming that the pymolecule.Molecule object actually contains multiple physically distinct molecules that are not bound to each other via covalent bonds.
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the user-defined selection.
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of the atoms belonging to the same molecules as the atoms of the user-defined selection. |
select_atoms_in_bounding_box(bounding_box)
¶
Selects all the atoms that are within a bounding box.
PARAMETER | DESCRIPTION |
---|---|
bounding_box
|
A 2x3 np.array containing the minimum and maximum points of the bounding box. Example: np.array([[min_x, min_y, min_z], [max_x, max_y, max_z]]).
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of the atoms that are within the bounding box. |
select_atoms_in_same_residue(selection)
¶
Selects all atoms that are in the same residue as any of the atoms of a user-defined seleciton. Residues are considered unique if they have a unique combination of resname, resseq, and chainid fields.
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the user-defined selection.
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of all atoms in the same residue as any of the atoms of the user-defined selection. |
select_atoms_near_other_selection(selection, cutoff)
¶
Selects all atoms that are near the atoms of a user-defined selection.
PARAMETER | DESCRIPTION |
---|---|
selection
|
A np.array containing the indices of the user-defined selection.
|
cutoff
|
A float, the distance cutoff (in Angstroms).
|
RETURNS | DESCRIPTION |
---|---|
A np.array containing the indices of all atoms near the user-defined selection, not including the atoms of the user-defined selection themselves. |
select_branch(root_atom_index, directionality_atom_index)
¶
Identify an isolated "branch" of a molecular model. Assumes the atoms with indices root_atom_index and directionality_atom_index are bound to one another and that the branch starts at root_atom_index one and "points" in the direction of directionality_atom_index.
PARAMETER | DESCRIPTION |
---|---|
root_atom_index
|
An int, the index of the first atom in the branch (the "root").
|
directionality_atom_index
|
An int, the index of the second atom in the branch, used to establish directionality
|
RETURNS | DESCRIPTION |
---|---|
A numpy array containing the indices of the atoms of the branch. |
select_close_atoms_from_different_molecules(other_mol, cutoff, pairwise_comparison=True, terminate_early=False)
¶
Effectively detects steric clashes between self and another pymolecule.Molecule.
PARAMETER | DESCRIPTION |
---|---|
other_mol
|
A pymolecule.Molecule object of the other molecule.
|
cutoff
|
A float, the user-defined distance cutoff in Angstroms.
|
pairwise_comparison
|
An optional boolean, whether or not to perform a simple pairwise distance comparison (if True) or to use a more sophisitcated method (if False). True by default.
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
A tuple containing two elements. The first is a np.array containing the indices of all nearby atoms from this pymolecule.Molecule object (self). The second is a np.array containing the indices of all nearby atoms from the other molecule. |