transforms

Transforms are applied during the representation stage and you can pass them as a list to the conversion function. For example, this code snippet creates a dataset from RCSB and centers the coordinates of all the proteins:

>>> from proteinshake.datasets import RCSBDataset
>>> from proteinshake.transforms import CenterTransform
>>> da = RCSBDataset().to_voxel(transforms=[CenterTransform()])

To create your own transform simply inherit from proteinshake.transforms.Transform() and implement the __call__(self, protein) method. This function is applied to the protein dictionary of every protein in a dataset.

Compose

Transform

A callable object which accepts a protein dictionary and returns an updated version of it.

IdentityTransform

Do nothing to the protein

CenterTransform

Center the coordinates of a protein at atom and residue level.

RandomRotateTransform

Apply a random rotation to the coordinate arrays of a protein

class Transform[source]

A callable object which accepts a protein dictionary and returns an updated version of it.

class IdentityTransform[source]

Do nothing to the protein

class CenterTransform(resolution='residue')[source]

Center the coordinates of a protein at atom and residue level. We use the Ca to compute the center for all the atoms.

class RandomRotateTransform(resolution='residue', seed=42)[source]

Apply a random rotation to the coordinate arrays of a protein