Skip to content

Fingerprint

gtrick.ogb2fp(name, root='dataset', fp_type=['morgan', 'maccs'])

Generate fingerprint features for OGB datasets.

Molecular fingerprints are a way to represent molecules as mathematical objects.

Note

To use this trick, you should install rdkit at first:

pip install rdkit

Example

Fingerprint (DGL), Fingerprint (PyG)

Parameters:

Name Type Description Default
name str

Name of the dataset.

required
root str

Root directory to store the dataset folder.

'dataset'
fp_type list of str

The types of generated fingerprint. Can be the following values:

  • morgan: Morgan fingerprint.
  • maccs: MACCS keys.
  • rdkit: RDKit topological fingerprint.
['morgan', 'maccs']

Returns:

Type Description
torch.Tensor

The generated fingerprint features.

torch.Tensor

The ground truth label.

gtrick.smiles2fp(smiles, fp_type)

Convert smile strings to fingerprint.

Molecular fingerprints are a way to represent molecules as mathematical objects.

Note

To use this trick, you should install rdkit at first:

pip install rdkit

Parameters:

Name Type Description Default
smiles list of str

The smile strings to convert.

required
fp_type list of str

The types of generated fingerprint. Can be the following values:

  • morgan: Morgan fingerprint.
  • maccs: MACCS keys.
  • rdkit: RDKit topological fingerprint.
required

Returns:

Type Description
np.array

The generated fingerprint features.