Commit cc8df260 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

create compound card and link from compounds list


Former-commit-id: 72dcf4945784827da80322fd6d06ec854cc7f430
parent c5ce0a1d
<div class="row m-2 border border-info bg-light">
<div class="col-sm-3 border-info d-flex justify-content-center align-content-center">
<img src="https://pubchem.ncbi.nlm.nih.gov/image/imagefly.cgi?cid={{ compound.pubchem_id }}&width=300&height=300" style="width:300px;height:300px;"/>
<a href="/compound/{{ compound.id }}">{% include "pubchem_img.html" %}</a>
</div>
<div class="col-sm-9">
<ul class="list-group">
......@@ -20,19 +20,6 @@
<li class="list-group-item">Mentionned in {% include "biblio_citation.html" with bibliography=biblio_ref.bibliography%} as <i>{{ biblio_ref.compound_name }}</i></li>
{% endfor %}
</ul>
{%if compound.pubchem_id or compound.chembl_id or compound.chemspider_id %}
<p>in other databases</p>
<ul class="list-group">
{% if compound.pubchem_id %}
<li class="list-group-item">PubChem: <a href="https://pubchem.ncbi.nlm.nih.gov/compound/{{ compound.pubchem_id }}" target="_blank">{{ compound.pubchem_id }}</a></li>
{% endif %}
{% if compound.chembl_id %}
<li class="list-group-item">ChEMBL: <a href="https://www.ebi.ac.uk/chembldb/compound/inspect/{{ compound.chembl_id}}" target="_blank">{{ compound.chembl_id}}</a></li>
{% endif %}
{% if compound.chemspider_id %}
<li class="list-group-item">ChemSpider: <a href="http://www.chemspider.com/Chemical-Structure.{{ compound.chemspider_id}}.html" target="_blank">{{ compound.chemspider_id}}</a></li>
{% endif %}
</ul>
{% endif %}
{% include "compound_db_links.html" %}
</div>
</div>
{% extends "base.html" %}
{% block title %}compound detail{% endblock %}
{% 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="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-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>
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-pills-tabContent">
<div class="tab-pane fade show active" id="v-pills-compound" role="tabpanel" aria-labelledby="v-pills-compound-tab">
<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>
<li class="list-group-item">IUPAC name: {{ compound.iupac_name }}</li>
<li class="list-group-item">Aromatic ratio: {{ compound.aromatic_ratio }}</li>
<li class="list-group-item">Balaban index: {{ compound.balaban_index }}</li>
<li class="list-group-item">Fsp3: {{ compound.fsp3 }}</li>
<li class="list-group-item">GC molar refractivity: {{ compound.gc_molar_refractivity }}</li>
<li class="list-group-item" title="Partition coefficient octanol-1/water, with pKa information">LogD: {{ compound.log_d }}</li>
<li class="list-group-item" title="Partition coefficient octanol-1/water">ALogP: {{ compound.a_log_p }}</li>
<li class="list-group-item" title="computed with VdW radii">Mean atom volume: {{ compound.mean_atom_vol_vdw }}</li>
<li class="list-group-item">Molecular weight: {{ compound.molecular_weight }}</li>
<li class="list-group-item">Number of hydrogen bond acceptors: {{ compound.nb_acceptor_h }}</li>
<li class="list-group-item">Number of aliphatics amines: {{ compound.nb_aliphatic_amines }}</li>
<li class="list-group-item">Number of aromatic bonds: {{ compound.nb_aromatic_bonds }}</li>
<li class="list-group-item">Number of aromatic ethers: {{ compound.nb_aromatic_ether }}</li>
<li class="list-group-item" title="Smallest Set of System Rings">Number of aromatic SSSRs: {{ compound.nb_aromatic_sssr }}</li>
<li class="list-group-item">Number of atoms: {{ compound.nb_atom }}</li>
<li class="list-group-item">Number of non hydrogen atoms: {{ compound.nb_atom_non_h }}</li>
<li class="list-group-item">Number of benzene-like rings: {{ compound.nb_benzene_like_rings }}</li>
<li class="list-group-item">Number of bonds: {{ compound.nb_bonds }}</li>
<li class="list-group-item">Number of bonds not involving a hydrogen: {{ compound.nb_bonds_non_h }}</li>
<li class="list-group-item">Number of Bromine atoms: {{ compound.nb_br }}</li>
<li class="list-group-item">Number of Carbon atoms: {{ compound.nb_c }}</li>
<li class="list-group-item">Number of chiral centers: {{ compound.nb_chiral_centers }}</li>
<li class="list-group-item">Number of circuits: {{ compound.nb_circuits }}</li>
<li class="list-group-item">Number of Chlorine atoms: {{ compound.nb_cl }}</li>
<li class="list-group-item">Number of sp2-hybridized carbon atoms: {{ compound.nb_csp2 }}</li>
<li class="list-group-item">Number of sp3-hybridized carbon atoms: {{ compound.nb_csp3 }}</li>
<li class="list-group-item">Number of hydrogen bond donors: {{ compound.nb_donor_h }}</li>
<li class="list-group-item">Number of double bonds: {{ compound.nb_double_bonds }}</li>
<li class="list-group-item">Number of Fluorine atoms: {{ compound.nb_f }}</li>
<li class="list-group-item">Number of Iodine atoms: {{ compound.nb_i }}</li>
<li class="list-group-item">Number of multiple bonds: {{ compound.nb_multiple_bonds }}</li>
<li class="list-group-item">Number of Nitrogen atoms: {{ compound.nb_n }}</li>
<li class="list-group-item">Number of Oxygen atoms: {{ compound.nb_o }}</li>
<li class="list-group-item">Number of rings: {{ compound.nb_rings }}</li>
<li class="list-group-item">Number of rotatable bonds: {{ compound.nb_rotatable_bonds }}</li>
<li class="list-group-item">Randic index: {{ compound.randic_index }}</li>
<li class="list-group-item" title="radial distribution function weighted by the atomic masses at 7Å">RDF070m: {{ compound.rdf070m }}</li>
<li class="list-group-item">Fraction of rotatable bonds: {{ compound.rotatable_bond_fraction }}</li>
<li class="list-group-item">Sum of atomic polarizabilities: {{ compound.sum_atom_polar }}</li>
<li class="list-group-item">Sum of atom volumes computed with VdW radii: {{ compound.sum_atom_vol_vdw }}</li>
<li class="list-group-item" title="Topological Polar Surface Area">TPSA: {{ compound.tpsa }}</li>
<li class="list-group-item">Unsaturation index: {{ compound.ui }}</li>
<li class="list-group-item">Wiener index: {{ compound.wiener_index }}</li>
</ul>
{% include "compound_db_links.html" %}
</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>
</div>
</div>
</div>
</main><!-- .site-main -->
</div>
</div><!-- div main -->
</div>
</div>
{% endblock %}
{%if compound.pubchem_id or compound.chembl_id or compound.chemspider_id %}
<p>in other databases</p>
<ul class="list-group">
{% if compound.pubchem_id %}
<li class="list-group-item">PubChem: <a href="https://pubchem.ncbi.nlm.nih.gov/compound/{{ compound.pubchem_id }}" target="_blank">{{ compound.pubchem_id }}</a></li>
{% endif %}
{% if compound.chembl_id %}
<li class="list-group-item">ChEMBL: <a href="https://www.ebi.ac.uk/chembldb/compound/inspect/{{ compound.chembl_id}}" target="_blank">{{ compound.chembl_id}}</a></li>
{% endif %}
{% if compound.chemspider_id %}
<li class="list-group-item">ChemSpider: <a href="http://www.chemspider.com/Chemical-Structure.{{ compound.chemspider_id}}.html" target="_blank">{{ compound.chemspider_id}}</a></li>
{% endif %}
</ul>
{% endif %}
......@@ -73,6 +73,25 @@
</div>
{% endfor %}
</fieldset>
<fieldset class="form-group row border border-info m-2">
<div class="bg-info col-12"><legend>Organism</legend></div>
{% for taxonomy in selected_taxonomies %}
<div class="form-check col-12">
<label class="form-check-label">
<input class="form-check-input text-right" type="checkbox" checked value="{{ taxonomy.id }}" onchange="this.form.submit()" name="taxonomy" style="width: auto; margin-right: 1em;">
{{ taxonomy.name }}
</label>
</div>
{% endfor %}
{% for taxonomy in taxonomies|slice:":5" %}
<div class="form-check col-12">
<label class="form-check-label">
<input class="form-check-input text-right" type="checkbox" value="{{ taxonomy.id }}" onchange="this.form.submit()" name="taxonomy" style="width: auto; margin-right: 1em;">
{{ taxonomy.name }}
</label>
</div>
{% endfor %}
</fieldset>
</form>
</div>
<main class="col-12 col-md-9 col-xl-10 pl-md-5 bd-content" role="main">
......
<img src="https://pubchem.ncbi.nlm.nih.gov/image/imagefly.cgi?cid={{ compound.pubchem_id }}&width=300&height=300" style="width:300px;height:300px;"/>
......@@ -22,6 +22,7 @@ urlpatterns = [
url(r'^biblio/(?P<source>\w{2})(?P<id_source>\w+)$', views.biblio_card, name='biblio_card'),
url(r'^biblio/$', views.biblio_list, name='biblio_list'),
url(r'^compound/$', views.compound_list, name='compound_list'),
url(r'^compound/(?P<compound_id>\w+)$', views.compound_card, name='compound_card'),
url(r'^tutorials$', views.tutorials, name='tutorials'),
url(r'^admin-session$', views.adminSession, name='admin-session'),
url(r'^admin-session/add/(?P<step>.+)/$',
......
......@@ -5,7 +5,7 @@ from django.http import HttpResponseRedirect, Http404
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from formtools.wizard.views import SessionWizardView, NamedUrlSessionWizardView
from .forms import IdForm, BibliographyForm, PDBForm, ProteinForm, ProteinDomainComplexTypeForm, ProteinDomainComplexForm, PpiForm, PpiComplexForm, ProteinFormSet,ActivityForm, CompoundForm, CompoundFormSet
from .models import Protein, Bibliography, ProteinDomainComplex, RefCompoundBiblio, TestActivityDescription, Compound, Ppi, Disease
from .models import Protein, Bibliography, ProteinDomainComplex, RefCompoundBiblio, TestActivityDescription, Compound, Ppi, Disease, Taxonomy
from .ws import get_pdb_uniprot_mapping
......@@ -199,6 +199,8 @@ def compound_list(request):
ppis = Ppi.objects.exclude(id__in=request.GET.getlist('ppi'))
selected_diseases = Disease.objects.filter(id__in=request.GET.getlist('disease'))
diseases = Disease.objects.exclude(id__in=request.GET.getlist('disease'))
selected_taxonomies = Taxonomy.objects.filter(id__in=request.GET.getlist('taxonomy'))
taxonomies = Taxonomy.objects.exclude(id__in=request.GET.getlist('taxonomy'))
# handle pagination in compounds list
paginator = Paginator(compounds, 5)
page = request.GET.get('page')
......@@ -214,4 +216,13 @@ def compound_list(request):
'selected_ppis': selected_ppis,
'ppis': ppis,
'selected_diseases': selected_diseases,
'diseases': diseases})
'diseases': diseases,
'selected_taxonomies': selected_taxonomies,
'taxonomies': taxonomies})
def compound_card(request, compound_id):
try:
compound = Compound.objects.get(id=int(compound_id))
except Compound.DoesNotExist:
raise Http404("No compound data for %s:%s" % (compound_id))
return render(request, 'compound_card.html', {'compound': compound})
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