Commit 45e752dd authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add a tag to simplify physicochemical filters table HTML

additionally, it allows to make the distinction between failed tests
and null values.
parent 78abdd14
Pipeline #16314 passed with stages
in 10 minutes and 1 second
{% extends "base.html" %}
{% load customtags %}
{% block title %}compound detail{% endblock %}
......@@ -42,71 +42,71 @@
</div>
<div class="tab-pane fade" id="physicochemistry" role="tabpanel" aria-labelledby="physicochemistry-tab">
<div class="row">
<div class="card col-sm-12 col-md-6">
<h5 class="card-header">Physicochemical filters</h5>
<div class="card-body">
<table class="table table-sm col-sm-12 col-md-6">
<thead>
<tr>
<th class="col-sm-3" scope="col">Descriptor</th>
<th class="col-sm-3" scope="col">Lipinski's RO5</th>
<th class="col-sm-3" scope="col">Veber</th>
<th class="col-sm-3" scope="col">Pfizer's 3/75</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Global</th>
<td class="{% if compound.lipinsky %}table-success{% else %}table-danger{% endif %}" title="at least 3 criteria ok"></td>
<td class="{% if compound.veber %}table-success{% else %}table-danger{% endif %}" title="RB and HBA+HBD or TPSA ok"></td>
<td class="{% if compound.pfizer %}table-success{% else %}table-danger{% endif %}" title="AlogP and TPSA ok"></td>
</tr>
<tr>
<th scope="row">MW</th>
<td class="text-right {% if compound.lipinsky_mw %}table-success{% else %}table-danger{% endif %}" title="Molecular weight <= 500g/mol">{{ compound.molecular_weight }}g/mol</td>
<td class="table-light"></td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">HBA</th>
<td class="text-right {% if compound.lipinsky_hba %}table-success{% else %}table-danger{% endif %}" title="HBA <= 10">{{ compound.nb_acceptor_h }}</td>
<td class="table-light"></td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">HBD</th>
<td class="text-right {% if compound.lipinsky_hbd %}table-success{% else %}table-danger{% endif %}" title="HBD <= 5">{{ compound.nb_donor_h }}</td>
<td class="table-light"></td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">HBA + HBD</th>
<td class="table-light"></td>
<td class="text-right {% if compound.veber_hba_hbd %}table-success{% else %}table-danger{% endif %}" title="HBD + HBA <= 12">{{ compound.hba_hbd }}</td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">AlogP</th>
<td class="text-right {% if compound.lipinsky_a_log_p %}table-success{% else %}table-danger{% endif %}" title="AlogP <= 5">{{ compound.a_log_p }}</td>
<td class="table-light"></td>
<td class="text-right {% if compound.pfizer_a_log_p %}table-success{% else %}table-danger{% endif %}" title="AlogP <= 3">{{ compound.a_log_p }}</td>
</tr>
<tr>
<th scope="row">TPSA</th>
<td class="table-light"></td>
<td class="text-right {% if compound.veber_tpsa %}table-success{% else %}table-danger{% endif %}" title="TPSA <= 140">{{ compound.tpsa }}</td>
<td class="text-right {% if compound.pfizer_tpsa %}table-success{% else %}table-danger{% endif %}" title="TPSA >= 75">{{ compound.tpsa }}</td>
</tr>
<tr>
<th scope="row">RB</th>
<td class="table-light"></td>
<td class="text-right {% if compound.veber_rb %}table-success{% else %}table-danger{% endif %}" title="RB <= 10">{{ compound.nb_rotatable_bonds }}</td>
<td class="table-light"></td>
</tr>
</tbody>
</table>
<div class="card col-sm-12 col-md-6">
<h5 class="card-header">Physicochemical filters</h5>
<div class="card-body">
<table class="table table-sm col-sm-12 col-md-6">
<thead>
<tr>
<th class="col-sm-3" scope="col">Descriptor</th>
<th class="col-sm-3" scope="col">Lipinski's RO5</th>
<th class="col-sm-3" scope="col">Veber</th>
<th class="col-sm-3" scope="col">Pfizer's 3/75</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Global</th>
<td class="{% status_class compound.lipinsky %}" title="at least 3 criteria ok"></td>
<td class="{% status_class compound.veber %}" title="RB and HBA+HBD or TPSA ok"></td>
<td class="{% status_class compound.pfizer %}" title="AlogP and TPSA ok"></td>
</tr>
<tr>
<th scope="row">MW</th>
<td class="text-right {% status_class compound.lipinsky_mw %}" title="Molecular weight <= 500g/mol">{{ compound.molecular_weight }}g/mol</td>
<td class="table-light"></td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">HBA</th>
<td class="text-right {% status_class compound.lipinsky_hba %}" title="HBA <= 10">{{ compound.nb_acceptor_h }}</td>
<td class="table-light"></td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">HBD</th>
<td class="text-right {% status_class compound.lipinsky_hbd %}" title="HBD <= 5">{{ compound.nb_donor_h }}</td>
<td class="table-light"></td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">HBA + HBD</th>
<td class="table-light"></td>
<td class="text-right {% status_class compound.veber_hba_hbd %}" title="HBD + HBA <= 12">{{ compound.hba_hbd }}</td>
<td class="table-light"></td>
</tr>
<tr>
<th scope="row">AlogP</th>
<td class="text-right {% status_class compound.lipinsky_a_log_p %}" title="AlogP <= 5">{{ compound.a_log_p }}</td>
<td class="table-light"></td>
<td class="text-right {% status_class compound.pfizer_a_log_p %}" title="AlogP <= 3">{{ compound.a_log_p }}</td>
</tr>
<tr>
<th scope="row">TPSA</th>
<td class="table-light"></td>
<td class="text-right {% status_class compound.veber_tpsa %}" title="TPSA <= 140">{{ compound.tpsa }}</td>
<td class="text-right {% status_class compound.pfizer_tpsa %}" title="TPSA >= 75">{{ compound.tpsa }}</td>
</tr>
<tr>
<th scope="row">RB</th>
<td class="table-light"></td>
<td class="text-right {% status_class compound.veber_rb %}" title="RB <= 10">{{ compound.nb_rotatable_bonds }}</td>
<td class="table-light"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="card col-sm-12 col-md-6">
<h5 class="card-header">Radar chart</h5>
<div class="card-body">
......
......@@ -19,6 +19,16 @@ def url_replace(request, field, value):
return dict_.urlencode()
@register.simple_tag
def status_class(value):
if value is True:
return 'table-success'
elif value is False:
return 'table-danger'
else:
return 'table-secondary'
@register.filter
def bootstrap(object):
return mark_safe("".join(bootstrap_core(object)))
......
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