molecular
#
Module that provides molecular visualization tools.
|
Your molecule class. |
A class to obtain properties of elements (eg: Covalent Radius, Van Der Waals Radius, Symbol etc.). |
|
|
Add atomic data to our molecule. |
|
Add bonding data to our molecule. |
|
Get the atomic number of an atom for a specified index. |
|
Set the atomic number of an atom for a specified index. |
|
Get the atomic coordinates of an atom for a specified index. |
|
Set the atomic coordinates of an atom for a specified index. |
|
Get the order of bond for a specified index. |
|
Set the bond order of a bond for a specified index. |
|
Return an array of atomic numbers corresponding to the atoms present in a given molecule. |
|
Return an array of integers containing the bond orders (single/double/ triple) corresponding to the bonds present in the molecule. |
|
Return an array of atomic coordinates corresponding to the atoms present in the molecule. |
|
Deep copies the atomic information (atoms and bonds) from molecule2 into molecule1. |
|
Uses vtkSimpleBondPerceiver to generate bonding information for a molecule. |
|
Create an actor for sphere molecular representation. |
|
Create an actor for ball and stick molecular representation. |
|
Create an actor for stick molecular representation. |
|
Create an actor for ribbon molecular representation. |
|
Create a bounding box for a molecule. |
Molecule
#
- class fury.molecular.Molecule(*, atomic_numbers=None, coords=None, atom_names=None, model=None, residue_seq=None, chain=None, sheet=None, helix=None, is_hetatm=None)[source]#
Bases:
vtkMolecule
Your molecule class.
An object that is used to create molecules and store molecular data (e.g. coordinate and bonding data). This is a more pythonic version of
Molecule
.- __init__(*, atomic_numbers=None, coords=None, atom_names=None, model=None, residue_seq=None, chain=None, sheet=None, helix=None, is_hetatm=None)[source]#
Send the atomic data to the molecule.
- Parameters:
atomic_numbers (ndarray of integers, optional) – The shape of the array must be (N, ) where N is the total number of atoms present in the molecule. Array having atomic number corresponding to each atom of the molecule.
coords (ndarray of floats, optional) – The shape of the array must be (N, 3) where N is the total number of atoms present in the molecule. Array having coordinates corresponding to each atom of the molecule.
atom_names (ndarray of strings, optional) – The shape of the array must be (N, ) where N is the total number of atoms present in the molecule. Array having the names of atoms.
model (ndarray of integers, optional) – The shape of the array must be (N, ) where N is the total number of atoms present in the molecule. Array having the model number corresponding to each atom.
residue_seq (ndarray of integers, optional) – The shape of the array must be (N, ) where N is the total number of atoms present in the molecule. Array having the residue sequence number corresponding to each atom of the molecule.
chain (ndarray of integers, optional) – The shape of the array must be (N, ) where N is the total number of atoms present in the molecule. Array having the chain number corresponding to each atom.
sheet (ndarray of integers, optional) – The shape of the array must be (S, 4) where S is the total number of sheets present in the molecule. Array containing information about sheets present in the molecule.
helix (ndarray of integers, optional) – The shape of the array must be (H, 4) where H is the total number of helices present in the molecule. Array containing information about helices present in the molecule.
is_hetatm (ndarray of bools, optional) – The shape of the array must be (N, ) where N is the total number of atoms present in the molecule. Array containing a bool value to indicate if an atom is a heteroatom.
- property total_num_atoms#
Return the total number of atoms in a given molecule.
- property total_num_bonds#
Return the total number of bonds in a given molecule.
PTable
#
- class fury.molecular.PTable[source]#
Bases:
vtkPeriodicTable
A class to obtain properties of elements (eg: Covalent Radius, Van Der Waals Radius, Symbol etc.).
This is a more pythonic version of
vtkPeriodicTable
providing simple methods to access atomic properties. It provides access to essential functionality available invtkPeriodicTable
. An object of this class provides access to atomic information sourced from Blue Obelisk Data Repository.- __init__()#
- atom_color(atomic_number)[source]#
Given an atomic number, return the RGB tuple associated with that element (CPK coloring convention) provided by the Blue Obelisk Data Repository.
- Parameters:
atomicNumber (int) – Atomic number of the element whose RGB tuple is to be obtained.
- atomic_number(element_name)[source]#
Given a case-insensitive string that contains the symbol or name of an element, return the corresponding atomic number.
- Parameters:
element_name (string) – Name of the element whose atomic number is to be obtained.
- atomic_radius(atomic_number, *, radius_type='VDW')[source]#
Given an atomic number, return either the covalent radius of the atom (in Å) or return the Van Der Waals radius (in Å) of the atom depending on radius_type.
- Parameters:
atomic_number (int) – Atomic number of the element whose atomic radius is to be obtained.
radius_type (string) –
Type of atomic radius to be obtained. Two valid choices:
’VDW’ : for Van der Waals radius of the atom
’Covalent’ : for covalent radius of the atom
Default: ‘VDW’
add_atom#
add_bond#
- fury.molecular.add_bond(molecule, atom1_index, atom2_index, *, bond_order=1)[source]#
Add bonding data to our molecule. Establish a bond of type bond_order between the atom at atom1_index and the atom at atom2_index.
- Parameters:
Notes
Ensure that the total number of bonds between two atoms doesn’t exceed 3. Calling
add_bond
to add bonds between atoms that already have a triple bond between them leads to erratic behavior and must be avoided.
get_atomic_number#
set_atomic_number#
get_atomic_position#
set_atomic_position#
get_bond_order#
set_bond_order#
get_all_atomic_numbers#
get_all_bond_orders#
get_all_atomic_positions#
deep_copy_molecule#
compute_bonding#
- fury.molecular.compute_bonding(molecule)[source]#
Uses vtkSimpleBondPerceiver to generate bonding information for a molecule. vtkSimpleBondPerceiver performs a simple check of all interatomic distances and adds a single bond between atoms that are reasonably close. If the interatomic distance is less than the sum of the two atom’s covalent radii plus a tolerance, a single bond is added.
- Parameters:
molecule (Molecule) – The molecule for which bonding information is to be generated.
Notes
This algorithm does not consider valences, hybridization, aromaticity, or anything other than atomic separations. It will not produce anything other than single bonds.
sphere_cpk#
- fury.molecular.sphere_cpk(molecule, *, colormode='discrete')[source]#
Create an actor for sphere molecular representation. It’s also referred to as CPK model and space-filling model.
- Parameters:
molecule (Molecule) – The molecule to be rendered.
colormode (string, optional) –
Set the colormode for coloring the atoms. Two valid color modes:
’discrete’: Atoms are colored using CPK coloring convention.
’single’: All atoms are colored with same color (grey). RGB tuple used for coloring the atoms when ‘single’ colormode is selected: (150, 150, 150).
Default: ‘discrete’
- Returns:
molecule_actor – Actor created to render the space filling representation of the molecule to be visualized.
- Return type:
vtkActor
References
Corey R.B.; Pauling L. Molecular Models of Amino Acids, Peptides, and Proteins Review of Scientific Instruments 1953, 24 (8), 621-627.
ball_stick#
- fury.molecular.ball_stick(molecule, *, colormode='discrete', atom_scale_factor=0.3, bond_thickness=0.1, multiple_bonds=True)[source]#
Create an actor for ball and stick molecular representation.
- Parameters:
molecule (Molecule) – The molecule to be rendered.
colormode (string, optional) –
Set the colormode for coloring the atoms. Two valid color modes:
’discrete’: Atoms and bonds are colored using CPK coloring convention.
’single’: All atoms are colored with same color (grey) and all bonds are colored with same color (dark grey). RGB tuple used for coloring the atoms when ‘single’ colormode is selected: (150, 150, 150). RGB tuple used for coloring the bonds when ‘single’ colormode is selected: (50, 50, 50)
Default: ‘discrete’
atom_scale_factor (float, optional) – Scaling factor. Default: 0.3
bond_thickness (float, optional) – Used to manipulate the thickness of bonds (i.e. thickness of tubes which are used to render bonds) Default: 0.1 (Optimal range: 0.1 - 0.5).
multiple_bonds (bool, optional) – Set whether multiple tubes will be used to represent multiple bonds. If True, multiple bonds (double, triple) will be shown by using multiple tubes. If False, all bonds (single, double, triple) will be shown as single bonds (i.e. shown using one tube each). Default is True.
- Returns:
molecule_actor – Actor created to render the ball and stick representation of the molecule to be visualized.
- Return type:
vtkActor
References
Turner, M. Ball and stick models for organic chemistry J. Chem. Educ. 1971, 48, 6, 407.
stick#
- fury.molecular.stick(molecule, *, colormode='discrete', bond_thickness=0.1)[source]#
Create an actor for stick molecular representation.
- Parameters:
molecule (Molecule) – The molecule to be rendered.
colormode (string, optional) –
Set the colormode for coloring the bonds. Two valid color modes:
’discrete’: Bonds are colored using CPK coloring convention.
’single’: All bonds are colored with the same color (dark grey) RGB tuple used for coloring the bonds when ‘single’ colormode is selected: (50, 50, 50)
Default: ‘discrete’
bond_thickness (float, optional) – Used to manipulate the thickness of bonds (i.e. thickness of tubes which are used to render bonds). Default: 0.1 (Optimal range: 0.1 - 0.5).
- Returns:
molecule_actor – Actor created to render the stick representation of the molecule to be visualized.
- Return type:
vtkActor
ribbon#
- fury.molecular.ribbon(molecule)[source]#
Create an actor for ribbon molecular representation.
- Parameters:
molecule (Molecule) – The molecule to be rendered.
- Returns:
molecule_actor – Actor created to render the rubbon representation of the molecule to be visualized.
- Return type:
vtkActor
References
Richardson, J.S. The anatomy and taxonomy of protein structure Advances in Protein Chemistry, 1981, 34, 167-339.