mmtfPyspark.interactions.interactionFilter module

interactionFilter.py

A filter to specify criteria for molecular interactions between a query and a target within a macromolecular structure. The filter specifies criteria for the query (e.g. a metal ion) and the target (e.g. amino acid redisudes). Interaction criteria such as distance cutoff limit the nature of interactions to be considered.

class InteractionFilter(distanceCutoff=1.7976931348623157e+308, normalizedbFactorCutoff=1.7976931348623157e+308, minInteractions=1, maxInteractions=10)[source]

Bases: object

A filter to specify criteria for molecular interactions between a query and a target

Attributes

distanceCutoff (float) cutoff distance for filter [default: float max]
normalizedbFactorCutoff (float) normalized bFactor cutoff for filter [default: float max]
minInteractions (int) minimum number of interactions [default: 1]
maxInteractions (int) maximum number of interactions [default: 10]

Methods

get_distance_cutoff() Get the maximum interaction distance.
get_max_interactions() Returns the maximum number of interactions per atom.
get_min_interactions() Returns the minimum number of interactions per atom.
get_normalized_b_factor_cutoff() Gets the maximum normalized b-factor (z-score) cutoff for an atom and its interacting neighbor atoms.
is_prohibited_target_group(group) Returns True if the specified group must not occur in an interactions.
is_query_atom_name(atomName) Returns True if the specified atom matches the query conditions.
is_query_element(element) Returns True if the specified elements matches the query conditions.
is_query_group(group) Returns True if the specified group matches the query conditions.
is_target_atom_name(atomName) Returns True if the specified atom matches the target conditions.
is_target_element(element) Returns True if the specified elements matches the target conditions.
is_target_group(group) Returns True if the specified group matches the target conditions.
set_distance_cutoff(distanceCutoff) Set the distnace cutoff for interacting atoms
set_max_interactions(maxInteractions) Sets the maximum number of interactions per atom.
set_min_interactions(minInteractions) Sets the minimum number of interactions per atom.
set_normalized_b_factor_cutoff(…) Sets the maximum noramlized b-factor cutoff.
set_prohibited_target_groups(groups) Sets groups that must not appear in interactions.
set_query_atom_names(include, atomNames) Set atom names to either be included or excluded in the query
set_query_elements(include, elements) Sets the elements to either be included or excluded in the query.
set_query_groups(include, groups) Sets groups to either be included or excluded in the query.
set_target_atom_names(include, atomNames) Set atom names to either be included or excluded in the target.
set_target_elements(include, elements) Sets the elements to either be included or excluded in the target.
set_target_groups(include, groups) Sets groups to either be included or excluded in the target.
get_distance_cutoff()[source]

Get the maximum interaction distance. At least one pair of query and target atoms must be wintin in distance cutoff

Returns:

int

maximum interaction distance

get_max_interactions()[source]

Returns the maximum number of interactions per atom. Atoms that interact with fewer atoms wil be discarded.

Returns:

int

maximum number of interactions per atom

get_min_interactions()[source]

Returns the minimum number of interactions per atom. Atoms that interact with fewer atoms wil be discarded.

Returns:

int

minimum number of interactions per atom

get_normalized_b_factor_cutoff()[source]

Gets the maximum normalized b-factor (z-score) cutoff for an atom and its interacting neighbor atoms.

Returns:

float

maximum normalized b-factor cutoff

is_prohibited_target_group(group)[source]

Returns True if the specified group must not occur in an interactions.

Parameters:

group : str

group that must not occur in interactions

Returns:

bool

True if group is prohibited else False

is_query_atom_name(atomName)[source]

Returns True if the specified atom matches the query conditions.

Parameters:

atomName : str

the atom name to be checked

Returns:

bool

True if atom matches query conditinos, else False

is_query_element(element)[source]

Returns True if the specified elements matches the query conditions.

Parameters:

element: str

the element to be checked

Returns

——-

bool

True if element matches query conditinos, else False

is_query_group(group)[source]

Returns True if the specified group matches the query conditions.

Parameters:

group : str

the group to be checked

Returns:

bool

True if group matches query conditinos, else False

is_target_atom_name(atomName)[source]

Returns True if the specified atom matches the target conditions.

Parameters:

atomName : str

the atom to be checked

Returns:

bool

True if atom matches target conditinos, else False

is_target_element(element)[source]

Returns True if the specified elements matches the target conditions.

Parameters:

element : str

the element to be checked

Returns:

bool

True if element matches target conditinos, else False

is_target_group(group)[source]

Returns True if the specified group matches the target conditions.

Parameters:

group : str

the group to be checked

Returns:

bool

True if group matches target conditinos, else False

set_distance_cutoff(distanceCutoff)[source]

Set the distnace cutoff for interacting atoms

Parameters:

distanceCutoff : float

the maximum distance for interacting atoms

set_max_interactions(maxInteractions)[source]

Sets the maximum number of interactions per atom. Atoms that interact with fewer atoms will be discarded

Parameters:

maxInteractions : int

minimum number of interactions per atom

set_min_interactions(minInteractions)[source]

Sets the minimum number of interactions per atom. Atoms that interact with fewer atoms will be discarded

Parameters:

minInteractions : int

minimum number of interactions per atom

set_normalized_b_factor_cutoff(normalizedbFactorCutoff)[source]

Sets the maximum noramlized b-factor cutoff. This value represents a z-score (see reference below), the signed number of standard deviations by which the b-factor. High z-scores indicate either high flexibility and/or experimental error for the atoms involved in the interactions. By setting a cutoff value, not well defined interactions can be exculded.

Frequently used z-scores:

Confidence level Tail area z-scores
90% 0.05 +-1.645 95% 0.025 +-1.96 99% 0.005 +-2.576

For example, to include all interactions within the 90% confidence interval, set the normalized b-factor to +1.645

Parameters:

normalizedbFactorCutoff : float

maximum normalized b-factor

References

Z-score: https://en.wikipedia.org/wiki/Standard_score

set_prohibited_target_groups(groups)[source]

Sets groups that must not appear in interactions. Any interactions that involves the specified groups will be excluded from the results.

Parameters:

groups : list

one or more group names to be prohibited

Examples

Find Zinc interactions, but discard any interactions where the metal is involved in an interaction with water.

>>> filter = InteractionFilter()
>>> filter.set_query_groups(True, 'ZN')
>>> filter.set_prohibited_target_groups(["HOH"])
set_query_atom_names(include, atomNames)[source]

Set atom names to either be included or excluded in the query

Parameters:

include : bool

if True, uses set of atom names in query, if False, ignores atoms with the specified names and uses all other atoms

atom_names : list

atoms to be included or excluded in the query

Examples

Find interaction with C-alpha and C-beta atoms.

>>> filter = InteractionFilter()
>>> filter.set_query_atom_names(True, ['CA', 'CB'])

Exclude backbone atoms, but consider all other atom names: e.g, amino acid side chains.

>>> filter.set_query_atom_names(False, ['N', 'CA', 'C', 'O'])
set_query_elements(include, elements)[source]

Sets the elements to either be included or excluded in the query. Element strings are case sensitive (e.g., “Zn” for Zinc).

Parameters:

include : bool

if True, uses the specifed elements in the query, if False, ignores the specified elemetns and use all other elements

elements : list

list of elements to be included or excluded in query

Examples

Only use elements O, N, S in the query groups in find polar interactions

>>> filter = InteractionFilter()
>>> filter.set_query_elements(True, ["O", "N", "S"])

Exclude non-polar elements and hydrogen in query groups and use all other elements to find interactions.

>>> elements = ['C', 'H', 'P']
>>> filter.set_query_elements(False, elements)
set_query_groups(include, groups)[source]

Sets groups to either be included or excluded in the query. Group names must be upper case (e.g. ‘ZN’ for Zinc)

Parameters:

include : bool

if True, uses the specified groups in the query, if False, ignores the specified groups and uses all other groups

groups : list

groups to be included or excluded in query

Examples

Find interactions with ATP and ADP

>>> filter = InteractionFilter()
>>> filter.set_query_groups(True, ['ATP', 'ADP'])

Exclude water and heavy water and use all other groups to find interactions.

>>> groups = ["HOH", "DOD"]
>>> filter.set_query_groups(False, groups)
set_target_atom_names(include, atomNames)[source]

Set atom names to either be included or excluded in the target.

Parameters:

include : bool

if True, uses set of atom names in target, if False, ignores atoms with the specified names and uses all other atoms

atom_names : list

atoms to be included or excluded in the target

Examples

Find interaction with C-alpha and C-beta atoms.

>>> filter = InteractionFilter()
>>> filter.set_target_atom_names(True, ['CA', 'CB'])

Exclude backbone atoms, but consider all other atom names: e.g, amino acid side chains.

>>> filter.set_target_atom_names(False, ['N', 'CA', 'C', 'O'])
set_target_elements(include, elements)[source]

Sets the elements to either be included or excluded in the target. Element strings are case sensitive (e.g., “Zn” for Zinc).

Parameters:

include : bool

if True, uses the specifed elements in the target, if False, ignores the specified elemetns and use all other elements

elements : list

list of elements to be included or excluded in target

Examples

Only use elements O, N, S in the target groups in find polar interactions

>>> filter = InteractionFilter()
>>> filter.set_target_elements(True, ["O", "N", "S"])

Exclude non-polar elements and hydrogen in target groups and use all other elements to find interactions.

>>> elements = ['C', 'H', 'P']
>>> filter.set_query_elements(False, elements)
set_target_groups(include, groups)[source]

Sets groups to either be included or excluded in the target. Group names must be upper case (e.g. ‘ZN’ for Zinc)

Parameters:

include : bool

if True, uses the specified groups in the target, if False, ignores the specified groups and uses all other groups

groups : list

groups to be included or excluded in query

Examples

Find interactions with specific amino acid groups.

>>> filter = InteractionFilter()
>>> filter.set_target_groups(True, ['CYS','HIS','ASP','GLU'])

Exclude water and heavy water and use all other groups to find interactions.

>>> groups = ["HOH", "DOD"]
>>> filter.set_target_groups(False, groups)