openpharmacophore.Protein

class openpharmacophore.Protein(topology, coords)[source]

Bases: object

Represents a protein and optionally its different structures if it comes from a MD trajectory. The protein may contain ligands but is not necessary.

Parameters:
  • topology (Topology) – The topology.

  • coords (Quantity) – A quantity of shape (n_structures, n_atoms, 3)

Methods

add_hydrogens

Add hydrogens to the protein.

atoms_at_distance

Get the indices of the atoms that are at min_dist <= centroid <= max_dist.

concatenate

Concatenate new residues to this protein.

extract_chain

Extract the chain with given id from the topology.

get_ligand

Extract a ligand assuming there is one.

has_hydrogens

has_ligands

has_solvent_or_ions

ligand_ids

remove_all_ligands

Remove all ligands from this protein.

remove_ligand

Remove a ligand from this protein.

remove_solvent_and_ions

Remove the solvent and ions from this protein.

slice

Obtain a subset of the protein with the specified atoms.

Attributes

coords

n_atoms

n_chains

n_residues

topology

add_hydrogens()[source]

Add hydrogens to the protein.

Assumes that the protein has a single frame.

atoms_at_distance(frame, centroid, max_dist, min_dist=0)[source]

Get the indices of the atoms that are at min_dist <= centroid <= max_dist.

Parameters:
  • frame (int) – Frame of the trajectory

  • centroid (puw.Quantity) – Shape (1,3)

  • max_dist (puw.Quantity) – Scalar

  • min_dist (puw.Quantity) – Scalar

Returns:

Array if integers with the indices.

Return type:

np.ndarray

concatenate(topology, coords)[source]

Concatenate new residues to this protein.

Parameters:
  • topology (Topology)

  • coords (QuantityLike)

extract_chain(chain_id)[source]

Extract the chain with given id from the topology.

Parameters:

chain_id (str or int) – Id of the chain

get_ligand(ligand_id, remove_hyd=False)[source]

Extract a ligand assuming there is one.

Parameters:
  • ligand_id (str) – ID of the ligand. ID is composed by pdb id followed by chain name, i.e. “EST:B”.

  • remove_hyd (bool) – Whether to remove hydrogens from the ligand.

Returns:

A ligand. Its bond orders may be incorrect.

Return type:

openpharmacophore.Ligand

remove_all_ligands()[source]

Remove all ligands from this protein.

remove_ligand(ligand_id)[source]

Remove a ligand from this protein.

Parameters:

ligand_id (str) – ID of the ligand

remove_solvent_and_ions()[source]

Remove the solvent and ions from this protein.

slice(atoms, frame=None)[source]

Obtain a subset of the protein with the specified atoms.

Parameters:
  • atoms (list[int])

  • atoms (list[int]) – Indices of the atoms in the sliced protein.

  • frame (int, optional) – Frame to extract. If None all frames are extracted.

Returns:

The sliced protein.

Return type:

Protein