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

new designs for compound query page, WIP

see #43


Former-commit-id: 6863d32646dcfe64d3ad51c428dd28c6358665c4
parent 4c06bb1f
......@@ -328,6 +328,19 @@ class Compound(models.Model):
"""
return RefCompoundBiblio.objects.filter(compound=self)
@property
def pfam_ids(self):
"""
return all PFAM ids for the domain of the proteins of the bound
complexes in the PPIs this compound has an action on
"""
pfam_ids = set()
for ca in self.compoundaction_set.all():
ca.get_complexes()
for bound_complex in ca.ppi.get_ppi_bound_complexes():
pfam_ids.add(bound_complex.complex.domain.pfam_id)
return pfam_ids
class MDDRActivityClass(models.Model):
name = models.CharField('Activity Class', max_length=100, unique=True)
......
{%if compound.pubchem_id or compound.chembl_id or compound.chemspider_id %}
<p>in other databases</p>
<ul class="list-group">
<div class="row">
{% 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>
<span class="col-sm-4"><a href="https://pubchem.ncbi.nlm.nih.gov/compound/{{ compound.pubchem_id }}" target="_blank"><img src="/static/images/Other/Pubchemlogo.png" style="height: 1.5em;" title="PubChem ID: {{ compound.pubchem_id }}" /></a></span>
{% 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>
<span class="col-sm-4"><a href="https://www.ebi.ac.uk/chembldb/compound/inspect/{{ compound.chembl_id }}" target="_blank"><img src="/static/images/Other/Chembl_logo.png" style="height: 1.5em;" title="ChEMBL ID: {{ compound.pubchem_id }}" /></a></span>
{% 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>
<span class="col-sm-4"><a href="http://www.chemspider.com/Chemical-Structure.{{ compound.chemspider_id}}.html" target="_blank"><img src="/static/images/Other/ChemSpider_Logo.png" style="height: 1.5em;" title="ChemSpider ID: {{ compound.chemspider_id }}" /></a></span>
{% endif %}
</ul>
</div>
{% endif %}
<div class="card m-2 border border-info" style="width: 300px">
<a href="/compound/{{ compound.id }}">{% include "pubchem_img.html" %}</a>
<div class="card-body" style="overflow:hidden; word-wrap:break-word;">
{% if compound.common_name %}
<p class="card-text">Common name: {{ compound.common_name }}</p>
{% endif %}
{% if compound.canonical_smile %}
<p class="card-text">Canonical SMILES: {{ compound.canonical_smile }}</p>
{% endif %}
{% if compound.iupac_name %}
<p class="card-text">IUPAC name: {{ compound.iupac_name }}</p>
{% endif %}
<span class="badge badge-dark"><a href="/compound/{{ compound.id }}">{{ compound.id }}</a></span>
<p>{% for pfam_id in compound.pfam_ids %}{{ pfam_id }}{% endfor %}</p>
<p>Molecular Weight: {{ compound.molecular_weight }} g/mol</p>
</div>
</div>
<!--
......
......@@ -3,10 +3,8 @@
<a href="/compound/{{ compound.id }}">{% include "pubchem_img.html" %}</a>
</div>
<div class="col-sm-9">
<span class="badge badge-dark"><a href="/compound/{{ compound.id }}">{{ compound.id }}</a></span>{%if compound.common_name %}<span>Common name: {{ compound.common_name }}</span>{% endif %}
<ul class="list-group">
{% if compound.common_name %}
<li class="list-group-item">Common name: {{ compound.common_name }}</li>
{% endif %}
{% if compound.canonical_smile %}
<li class="list-group-item">Canonical SMILES: {{ compound.canonical_smile }}</li>
{% endif %}
......@@ -14,12 +12,12 @@
<li class="list-group-item">IUPAC name: {{ compound.iupac_name }}</li>
{% endif %}
</ul>
<p>in bibliography</p>
<p>External links</p>
{% include "compound_db_links.html" %}
<ul class="list-group">
{% for biblio_ref in compound.biblio_refs %}
<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>
{% include "compound_db_links.html" %}
</div>
</div>
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