idpet.featurization package

Submodules

idpet.featurization.angles module

idpet.featurization.angles.featurize_a_angle(traj, get_names=True, atom_selector='protein and name CA')[source]

Calculate Cα-based torsion angles angles from a given MD trajectory.

Return type:

Union[ndarray, Tuple[ndarray, List[str]]]

Parameters

traj: mdtraj.Trajectory

The MDTraj trajectory containing the protein structure.

get_names: bool, optional

If True, returns feature names along with the alpha angles. Default is True.

atom_selector: str, optional

The atom selection string for C-alpha atoms. Default is “protein and name CA”.

Returns

Union[np.ndarray, Tuple[np.ndarray, List[str]]]

If get_names is True, returns a tuple with alpha angle values and feature names. If get_names is False, returns an array of alpha angle values.

Notes

This function calculates Cα-based torsion angles angles from a given MD trajectory.

idpet.featurization.angles.featurize_phi_psi(traj, get_names=True, ravel=True)[source]

Calculate phi (ϕ) and psi (ψ) angles from a given MD trajectory.

Return type:

Union[ndarray, Tuple[ndarray, List[str]]]

Parameters

traj: mdtraj.Trajectory

The MDTraj trajectory containing the protein structure.

get_names: bool, optional

If True, returns feature names along with the phi and psi angles. Default is True.

ravel: bool, optional

If True, returns the angles in a flattened array. Default is True.

Returns

Union[np.ndarray, Tuple[np.ndarray, List[str]]]

If get_names is True, returns a tuple with phi and psi angles along with feature names. If get_names is False, returns an array of phi and psi angles.

Notes

This function calculates phi (ϕ) and psi (ψ) angles from a given MD trajectory.

idpet.featurization.angles.featurize_tr_angle(traj, type, min_sep=2, max_sep=None, ravel=True, get_names=True)[source]

Calculate trRosetta angles between pair of residues.

Return type:

array

Parameters

trajmdtraj.Trajectory

The MDtraj trajectory object.

typestr

The type of angle to calculate. Supported options: ‘omega’ or ‘phi’.

min_sepint, optional

The minimum sequence separation for angle calculations. Default is 2.

max_sepUnion[None, int, float], optional

The maximum sequence separation for angle calculations. Default is None.

ravelbool, optional

Whether to flatten the output array. Default is True.

get_namesbool, optional

Whether to return the names of the calculated features. Default is True.

Returns

anglesnumpy.ndarray

A numpy array storing the angle values.

Notes

This function calculates trRosetta angles between pairs of residues. For more information, refer to the original trRosetta paper (https://pubmed.ncbi.nlm.nih.gov/31896580/).

idpet.featurization.angles.featurize_tr_omega(traj, min_sep=2, max_sep=None, ravel=True, get_names=True)[source]

Calculate omega angles from trRosetta. These angles are torsion angles defined between a pair of residues i and j and involving the following atoms:

Ca(i) – Cb(i) – Cb(j) – Ca(j)

If a residue does not have a Cb atom, a pseudo-Cb will be added automatically.

Parameters

traj: mdtraj.Trajectory

The MDTraj trajectory containing the protein structure.

min_sep: int, optional

The minimum separation between residues for computing omega angles. Default is 2.

max_sep: int, optional

The maximum separation between residues for computing omega angles. Default is None.

ravel: bool, optional

If True, returns a flattened array of omega angle values. Default is True.

get_names: bool, optional

If True, returns feature names along with the omega angles. Default is True.

Returns

Union[np.ndarray, Tuple[np.ndarray, List[str]]]

If ravel is True, returns a flattened array of omega angle values. If ravel is False, returns a 3D array of omega angle values. If get_names is True, returns a tuple with feature names along with the omega angles.

Notes

This function calculates omega angles from trRosetta for a given MD trajectory.

rtype:

Union[ndarray, Tuple[ndarray, List[str]]]

idpet.featurization.angles.featurize_tr_phi(traj, min_sep=2, max_sep=None, ravel=True, get_names=True)[source]

Calculate phi angles from trRosetta. These angles are defined between a pair of residues i and j and involve the following atoms:

Ca(i) – Cb(i) – Cb(j)

If a residue does not have a Cb atom, a pseudo-Cb will be added automatically.

Parameters

traj: mdtraj.Trajectory

The MDTraj trajectory containing the protein structure.

min_sep: int, optional

The minimum separation between residues for computing phi angles. Default is 2.

max_sep: int, optional

The maximum separation between residues for computing phi angles. Default is None.

ravel: bool, optional

If True, returns a flattened array of phi angle values. Default is True.

get_names: bool, optional

If True, returns feature names along with the phi angles. Default is True.

Returns

Union[np.ndarray, Tuple[np.ndarray, List[str]]]

If ravel is True, returns a flattened array of phi angle values. If ravel is False, returns a 3D array of phi angle values. If get_names is True, returns a tuple with feature names along with the phi angles.

Notes

This function calculates phi angles from trRosetta for a given MD trajectory.

rtype:

Union[ndarray, Tuple[ndarray, List[str]]]

idpet.featurization.angles.get_angles(a, b, c)[source]

Calculate planar angles defined by 3 sets of points.

idpet.featurization.angles.get_dihedrals(a, b, c, d)[source]

calculate dihedral angles defined by 4 sets of points.

idpet.featurization.distances module

idpet.featurization.distances.calc_ca_dmap(traj, min_sep=1, max_sep=None)[source]

Calculate the (N, L, L) distance maps between C-alpha atoms for visualization.

Return type:

ndarray

Parameters

trajmdtraj.Trajectory

The MDtraj trajectory object.

Returns

dmapnumpy.ndarray

The distance maps of shape (N, L, L), where N is the number of frames and L is the number of C-alpha atoms.

Notes

This function calculates the distance maps between C-alpha atoms for visualization purposes.

idpet.featurization.distances.calc_com_dmap(traj, min_sep=1, max_sep=None)[source]

Calculate the (N, L, L) distance maps between center of mass (COM) atoms for visualization.

Return type:

ndarray

Parameters

trajmdtraj.Trajectory

The MDtraj trajectory object.

Returns

dmapnumpy.ndarray

The distance maps of shape (N, L, L), where N is the number of frames and L is the number of center of mass (COM) atoms.

Notes

This function calculates the distance maps between center of mass (COM) atoms for visualization purposes.

idpet.featurization.distances.featurize_ca_dist(traj, get_names=True, atom_selector='name CA', *args, **kwargs)[source]

Calculate C-alpha distances between pairs of residues.

Return type:

Union[ndarray, Tuple[ndarray, List[str]]]

Parameters

trajmdtraj.Trajectory

The MDtraj trajectory object.

min_sepint, optional

The minimum sequence separation for distance calculations. Default is 2.

max_sepint or None, optional

The maximum sequence separation for distance calculations. Default is None.

inversebool, optional

Whether to calculate inverse distances. Default is False.

get_namesbool, optional

Whether to return the names of the calculated features. Default is True.

atom_selectorstr, optional

The atom selection string. Default is “name CA”.

Returns

distancesnumpy.ndarray or Tuple

The calculated C-alpha distances. If get_names is True, returns a tuple containing distances and corresponding feature names.

Notes

This function calculates C-alpha distances between pairs of residues.

idpet.featurization.distances.featurize_com_dist(traj, min_sep=2, max_sep=None, inverse=False, get_names=True, atom_selector='name == CA')[source]

Calculate center of mass (COM) distances between pairs of residues.

Return type:

Union[ndarray, Tuple[ndarray, List[str]]]

Parameters

trajmdtraj.Trajectory

The MDtraj trajectory object.

min_sepint, optional

The minimum sequence separation for distance calculations. Default is 2.

max_sepint or None, optional

The maximum sequence separation for distance calculations. Default is None.

inversebool, optional

Whether to calculate inverse distances. Default is False.

get_namesbool, optional

Whether to return the names of the calculated features. Default is True.

atom_selectorstr, optional

The atom selection string. Default is “name == CA”.

Returns

distancesnumpy.ndarray or Tuple

The calculated center of mass (COM) distances. If get_names is True, returns a tuple containing distances and corresponding feature names.

Notes

This function calculates center of mass (COM) distances between pairs of residues.

idpet.featurization.distances.rmsd(traj)[source]

idpet.featurization.ensemble_level module

Calculate features at the ensemble level.

idpet.featurization.ensemble_level.calc_flory_scaling_exponent(traj)[source]
Return type:

Tuple[float]

Calculate the apparent Flory scaling exponent in an ensemble. Code adapted from:

Arguments

trajmdtraj.Trajectory

Input trajectory object.

Returns

resuts: tuple

Tuple containing the nu (Flory scaling exponent), error on nu, R0 and error on R0. All values are calculated by fitting the internal scaling profiles. For more information see https://pubmed.ncbi.nlm.nih.gov/38297118/ and https://pubs.acs.org/doi/full/10.1021/acs.jpcb.3c01619.

idpet.featurization.ensemble_level.calc_flory_scaling_exponent_cg(traj)[source]
Return type:

Tuple[float]

Calculate the apparent Flory scaling exponent in an ensemble. Code adapted from:

Arguments

trajmdtraj.Trajectory

Input trajectory object.

Returns

resuts: tuple

Tuple containing the nu (Flory scaling exponent), error on nu, R0 and error on R0. All values are calculated by fitting the internal scaling profiles. For more information see https://pubmed.ncbi.nlm.nih.gov/38297118/ and https://pubs.acs.org/doi/full/10.1021/acs.jpcb.3c01619.

idpet.featurization.glob module

idpet.featurization.glob.compute_asphericity(trajectory)[source]
idpet.featurization.glob.compute_end_to_end_distances(trajectory, atom_selector, rg_norm=False)[source]
idpet.featurization.glob.compute_ensemble_sasa(trajectory)[source]
idpet.featurization.glob.compute_prolateness(trajectory)[source]

idpet.featurization.utils module

idpet.featurization.utils.get_max_sep(L, max_sep)[source]

Get the maximum separation between indices.

Return type:

int

Parameters

Lint

The size of the matrix.

max_sepUnion[None, int, float]

The maximum separation between indices.

Returns

int

The maximum separation between indices.

Notes

This function calculates the maximum separation between indices based on the size of the matrix and the provided maximum separation value.

idpet.featurization.utils.get_triu_indices(L, min_sep=1, max_sep=None)[source]

Get the upper triangle indices of a square matrix with specified minimum and maximum separations.

Return type:

List[list]

Parameters

Lint

The size of the square matrix.

min_sepint, optional

The minimum separation between indices. Default is 1.

max_sepUnion[None, int, float], optional

The maximum separation between indices. Default is None.

Returns

List[list]

A list of lists containing the upper triangle indices of the square matrix.

Notes

This function returns the upper triangle indices of a square matrix with the specified minimum and maximum separations.

Module contents