QMzymeRegion

class QMzyme.QMzymeRegion.QMzymeRegion(name, atoms: list, atom_group=None, universe=None)

Product of the RegionBuilder class. A QMzymeRegion is composed of QMzymeAtom objects.

See also

QMzymeRegion.QMzymeResidue

property ids

A list of atom numbers/ids from the original starting structure. An atom id of an atom from the starting structure should not change.

property ix_array

A list of atom indices starting from 0. If the order of atoms changes the ix assigned to an atom will change. See ids as an alternative.

See also

ids()

property resids
Returns:

Sorted residue IDs for residues within this region.

Return type:

list

property n_atoms
Returns:

Number of atoms within this region.

Return type:

int

property n_residues
Returns:

Number of residues within this region.

Return type:

int

property residues
Returns:

Residues in this region.

Return type:

List[QMzymeResidue]

property positions
Returns:

Positions of all atoms in region.

Return type:

NumPy array

property atom_group

Returns the AtomGroup instance. If the region was not bult from an AtomGroup initially, it will be converted to one. Note, in this case, the universe of that AtomGroup will

property segids
property creation_attr

Filters _selection_attr into _creation_attr. Ultimately, it creates a property to the region of how the region was created. :rtype: List[creation_attr]

reset_creation_attr()

Resets the selection and creation parameters for the region.

set_creation_attr(attr=None, **kwargs)

Manually sets or updates the selection parameters for the region. This is particularly useful for assigning parameters to internally generated regions that need to inherit the creation history of their parent selection scheme.

get_atom(id)
has_atom(id)
has_residue(resid)
add_atom(atom: _QMzymeAtom, override_same_id=False)
Parameters:

atom (QMzymeAtom, required) -- The atom you want to add to the QMzymeRegion.

Warning

Ths will modify the QMzymeRegion directly.

remove_atom(atom: _QMzymeAtom)
Parameters:

atom (QMzymeAtom, required) -- The atom you want to remove from the QMzymeRegion.

Warning

Ths will modify the QMzymeRegion directly.

sorted_atoms(override_same_id=False)
get_residue(resid)
rename(name)
write(filename=None, format='pdb')

Converts QMzymeRegion to an MDAnalysis AtomGroup, then uses the AtomGroup method to write file.

Parameters:
  • filename (str, optional) -- Name of file. If not specified, the region name attribute will be used. If the region name is an empty string the name will become 'noname'. Note, if you specify a file format in filename (i.e., filename='name.xyz'), but the value of the 'format' argument does not match, the value assigned to format will be used.

  • format (str, default='pdb') -- Format of created file.

Note

Any file ending supported by the MDAnalysis AtomGroup write method is supported as long as all the necessary information to write that file type is present in the region.

set_fixed_atoms(ids: list = None, atoms: list = None)

Example Usage: To fix all alpha carbons >>> ids = get_ids(attribute='type', value='CA') >>> set_fixed_atoms(ids=ids)

Parameters:
  • ids (List[int], optional, default=None) -- Atom ids in QMzymeRegion to fix.

  • atoms (List[QMzymeAtom], default=None) -- Atoms in QMzymeRegion to fix.

Note

Must specify either ids or atoms (if both are specified, atoms will be used). During calculation file writing if an atom has attribute is_fixed=True, that atom will be frozen.

get_ids(attribute: str, value)
Example:

To fix all alpha carbons >>> ids = get_ids(attribute='type', value='CA') >>> set_fixed_atoms(ids=ids)

Parameters:
  • attribute (str, required) -- QMzymeAtom object attribute name.

  • value (Depends on the attribute, required) -- Value of interest for the corresponding attribute.

Returns:

atom ids.

Return type:

List[int]

See also

get_atoms()

get_atoms(attribute: str, value)
Example:

To see what atoms are in residue with resid 14. > atoms = get_atoms(attribute='resid', value=14)

Parameters:
  • attribute (str, required) -- QMzymeAtom object attribute name.

  • value (Depends on the attribute, required) -- Value of interest for the corresponding attribute.

Returns:

atom ids.

Return type:

List[int]

List[QMzymeAtom]

See also

get_ids()

get_indices(attribute: str, value)
get_ix_array_from_ids(ids)
Example:

>>> ixs = get_ids(attribute='type', value='CA')
check_missing_attr(attr)
set_method(method)

Used by the :module:`~QMzyme.CalculateModel` module when the region is passed to a Calculation Method class.

set_charge(charge)
guess_charge(verbose=True)
read_charges(verbose=True)
combine(other, name=None)

Combine region with another region.

Parameters:
  • other (QMzymeRegion) -- Region containing atoms to combine with self.

  • name (str, default=None) -- Name of returned region. If no name is specified the name will be 'self.name_other.name_combined.'.

Returns:

Combined region.

Return type:

QMzymeRegion

Note

Self region is not altered, and returned region will not contain properties or attributes of self region not described from the QMzymeAtom level (i.e., atom_group) except for _universe. Atoms found in both self and other will only be copied from self. This is important if you have different attribute values on an atom that appears in both regions (i.e., is_fixed=True and is_fixed=False).

subtract(other, name='')

Creates a new QMzymeRegion that does not contain any atoms found in other.

Parameters:
  • other (QMzymeRegion) -- Region containing atoms to remove from self.

  • name (str, default='') -- Name of returned region.

Returns:

New region with atoms found in other region removed.

Return type:

QMzymeRegion

Note

Self region is not altered, and returned region will not contain properties or attributes of self region not described from the QMzymeAtom level (i.e., atom_group) except for _universe.

get_overlapping_atoms(other)
Parameters:

other (QMzymeRegion) -- Other QMzymeRegion to measure overlap with.

Returns:

Atoms in self that are also found in other.

Return type:

QMzymeAtom

set_atom_segid(segid)
summarize(filename=None)
align_to(other, self_selection='all', other_selection='all', update_region=True)
find_nearby_residues(other, dist)

Finds residues in 'other' region that have at least one atom within 'dist' Angstroms of any atom in 'self' region.

Parameters:
  • other (QMzymeRegion) -- The target region to search within for nearby residues.

  • dist (float) -- The distance cutoff in Angstroms.

Returns:

List of unique residues from the other region within the cutoff distance.

Return type:

list of QMzymeResidue

Returns: list of unique QMzymeResidue objects from the 'other' region.

store_calculation_results(calculation_file)

Once you run a calculation on a QMzymeRegion you can then store the calculation results. This method uses cclib to parse the output, so any calculation file that cclib can read can be stored to your QMzymeRegion, and the stored dictionary will contain all the data that cclib parses.