[3eb847]: / doc / source / api / data.rst

Download this file

191 lines (134 with data), 3.6 kB

torchdrug.data

Data Structures

Graph

Molecule

Protein

PackedGraph

PackedMolecule

PackedProtein

Dictionary

Datasets

KnowledgeGraphDataset

MoleculeDataset

ProteinDataset

ProteinPairDataset

ProteinLigandDataset

NodeClassificationDataset

ReactionDataset

SemiSupervised

Data Processing

DataLoader

Dataset Split Methods

Feature Functions

Atom Features

Bond Features

Residue Features

Molecule Features

Element Constants

Element constants are provided for convenient manipulation of atom types. The atomic numbers can be accessed by uppercased element names at the root of the package. For example, we can get the carbon scaffold of a molecule with the following code.

import torchdrug as td
from torchdrug import data

smiles = "CC1=C(C=C(C=C1[N+](=O)[O-])[N+](=O)[O-])[N+](=O)[O-]"
mol = data.Molecule.from_smiles(smiles)
scaffold = mol.subgraph(mol.atom_type == td.CARBON)
mol.visualize()
scaffold.visualize()
../../../asset/graph/tnt.png ../../../asset/graph/tnt_carbon_scaffold.png

There are also 2 constant arrays that map atomic numbers to element names. td.ATOM_NAME[i] returns the full name, while td.ATOM_SYMBOL[i] returns the abbreviated chemical symbol for atomic number i.

For a full list of elements, please refer to the perodic table.