packman.molecule.model module

The ‘Model’ object host file.

This is file information, not the class information. This information is only for the API developers. Please read the ‘Model’ object documentation for details.

Citation:
Pranav M Khade, Robert L Jernigan, PACKMAN-Molecule: Python Toolbox for Structural Bioinformatics, Bioinformatics Advances, 2022;, vbac007, https://doi.org/10.1093/bioadv/vbac007

Example:

from packman.molecule import Model
help( Model )

Note

  • The models are nothing but frames of the PDB file.
Authors:
class packman.molecule.model.Model(id, AllAtoms, AllResidues, AllChains, AllHetAtoms, AllHetMols)

Bases: object

This class contains the information about the ‘Chain’ object (packman.molecule.Chain).

This class contains all the information available about the Chain and stores the corresponding ‘Residue’ and ‘Hetmol’ objects in itself. The Chain class is the third lowest in the hierarchy of the ‘molecule’ API classes. the order of hierarchy being: Protein> Model> Chain> Residue> Atom. This class is also the component of the ‘molecule’ module API. Please read the Tutorials and Documentation for more details.

Notes

Parameters:
  • id (int) – Model ID from the PDB file ordered from first to the last. Each Model in a PDB file has unique ID. (essential)
  • AllAtoms ({packman.molecule.Atom}) – Dictionary of all the ‘Atom’ in the given model.
  • AllResidues ({packman.molecule.Residue}) – Dictionary of all the ‘Residue’ in the given model.
  • AllChains ({packman.molecule.Chain}) – Dictionary of all the ‘Chain’ in the given model.
  • AllHetAtoms ({packman.molecule.HetAtom}) – Dictionary of all the ‘HetAtom’ in the given model.
  • AllHetMols ({packman.molecule.HetMol}) – Dictionary of all the ‘HetMol’ in the given model.
calculate_bonds()

Calculate the bonds in the given ‘Model’.

Currently, bonds are only calculated based on the following RCSB PDB resource file: http://ftp.wwpdb.org/pub/pdb/data/monomers/aa-variants-v1.cif.gz

calculate_entropy(entropy_type, chains=None, probe_size=1.4, onspherepoints=30)

Calculate the entropy for the each amino acid will be returned.

The ‘chains’ argument should be used when the user wants to restrict the analysis to a chain or group of chains rather than the whole structure.

Parameters:
  • entropy_type (str) – Type of entropy to be calculated (Options: PackingEntropy)
  • chains ([str]/str) – Chain IDs for the Entropy calculation (None means all the chains are included; single string means only one chain ID; multiple chains should be an array of strings).
  • probe_size (float) – Radius of the probe to generate the surface points (This value should not be less than 1;Read the Publication for more details)
  • onspherepoints (int) – Number of points to be generated around each point for the surface (Read the Publication for more details)
check_clashes(distance=0.77)

Check if any atoms are too close to each other. This is important since too close atoms in the elastic network models can be very bad for the results.

Notes

  • This function will be moved to the molecule manipulation package later
Parameters:distance (float) – The distance cutoff user wishes to defined as a clash radius (default:0.77; max bond length)
Returns:Number of clashes present according to the set cutoff.
Return type:clashes (int)
get_atom(idx)

Get the atom of the given ID.

Note: - This function is different from packman.molecule.chain.get_atoms() and also packman.molecule.residue.get_atom()
  • If the PDB file is constructed manually/ has multiple atoms of the same ID, the first instance of the atom with that id is returned. Please avoid saving two atoms with same ID in a same structure file in a given frame/model.
Parameters:idx (int) – Get atom by the id
Returns:Atom of the given ID if successful; None otherwise.
Return type:atom (packman.molecule.Atom)
get_atom_byid(query_atom_id)

Get the ‘Atom’ with corresponding ‘Atom’ ID

Returns:‘packman.molecule.Atom’ object if successful, None otherwise.
get_atoms()

Get the generator of corresponding ‘Atom’ objects of the ‘Model’

Returns:generator of ‘Atom’ objects if successful, None otherwise.
get_backbone()

Get the Backbone atoms of the given ‘Model’ as a list of ‘Atom’ object

Note

  • Backbone Atoms: CA, O, N, C
Returns:list of packman.molecule.Atom if successful, None otherwise.
get_bond(idx)

Return the specific bond with specific ID.

Parameters:idx (int) – Get the ‘Bond’ by the id
Returns:packman.molecule.Bond object if successful, None otherwise.
get_bonds()

Return all the bonds in the given ‘Model’.

Returns:generator of packman.molecule.Bond objects if successful, None otherwise.
get_calpha()

Get the C-Alpha atom of the ‘Model’ as an ‘Atom’ object.

Returns:list of packman.molecule.Atom if successful, None otherwise.
get_chain(ChainID)

Get the corresponding ‘Chain’ object

Returns:‘Chain’ object if successful, None otherwise.
get_chains()

Get the list of corresponding ‘Chain’ objects of the ‘Model’

Returns:[packman.molecule.Chain] if successful, None otherwise.
get_entropy(entropy_type)

Get the Packing Entropy of the given ‘Chain’.

Parameters:type (str) – Type of entropy (Allowed Values: 1. PackingEntropy)

Note

  • More type of Entropies might be added in the future.
get_hetatoms()

Get the generator of corresponding ‘HetAtom’ objects of the ‘Model’

Returns:generator of ‘packman.molecule.HetAtom’ objects if successful, None otherwise.
get_hetmols()

Get the generator of corresponding ‘HetMol’ objects of the ‘Model’

Returns:generator of ‘packman.molecule.HetMol’ objects if successful, None otherwise.
get_id()

Get the ID of the ‘Model’

Returns:int if successful, None otherwise.
get_parent()

Get the ‘Protein’ parent of the ‘Model’ object.

Returns:‘packman.molecule.Protein’ object if successful, None otherwise.
get_property(property_name)

Get the Property of the given ‘Chain’.

Property is any key and value combination that can be assigned to this object. This (along with the set_property) feature is mainly useful for the user customization. Properties are like pinboards. You can pin anything to the object with a key as a pin.

Parameters:property_name (object) – The ‘Key’ or a name the user wants to assign to to the property

Note

  • Users can add custom annotations; for example: If particular chain becomes disordered, it can be annotated with this feature.
get_residues()

Get the generator of corresponding ‘Residue’ objects of the ‘Model’

Returns:array of ‘Residue’ objects if successful, None otherwise.
get_sequence()

Get the Amino acid sequence of the chain. (Protein chains only)

Returns:FASTA format string of the chain sequence.
get_torsion(bond, neighbor1=None, neighbor2=None, radians=True)

Calculate the torsion angle of the given covalent bond with the corresponding selected neighbors.

Note

At least four atoms are needed to form two planes that can measure the torsional angles; therefore, along with the two bond atoms, the user needs to provide the additional two atoms that are ideally non-mutual neighbors of the atoms in the bond.

Parameters:
  • bond (packman.molecule.Bond) – The bond user wishes to calculate torsion angle to.
  • neighbor1 (int/packman.molecule.Atom) – Neighbour of the Atom1 as an ‘Atom’ object or Atom ID.
  • neighbor1 – Neighbour of the Atom2 as an ‘Atom’ object or Atom ID.
  • radians (True/False) – Return value of the angle in radians (returns value in degrees if False; Default : True)
Returns:

The torsion angle in radians/degrees if sucessful, None otherwise.

set_id(new_id)

Set the ID of the given ‘Model’

Parameters:new_id (int) – The ID User wishes to assign to the given ‘Model’
set_parent(new_parent)

Set the ‘Protein’ object as a parent to the ‘Model’ object.

Parameters:new_parent (packman.molecule.Protein) – The ‘Protein’ object as a parent to the given ‘Model’
set_property(property_name, value)

Set the Property of the given ‘Model’.

Property is any key and value combination that can be assigned to this object. This (along with the get_property) feature is mainly useful for the user customization. Properties are like pinboards. You can pin anything to the object with a key as a pin.

Parameters:
  • property_name (object) – The ‘Key’ or a name the user wants to assign to to the property
  • value (object) – The value the user wants to assign to the property

Note

  • Users can add custom annotations; for example: If particular amino acid becomes disordered, it can be annotated with this feature.
set_torsion(bond, theta, neighbor1=None, neighbor2=None, radians=True)

Set the torsion for the given covalent bond with the corresponding selected neighbors.

Note

At least four atoms are needed to form two planes that change the torsional angles; therefore, along with the two bond atoms, the user needs to provide the additional two atoms that are ideally non-mutual neighbors of the atoms in the bond.

Parameters:
  • bond (packman.molecule.Bond) – The bond user wishes to rotate.
  • theta (int) – Set the torsional angle (see the ‘radians’ parameter description)
  • neighbor1 (int/packman.molecule.Atom) – Neighbour of the Atom1 as an ‘Atom’ object or Atom ID.
  • neighbor1 – Neighbour of the Atom2 as an ‘Atom’ object or Atom ID.
  • radians (True/False) – Parameter ‘theta’ will be assuned to be in Radians if True, Degrees will be assumed when False. ( Default : True)
Returns:

True if successfulm None otherwise