diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index 161b8dba6577142e93b5c0485c170a4c89c25e99..dc2484e4ce75c6fa28ffeaf0cde66c1bf107fece 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -351,6 +351,59 @@ class Compound(models.Model): pdb_ids.add(ca.pdb_id) return pdb_ids + @property + def hba_hbd(self): + return self.nb_acceptor_h + self.nb_donor_h + + @property + def lipinsky_mw(self): + return self.molecular_weight <= 500 + + @property + def lipinsky_hba(self): + return self.nb_acceptor_h <= 10 + + @property + def lipinsky_hbd(self): + return self.nb_donor_h <= 5 + + @property + def lipinsky_a_log_p(self): + return self.a_log_p <= 5 + + @property + def lipinsky_global(self): + return int(self.lipinsky_mw) + int(self.lipinsky_hba) + \ + int(self.lipinsky_hbd) + int(self.lipinsky_a_log_p) >= 3 + + @property + def veber_hba_hbd(self): + return self.nb_acceptor_h + self.nb_donor_h <= 12 + + @property + def veber_tpsa(self): + return self.tpsa <= 140 + + @property + def veber_rb(self): + return self.nb_rotatable_bonds <= 10 + + @property + def veber_global(self): + return self.veber_rb and (self.veber_hba_hbd or self.veber_tpsa) + + @property + def pfizer_a_log_p(self): + return self.a_log_p <= 3 + + @property + def pfizer_tpsa(self): + return self.tpsa >= 75 + + @property + def pfizer_global(self): + return self.pfizer_a_log_p and self.pfizer_tpsa + class MDDRActivityClass(models.Model): name = models.CharField('Activity Class', max_length=100, unique=True) diff --git a/ippisite/ippidb/templates/compound_card.html b/ippisite/ippidb/templates/compound_card.html index 6b0927267ded840994071464337e93c3343e353c..d95c9f8d6ffdb71e7c948e85ec947bb2ba70493c 100644 --- a/ippisite/ippidb/templates/compound_card.html +++ b/ippisite/ippidb/templates/compound_card.html @@ -26,18 +26,6 @@ <div class="card"> <div class="card-body"> {% include "pubchem_img.html" %} -<!-- - <div id="{{ compound.id }}_smilesdisplay" - data-widget="Kekule.ChemWidget.Viewer2D" data-auto-size="true" data-padding="20" - data-toolbar-evoke-modes="[0]"> - </div> - <textarea rows="10" cols="50" id="{{ compound.id }}_smilesvalue" style="display:none;">{{ compound.canonical_smile }}</textarea> - <script> - $(window).on('load', function(){ - kekule_display('{{ compound.id }}_smilesvalue','{{ compound.id }}_smilesdisplay') - }); - </script> ---> <ul class="list-group"> <li class="list-group-item">Common name: {{ compound.common_name }}</li> <li class="list-group-item">Canonical SMILES: {{ compound.canonical_smile }}</li> @@ -90,6 +78,68 @@ </div> </div> <div class="tab-pane fade" id="v-pills-pharmacology" role="tabpanel" aria-labelledby="v-pills-pharmacology-tab"> + <div class="row"> + <table class="table table-sm col-sm-12"> + <thead> + <tr> + <th class="col-sm-3" scope="col">Descriptor</th> + <th class="col-sm-3" scope="col">Lipinski's RO5</th> + <th class="col-sm-3" scope="col">Veber</th> + <th class="col-sm-3" scope="col">Pfizer's 3/75</th> + </tr> + </thead> + <tbody> + <tr> + <th scope="row">Global</th> + <td class="{% if compound.lipinsky_global %}bg-success{% else %}bg-danger{% endif %}"></td> + <td class="{% if compound.veber_global %}bg-success{% else %}bg-danger{% endif %}"></td> + <td class="{% if compound.pfizer_global %}bg-success{% else %}bg-danger{% endif %}"></td> + </tr> + <tr> + <th scope="row">MW</th> + <td class="{% if compound.lipinsky_mw %}bg-success{% else %}bg-danger{% endif %}" title="Molecular weight <= 500g/mol">{{ compound.molecular_weight }}g/mol</td> + <td class="bg-light"></td> + <td class="bg-light"></td> + </tr> + <tr> + <th scope="row">HBA</th> + <td class="{% if compound.lipinsky_hba %}bg-success{% else %}bg-danger{% endif %}" title="HBA <= 10">{{ compound.nb_acceptor_h }}</td> + <td class="bg-light"></td> + <td class="bg-light"></td> + </tr> + <tr> + <th scope="row">HBD</th> + <td class="{% if compound.lipinsky_hbd %}bg-success{% else %}bg-danger{% endif %}" title="HBD <= 5">{{ compound.nb_donor_h }}</td> + <td class="bg-light"></td> + <td class="bg-light"></td> + </tr> + <tr> + <th scope="row">HBA + HBD</th> + <td class="bg-light"></td> + <td class="{% if compound.veber_hba_hbd %}bg-success{% else %}bg-danger{% endif %}" title="HBD + HBA <= 12">{{ compound.hba_hbd }}</td> + <td class="bg-light"></td> + </tr> + <tr> + <th scope="row">AlogP</th> + <td class="{% if compound.lipinsky_a_log_p %}bg-success{% else %}bg-danger{% endif %}" title="AlogP <= 5">{{ compound.a_log_p }}</td> + <td class="bg-light"></td> + <td class="{% if compound.pfizer_a_log_p %}bg-success{% else %}bg-danger{% endif %}" title="AlogP <= 3">{{ compound.a_log_p }}</td> + </tr> + <tr> + <th scope="row">TPSA</th> + <td class="bg-light"></td> + <td class="{% if compound.veber_tpsa %}bg-success{% else %}bg-danger{% endif %}" title="TPSA <= 140">{{ compound.tpsa }}</td> + <td class="{% if compound.pfizer_tpsa %}bg-success{% else %}bg-danger{% endif %}" title="TPSA <= 75">{{ compound.tpsa }}</td> + </tr> + <tr> + <th scope="row">RB</th> + <td class="bg-light"></td> + <td class="{% if compound.veber_rb %}bg-success{% else %}bg-danger{% endif %}" title="RB <= 10">{{ compound.nb_rotatable_bonds }}</td> + <td class="bg-light"></td> + </tr> + </tbody> + </table> + </div> </div> <div class="tab-pane fade" id="v-pills-pharmacokinetics" role="tabpanel" aria-labelledby="v-pills-pharmacokinetics-tab"> </div>