Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
iPPIDB
ippidb-web
Commits
46e0fc59
Commit
46e0fc59
authored
Nov 17, 2020
by
Hervé MENAGER
Browse files
add compound "summary" to list view, + cytotox and pk in card
fixes #251, and adds missing data to compound card :)
parent
7db49163
Pipeline
#41679
passed with stages
in 17 minutes and 57 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
ippisite/ippidb/models.py
View file @
46e0fc59
...
...
@@ -8,6 +8,7 @@ import operator
import
re
import
sys
from
boltons.iterutils
import
flatten
,
unique_iter
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
from
django.core.exceptions
import
ValidationError
...
...
@@ -985,6 +986,20 @@ class Compound(AutoFillableModel):
.
count
()
)
@
property
def
pk_tests_count
(
self
):
"""
Return the number of associated pharmacokinetic tests
"""
return
self
.
compoundpkresult_set
.
all
().
count
()
@
property
def
cytotoxicity_tests_count
(
self
):
"""
Return the number of associated cytotoxicity tests
"""
return
self
.
compoundcytotoxicityresult_set
.
all
().
count
()
@
property
def
sorted_similar_drugbank_compounds
(
self
):
"""
...
...
@@ -1183,6 +1198,60 @@ class Compound(AutoFillableModel):
CompoundTanimoto
.
objects
.
filter
(
compound
=
self
).
delete
()
DrugbankCompoundTanimoto
.
objects
.
filter
(
compound
=
self
).
delete
()
def
get_target_activities_table
(
self
):
"""
Return test activity result data as a list of
items containing for each PPI family the compound
was tested against, the best activity, the linked diseases
and the modulation types
"""
ppi_families
=
[
item
[
"test_activity_description__ppi__family"
]
for
item
in
self
.
compoundactivityresult_set
.
filter
(
~
Q
(
activity_type
=
"KdRat"
)
)
.
order_by
()
.
values
(
"test_activity_description__ppi__family"
)
.
distinct
()
]
results
=
[]
for
ppi_family
in
ppi_families
:
family_compound_activity_results
=
self
.
compoundactivityresult_set
.
filter
(
~
Q
(
activity_type
=
"KdRat"
)
).
filter
(
test_activity_description__ppi__family__id
=
ppi_family
)
best_activity
=
(
family_compound_activity_results
.
order_by
(
"-activity"
)
.
values
(
"activity"
)
.
first
()[
"activity"
]
)
diseases
=
list
(
unique_iter
(
flatten
(
[
list
(
fcar
.
test_activity_description
.
ppi
.
diseases
.
all
())
for
fcar
in
family_compound_activity_results
]
)
)
)
modulation_types
=
list
(
set
(
[
fcar
.
get_modulation_type_display
()
for
fcar
in
family_compound_activity_results
]
)
)
results
.
append
(
{
"family"
:
PpiFamily
.
objects
.
get
(
id
=
ppi_family
),
"best_activity"
:
best_activity
,
"diseases"
:
diseases
,
"modulation_types"
:
modulation_types
,
}
)
return
results
class
CompoundTanimoto
(
models
.
Model
):
canonical_smiles
=
models
.
TextField
(
"Canonical Smile"
)
...
...
ippisite/ippidb/templates/compound_card.html
View file @
46e0fc59
...
...
@@ -382,20 +382,7 @@
<div
class=
"row d-flex justify-content-center"
>
<div
class=
"col-sm-12 col-md-9"
style=
"margin: 10px;"
>
<h5
class=
"card_title"
>
Summary
</h5>
<div
class=
"card_border row"
style=
"text-align: center;"
>
<div
class=
"col-md-4"
>
<h6
class=
"card_title"
>
Bibliographic ressources
</h6>
<p>
{{ compound.biblio_refs.count }}
</p>
</div>
<div
class=
"col-md-4"
>
<h6
class=
"card_title"
>
Biochemical tests
</h6>
<p>
{{ compound.bioch_tests_count }}
</p>
</div>
<div
class=
"col-md-4"
>
<h6
class=
"card_title"
>
Cellular tests
</h6>
<p>
{{ compound.cell_tests_count }}
</p>
</div>
</div>
{% include "compound_test_counts.html" with compound=compound show_bibrefs=True %}
</div>
</div>
<div
class=
"row d-flex justify-content-center"
>
...
...
ippisite/ippidb/templates/compound_l_item.html
View file @
46e0fc59
...
...
@@ -38,7 +38,7 @@
{% include "compound_dbsearch_links.html" %}
{% endif %}
{% if compound.biblio_refs %}
<h4
class=
"pt-2 compound_list_title"
>
Bibliography
</h4>
<h4
class=
"pt-2 compound_list_title"
>
Bibliography
({{compound.biblio_refs.count}})
</h4>
<table
class=
"table"
>
<thead>
<tr>
...
...
@@ -55,7 +55,39 @@
{% endfor %}
</tbody>
</table>
</ul>
<h4
class=
"pt-2 compound_list_title"
>
Pharmacological data
</h4>
{% include "compound_test_counts.html" with compound=compound show_bibrefs=False %}
<h4
class=
"pt-2 compound_list_title"
>
Targets
</h4>
<table
class=
"table"
>
<thead>
<tr>
<th
scope=
"col"
>
PPI family
</th>
<th
scope=
"col"
>
Best activity
</th>
<th
scope=
"col"
>
Diseases
</th>
<th
scope=
"col"
title=
"Molecular Mechanism of Action"
>
MMoA
</th>
</tr>
</thead>
<tbody>
{% for row in compound.get_target_activities_table %}
<tr>
<td
scope=
"col"
>
{{ row.family.name }}
</td>
<td
scope=
"col"
>
{{ row.best_activity }}
</td>
<td
scope=
"col"
>
{% for disease in row.diseases %}
{{ disease.name }}
{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
<td
scope=
"col"
>
{% for modulation_type in row.modulation_types %}
{{ modulation_type }}
{% if not forloop.last %}, {% endif %}
{% endfor %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>
ippisite/ippidb/templates/compound_test_counts.html
0 → 100644
View file @
46e0fc59
<div
class=
"card_border row"
style=
"text-align: center;"
>
{% if show_bibrefs %}
<div
class=
"col-md-4"
>
<h6
class=
"card_title"
>
Bibliographic ressources
</h6>
<p>
{{ compound.biblio_refs.count }}
</p>
</div>
{% endif %}
<div
class=
"col-md-{% if show_bibrefs %}2{%else%}3{%endif%}"
>
<h6
class=
"card_title"
title=
"Biochemical tests"
>
Biochemical tests
</h6>
<p>
{{ compound.bioch_tests_count }}
</p>
</div>
<div
class=
"col-md-{% if show_bibrefs %}2{%else%}3{%endif%}"
>
<h6
class=
"card_title"
title=
"Cellular tests"
>
Cellular tests
</h6>
<p>
{{ compound.cell_tests_count }}
</p>
</div>
<div
class=
"col-md-{% if show_bibrefs %}2{%else%}3{%endif%}"
>
<h6
class=
"card_title"
title=
"Pharmacokinetic tests"
>
PK tests
</h6>
<p>
{{ compound.pk_tests_count }}
</p>
</div>
<div
class=
"col-md-{% if show_bibrefs %}2{%else%}3{%endif%}"
>
<h6
class=
"card_title"
title=
"Cytotoxicity tests"
>
Cytotoxicity tests
</h6>
<p>
{{ compound.cytotoxicity_tests_count }}
</p>
</div>
</div>
\ No newline at end of file
ippisite/requirements-core.txt
View file @
46e0fc59
...
...
@@ -29,3 +29,4 @@ git+https://gitlab.pasteur.fr/hmenager/django-diu.git#egg=django_diu
django-crispy-forms
celery==4.4.7
django-polymorphic
boltons
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment