Skip to content

Commit

Permalink
Update calculate_tanimoto_scores.py
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-huber authored Aug 20, 2023
1 parent ec60c3a commit d7eb202
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ms2query/create_new_library/calculate_tanimoto_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@


def get_fingerprint(smiles: str):
fingerprint = np.array(Chem.RDKFingerprint(Chem.MolFromSmiles(smiles), fpSize=2048))
try:
fingerprint = np.array(Chem.RDKFingerprint(Chem.MolFromSmiles(smiles), fpSize=2048))
except:
# TODO: this is to avoid workflows breaking because of an incorrect smiles. Should be handled better.
fingerprint = np.zeros(2048)
assert isinstance(fingerprint, np.ndarray), \
f"Fingerprint for 1 spectrum could not be set smiles is {smiles}"
return fingerprint
Expand Down

0 comments on commit d7eb202

Please sign in to comment.