Skip to content

Commit 3ff17b7

Browse files
authored
Merge pull request #14 from Jnelen/master
Readded support for the signature fingerprint
2 parents e1b7f6c + 488940f commit 3ff17b7

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

Example/test_fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import numpy as np
99
from PyFingerprint.fingerprint import get_fingerprint, get_fingerprints
1010

11-
cdktypes = ['standard', 'extended', 'graph', 'maccs', 'pubchem', 'estate', 'hybridization', 'lingo', 'klekota-roth', 'shortestpath', 'cdk-substructure', 'circular', 'atompairs']
11+
cdktypes = ['standard', 'extended', 'graph', 'maccs', 'pubchem', 'estate', 'hybridization', 'lingo', 'klekota-roth', 'shortestpath', 'cdk-substructure', 'circular', 'atompairs', 'signature']
1212
rdktypes = ['rdkit', 'morgan', 'rdk-maccs', 'topological-torsion', 'avalon', 'atom-pair', 'rdk-descriptor']
1313
babeltypes = ['fp2', 'fp3', 'fp4', 'spectrophore']
1414
vectypes = ['mol2vec', 'heteroencoder']

PyFingerprint/cdk.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -91,22 +91,10 @@ def cdk_fingerprint(smi, fp_type="standard", size=1024, depth=None):
9191
elif fp_type == 'pubchem':
9292
nbit = 881
9393
elif fp_type == 'klekota-roth':
94-
nbit = 4860
95-
elif fp_type == 'signature':
96-
nbit = None
97-
print("Signature_FP")
98-
fingerprinter = cdk.fingerprint.SignatureFingerprinter()
99-
mol = cdk_parser_smiles(smi)
100-
print(fingerprinter.getSize())
101-
print(fingerprinter.getBitFingerprint(mol).getSetbits())
102-
print(fingerprinter.getBitFingerprint(mol).size())
103-
print(fingerprinter.getRawFingerprint(mol))
104-
94+
nbit = 4860
10595
else:
10696
nbit = size
10797

108-
109-
11098
# Pull from cache if it exists
11199
if (fp_type, size, depth) in fp_map:
112100
fingerprinter = fp_map[(fp_type, size, depth)]
@@ -116,4 +104,6 @@ def cdk_fingerprint(smi, fp_type="standard", size=1024, depth=None):
116104

117105
fp_obj = fingerprinter.getBitFingerprint(mol)
118106
bits = list(fp_obj.getSetbits())
107+
if fp_type == "signature":
108+
bits = list(set((bit%nbit) for bit in bits))
119109
return bits, nbit

PyFingerprint/fingerprint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
hc_enable = False
2323

2424

25-
cdktypes = ['standard', 'extended', 'graph', 'maccs', 'pubchem', 'estate', 'hybridization', 'lingo', 'klekota-roth', 'shortestpath', 'cdk-substructure', 'circular', 'cdk-atompairs']
25+
cdktypes = ['standard', 'extended', 'graph', 'maccs', 'pubchem', 'estate', 'hybridization', 'lingo', 'klekota-roth', 'shortestpath', 'cdk-substructure', 'circular', 'cdk-atompairs', 'signature']
2626
rdktypes = ['rdkit', 'morgan', 'rdk-maccs', 'topological-torsion', 'avalon', 'atom-pair', 'rdk-descriptor']
2727
babeltypes = ['fp2', 'fp3', 'fp4', 'spectrophore']
2828
vectypes = ['mol2vec', 'heteroencoder']

0 commit comments

Comments
 (0)