Skip to content
Snippets Groups Projects
Commit 5c7fd64c authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add model and template code for compound pharmacology tab

still missing:
- sort pXC50 with ki > kd > ic50 > ec50 rule
- add PPI families in the model (and migrate them)


Former-commit-id: 222c0792c744baa037d5c109337d865669e4fa1a
parent c7e0ad5b
No related branches found
No related tags found
No related merge requests found
......@@ -451,6 +451,21 @@ class Compound(models.Model):
ppi_name = best_activity_car.test_activity_description.ppi.name
return ppi_name
@property
def bioch_tests_count(self):
"""
return the number of associated biochemical tests
"""
return self.compoundactivityresult_set.all().filter(test_activity_description__test_type='BIOCH').count()
@property
def cell_tests_count(self):
"""
return the number of associated cell tests
"""
return self.compoundactivityresult_set.all().filter(test_activity_description__test_type='CELL').count()
class LeLleBiplotData(models.Model):
le_lle_biplot_data = models.CharField('LE-LLE biplot JSON data', max_length=150000, blank=True, null=True)
......@@ -561,6 +576,13 @@ class TestActivityDescription(models.Model):
else:
return self.ppi.get_ppi_bound_complexes()
@property
def protein_domain_partner_complex(self):
for ppic in self.ppi.ppicomplex_set.all():
if hasattr(ppic.complex,'proteindomainpartnercomplex'):
return ppic.complex.proteindomainpartnercomplex
return None
class CompoundActivityResult(models.Model):
MODULATION_TYPES = (
......@@ -592,6 +614,9 @@ class CompoundActivityResult(models.Model):
def __str__(self):
return 'Compound activity result for {} test {} on {}'.format(self.activity_type, self.test_activity_description.id, self.compound.id)
def is_best(self):
return self.compound.best_pXC50_compound_activity_result.id == self.id
class TestCytotoxDescription(models.Model):
biblio = models.ForeignKey(Bibliography, models.CASCADE)
test_name = models.CharField('Cytotoxicity test name', max_length=100)
......
......@@ -166,6 +166,55 @@
</script>
</div>
</div>
<div class="card col-sm-12 col-md-12">
<h5 class="card-header">Summary</h5>
<div class="card-body row">
<div class="col-md-4">
<h6>Bibliographic ressources</h6>
<p>{{ compound.biblio_refs.count }}</p>
</div>
<div class="col-md-4">
<h6>Biochemical tests</h6>
<p>{{ compound.bioch_tests_count }}</p>
</div>
<div class="col-md-4">
<h6>Cellular tests</h6>
<p>{{ compound.cell_tests_count }}</p>
</div>
</div>
</div>
<div class="card col-sm-12 col-md-12">
<h5 class="card-header">Pharmacological data</h5>
<div class="card-body">
<table class="table table-sm col-sm-12 col-md-6">
<thead>
<tr>
<th class="col-sm-1" scope="col">Bibliography</th>
<th class="col-sm-1" scope="col">Target</th>
<th class="col-sm-1" scope="col">Competition</th>
<th class="col-sm-2" scope="col">Assay type</th>
<th class="col-sm-5" scope="col">Assay name</th>
<th class="col-sm-1" scope="col">Activity type</th>
<th class="col-sm-1" scope="col">Activity</th>
</tr>
</thead>
<tbody>
{% for car in compound.compoundactivityresult_set.all %}
<tr {% if car.is_best %}class="border border-primary"{% endif %}>
<td>{% include "biblio_simplelink.html" with bibliography=car.test_activity_description.biblio %}</td>
<td>{{ car.test_activity_description.protein_domain_bound_complex.name }} {{ car.test_activity_description.protein_domain_bound_complex.protein.uniprot_id }}</td>
<td>{{ car.test_activity_description.protein_domain_partner_complex.name }} {{ car.test_activity_description.protein_domain_partner_complex.protein.uniprot_id }}</td>
<td>{{ car.test_activity_description.get_test_type_display }}</td>
<td>{{ car.test_activity_description.test_name }}</td>
<td>{{ car.get_activity_type_display }}</td>
<td>{{ car.activity|floatformat:2 }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="tab-pane fade" id="v-pills-drugsimilarity" role="tabpanel" aria-labelledby="v-pills-drugsimilarity-tab">
</div>
......
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