Skip to content
Snippets Groups Projects
Commit 2b89ddbf authored by Rachel TORCHET's avatar Rachel TORCHET
Browse files

Merge branch 'master' of https://gitlab.pasteur.fr/hub/iPPIDB

Former-commit-id: 3314235576b8b3cfa09dbc512c54e0bc6b65e8c1
parents 75776fb6 a663f6d5
No related branches found
Tags v1.0
No related merge requests found
import glob
from django.utils import timezone
from django.core.management import BaseCommand, CommandError
from ippidb.models import Compound
class Command(BaseCommand):
help = "Generate the data for the compound LE vs LLE biplot"
def handle(self, *args, **options):
self.stdout.write(self.style.SUCCESS('Generating the LE vs. LLE biplot...'))
df = Compound.objects.all().to_dataframe()
df['le']=df[
print(df.to_csv())
print(df.columns)
from __future__ import unicode_literals
from django.db import models
from django_pandas.managers import DataFrameManager
from .ws import get_pubmed_info, get_epo_info, get_uniprot_info, get_taxonomy_info, get_go_info, get_pfam_info
......@@ -321,6 +322,8 @@ class Compound(models.Model):
mddr_compound = models.ForeignKey(
'MDDRCompoundImport', models.CASCADE, blank=True, null=True)
objects = DataFrameManager()
@property
def biblio_refs(self):
"""
......@@ -351,6 +354,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)
......
Source diff could not be displayed: it is too large. Options to address this: view the blob.
......@@ -10,9 +10,10 @@
<link rel="stylesheet" href="/static/css/ippidb-typeahead.css">
<script src="/static/jquery/jquery-3.3.1.min.js"></script>
<script src="/static/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/static/typeahead/typeahead.bundle.min.js"></script>
<script defer src="/static/font-awesome/js/fontawesome-all.min.js"></script>
<script src="/static/chartjs/Chart.bundle.js"></script>
<script src="/static/js/ippidb.js" type="text/javascript"></script>
......@@ -63,6 +64,35 @@
});
$('#'+idSearch).on('typeahead:select', onSelect);
};
var drawCompoundDescriptorRadarChart = function(canvasId, mw, alogP, hbd, hba, tpsa, rb, ar, fsp3, rs){
var radarChartData = {
"labels":["MW","ALogP","HBD","HBA","TPSA","RB","Ar","Fsp3","R/S"],
"datasets":[
{"label":"Descriptor's threshold",
"data":[500/1200,(5+3)/15,5/15,10/15,140/250,10/20,4/10,1-(0.4/1),1-(1/10)],
"fill":true,
"backgroundColor":"rgba(54, 162, 235, 0.2)",
"borderColor":"rgb(54, 162, 235)",
"pointBackgroundColor":"rgb(54, 162, 235)",
"pointBorderColor":"#fff",
"pointHoverBackgroundColor":"#fff",
"pointHoverBorderColor":"rgb(54, 162, 235)"},
{"label":"Descriptor's value for the compound",
"data":[mw/1200,(alogP+3)/15,hbd/15,hba/15,tpsa/250,rb/20,ar/10,1-(fsp3/1),1-(rs/10)],
"fill":true,
"backgroundColor":"rgba(255, 99, 132, 0.2)",
"borderColor":"rgb(255, 99, 132)",
"pointBackgroundColor":"rgb(255, 99, 132)",
"pointBorderColor":"#fff",
"pointHoverBackgroundColor":"#fff",
"pointHoverBorderColor":"rgb(255, 99, 132)"}],
"options":{"elements":{"line":{"tension":0,"borderWidth":3}}}
};
var myRadar = new Chart(document.getElementById(canvasId).getContext("2d"),
{type: 'radar',
data: radarChartData,
options: { scaleLineWidth : 1, pointLabelFontFamily : "'Helvetica Neue'", pointLabelFontSize : 12, scaleOverride : true, scaleSteps : 5, scaleStepWidth : 0.2}});
};
</script>
</head>
......
......@@ -5,19 +5,15 @@
{% block content %}
{% include "kekule_display.html" %}
<div id="mainnav">
</div>
<div class="inner-wrap">
<div id="main-wrapper" class="page">
<div id="main">
<div id="content" class="main-content">
<main role="main">
<div class="row">
<div class="container-fluid">
<div class="row flex-xl-nowrap">
<div class="col-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist">
<a class="nav-link active" id="v-pills-compound-tab" data-toggle="pill" href="#v-pills-compound" role="tab" aria-controls="v-pills-compound" aria-expanded="true">Compound</a>
<a class="nav-link" id="v-pills-physicochemistry-tab" data-toggle="pill" href="#v-pills-physicochemistry" role="tab" aria-controls="v-pills-physicochemistry" aria-expanded="true">Physicochemistry</a>
<a class="nav-link" id="v-pills-pharmacology-tab" data-toggle="pill" href="#v-pills-pharmacology" role="tab" aria-controls="v-pills-pharmacology" aria-expanded="true">Pharmocology</a>
<a class="nav-link" id="v-pills-pharmacokinetics-tab" data-toggle="pill" href="#v-pills-pharmacokinetics" role="tab" aria-controls="v-pills-pharmacokinetics" aria-expanded="true">Pharmacokinetics</a>
<a class="nav-link" id="v-pills-drugsimilarity-tab" data-toggle="pill" href="#v-pills-drugsimilarity" role="tab" aria-controls="v-pills-drugsimilarity" aria-expanded="true">Drug similarity</a>
</div>
</div>
<div class="col-9">
......@@ -26,18 +22,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>
......@@ -89,16 +73,92 @@
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-physicochemistry" role="tabpanel" aria-labelledby="v-pills-physicochemistry-tab">
<div class="row">
<div class="card col-sm-12 col-md-6">
<h5 class="card-header">Physicochemical filters</h5>
<div class="card-body">
<table class="table table-sm col-sm-12 col-md-6">
<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="card col-sm-12 col-md-6">
<h5 class="card-header">Radar chart</h5>
<div class="card-body">
<canvas id="radar"></canvas>
<script>
drawCompoundDescriptorRadarChart('radar', {{ compound.molecular_weight }}, {{ compound.a_log_p }}, {{ compound.nb_donor_h }}, {{ compound.nb_acceptor_h }}, {{ compound.tpsa }}, {{ compound.nb_rotatable_bonds }}, {{ compound.nb_benzene_like_rings }}, {{ compound.fsp3 }}, {{ compound.nb_chiral_centers }});
</script>
</div>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-pharmacology" role="tabpanel" aria-labelledby="v-pills-pharmacology-tab">
</div>
<div class="tab-pane fade" id="v-pills-pharmacokinetics" role="tabpanel" aria-labelledby="v-pills-pharmacokinetics-tab">
<div class="tab-pane fade" id="v-pills-drugsimilarity" role="tabpanel" aria-labelledby="v-pills-drugsimilarity-tab">
</div>
</div>
</div>
</div>
</main><!-- .site-main -->
</div>
</div><!-- div main -->
</div>
</div>
{% endblock %}
Django==1.11
django-bootstrap3
django-pandas
bioservices
#typing
django-extensions>=2.0.5
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment