Commit 83eef501 authored by Hervé  MENAGER's avatar Hervé MENAGER
Browse files

add filters on Drugbank ID and PDB ligand ID in compound query

WIP on #220
parent 4555c122
......@@ -128,6 +128,14 @@
<input type="checkbox" id="chemspider_id" {% if chemspider_id %}checked{% endif %} /> in
<label class="dropdown-item" onclick="toggleCheckBox('ligand_id')">
<input type="checkbox" id="ligand_id" {% if ligand_id %}checked{% endif %} /> in
PDB Ligand
<label class="dropdown-item" onclick="toggleCheckBox('drugbank_id')">
<input type="checkbox" id="drugbank_id" {% if drugbank_id %}checked{% endif %} /> in
......@@ -289,7 +297,9 @@
{% include "boolean_badge.html" with param_name="pubchem_id" param_value=pubchem_id label="PubChem ID"%}
{% include "boolean_badge.html" with param_name="chembl_id" param_value=chembl_id label="ChEMBL ID"%}
{% include "boolean_badge.html" with param_name="ligand_id" param_value=ligand_id label="PDB Ligand ID"%}
{% include "boolean_badge.html" with param_name="chemspider_id" param_value=chemspider_id label="ChemSpider ID"%}
{% include "boolean_badge.html" with param_name="drugbank_id" param_value=drugbank_id label="Drugbank ID"%}
{% include "selected_badge.html" with param_name="domain" values=selected_domain %}
{% include "selected_badge.html" with param_name="boundcomplex" values=selected_boundcomplex %}
......@@ -367,8 +367,9 @@ class ExistsFilterHandler(FilterHandler):
if self.value:
# filter queryset on the values not being NULL
queryset = queryset.exclude(
**{self.parameter_name + "__isnull": not (self.value)}
**{self.parameter_name + "__isnull": self.value}
print({self.parameter_name + "__isnull": not (self.value)})
return queryset
def post_process(self, compound_ids, queryset):
......@@ -708,6 +709,8 @@ class CompoundListView(ListView):
ExistsFilterHandler("pubchem_id", self.filter_context, self.request.GET),
ExistsFilterHandler("chemspider_id", self.filter_context, self.request.GET),
ExistsFilterHandler("chembl_id", self.filter_context, self.request.GET),
ExistsFilterHandler("ligand_id", self.filter_context, self.request.GET),
ExistsFilterHandler("drugbank_id", self.filter_context, self.request.GET),
TrueFilterHandler("lipinsky", self.filter_context, self.request.GET),
TrueFilterHandler("veber", self.filter_context, self.request.GET),
TrueFilterHandler("pfizer", self.filter_context, self.request.GET),
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