Commit 001962ad authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

set a configuration for fingerprints used for drugbank similarity

see #96


Former-commit-id: f15dcfbe2583970f422c7b3c8f3536ea911a37ab
parent a0a78b94
......@@ -3,6 +3,7 @@ import operator
from django.db import models
from django.db.models import Max
from django.conf import settings
from .utils import FingerPrinter, smi2inchi, smi2inchikey
from .ws import get_pubmed_info, get_google_patent_info, get_uniprot_info, get_taxonomy_info, get_go_info, get_pfam_info
......@@ -344,7 +345,8 @@ class Compound(AutoFillableModel):
def compute_drugbank_compound_similarity(self):
""" compute Tanimoto similarity to existing DrugBank compounds """
self.save()
fingerprinter = FingerPrinter("FP4")
# fingerprints to compute drugbank similarities are in settings module, default FP2
fingerprinter = FingerPrinter(settings.get("DRUGBANK_FINGERPRINTS", "FP2"))
#1. compute tanimoto for SMILES query vs all compounds
smiles_dict = {c.id:c.canonical_smiles for c in DrugBankCompound.objects.all()}
tanimoto_dict = fingerprinter.tanimoto_smiles(self.canonical_smile, smiles_dict)
......
......@@ -161,3 +161,7 @@ SITE_ID = 1
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'
# fingerprints used to compute Drugbank similarity using openbabel
# default value is FP2
DRUGBANK_FINGERPRINTS = "FP2"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment