torchdrug.transforms#
- class Compose(transforms)[source]#
Compose a list of transforms into one.
- Parameters
transforms (list of callable) – list of transforms
Graph Transformations#
NormalizeTarget#
RandomBFSOrder#
Shuffle#
VirtualNode#
- class VirtualNode(relation=None, weight=1, node_feature=None, edge_feature=None, **kwargs)[source]#
Add a virtual node and connect it with every node in the graph.
- Parameters
relation (int, optional) – relation of virtual edges. By default, use the maximal relation in the graph plus 1.
weight (int, optional) – weight of virtual edges
node_feature (array_like, optional) – feature of the virtual node
edge_feature (array_like, optional) – feature of virtual edges
kwargs – other attributes of the virtual node or virtual edges
Molecule Transformations#
RemapAtomType#
VirtualAtom#
- class VirtualAtom(atom_type=None, bond_type=None, node_feature=None, edge_feature=None, **kwargs)[source]#
Add a virtual atom and connect it with every atom in the molecule.
- Parameters
atom_type (int, optional) – type of the virtual atom
bond_type (int, optional) – type of the virtual bonds
node_feature (array_like, optional) – feature of the virtual atom
edge_feature (array_like, optional) – feature of virtual bonds
kwargs – other attributes of the virtual atoms or virtual bonds
Protein Transformations#
TruncateProtein#
- class TruncateProtein(max_length=None, random=False, keys='graph')[source]#
Truncate over long protein sequences into a fixed length.
- Parameters
max_length (int, optional) – maximal length of the sequence. Truncate the sequence if it exceeds this limit.
random (bool, optional) – truncate the sequence at a random position. If not, truncate the suffix of the sequence.
keys (str or list of str, optional) – keys for the items that require truncation in a sample