diff --git a/ippisite/ippidb/models.py b/ippisite/ippidb/models.py index 72b96de6bb2620d53c0095533cd657415d47bc3d..eecaaf86f9058a92c235e1109ad7e56351947ce4 100644 --- a/ippisite/ippidb/models.py +++ b/ippisite/ippidb/models.py @@ -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) diff --git a/ippisite/ippidb/static/images/Other/ChemSpider_Logo.png b/ippisite/ippidb/static/images/Other/ChemSpider_Logo.png new file mode 100644 index 0000000000000000000000000000000000000000..272b8ef32e30e69e5e7c305d2ed675fbba211c0c Binary files /dev/null and b/ippisite/ippidb/static/images/Other/ChemSpider_Logo.png differ diff --git a/ippisite/ippidb/static/images/Other/Chembl_logo.png b/ippisite/ippidb/static/images/Other/Chembl_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..d3e8c7fae16349c26a12cbd16251ad9ac38cd55f Binary files /dev/null and b/ippisite/ippidb/static/images/Other/Chembl_logo.png differ diff --git a/ippisite/ippidb/static/images/Other/Pubchemlogo.png b/ippisite/ippidb/static/images/Other/Pubchemlogo.png new file mode 100644 index 0000000000000000000000000000000000000000..f6d91630560e29ee2b8fe208ea5888b44d1adeeb Binary files /dev/null and b/ippisite/ippidb/static/images/Other/Pubchemlogo.png differ diff --git a/ippisite/ippidb/templates/compound_db_links.html b/ippisite/ippidb/templates/compound_db_links.html index 0a59ecb0487e718ee6dfa2f63d4ab5c5362eb2fe..366e6351b0852d91d5e57d5296da81ef397a3992 100644 --- a/ippisite/ippidb/templates/compound_db_links.html +++ b/ippisite/ippidb/templates/compound_db_links.html @@ -1,14 +1,13 @@ {%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 %} diff --git a/ippisite/ippidb/templates/compound_grid_item.html b/ippisite/ippidb/templates/compound_grid_item.html index 81a47c23109856f56c735c8b091bef3013402329..b4e225c006ea4a078966fa2be9aebe5e3a239d91 100644 --- a/ippisite/ippidb/templates/compound_grid_item.html +++ b/ippisite/ippidb/templates/compound_grid_item.html @@ -1,15 +1,9 @@ <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> <!-- diff --git a/ippisite/ippidb/templates/compound_table_item.html b/ippisite/ippidb/templates/compound_table_item.html index f089776fc0f4de43be590f7ad15e73614f710702..5fcae8ed0b2208ce8487f4522ea4a97e59c63e4a 100644 --- a/ippisite/ippidb/templates/compound_table_item.html +++ b/ippisite/ippidb/templates/compound_table_item.html @@ -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>