Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ippidb-web
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
iPPIDB
ippidb-web
Commits
5ab2fd01
Commit
5ab2fd01
authored
6 years ago
by
Hervé MENAGER
Browse files
Options
Downloads
Patches
Plain Diff
add inhibition, stabilisation, binding role filters
see #7
parent
42dd92c0
No related branches found
No related tags found
No related merge requests found
Pipeline
#8200
passed
6 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ippisite/ippidb/models.py
+6
-0
6 additions, 0 deletions
ippisite/ippidb/models.py
ippisite/ippidb/templates/compound_list.html
+7
-0
7 additions, 0 deletions
ippisite/ippidb/templates/compound_list.html
ippisite/ippidb/views/compound_query.py
+30
-1
30 additions, 1 deletion
ippisite/ippidb/views/compound_query.py
with
43 additions
and
1 deletion
ippisite/ippidb/models.py
+
6
−
0
View file @
5ab2fd01
...
@@ -314,6 +314,12 @@ class CompoundManager(models.Manager):
...
@@ -314,6 +314,12 @@ class CompoundManager(models.Manager):
qs
=
qs
.
annotate
(
pfizer
=
Case
(
When
(
Q
(
Q
(
a_log_p__lte
=
3
)
&
Q
(
tpsa__gte
=
75
)),
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
qs
=
qs
.
annotate
(
pfizer
=
Case
(
When
(
Q
(
Q
(
a_log_p__lte
=
3
)
&
Q
(
tpsa__gte
=
75
)),
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
# PDB ligand available
# PDB ligand available
qs
=
qs
.
annotate
(
pdb_ligand_av
=
Case
(
When
(
compoundaction__ppi__pdb_id__isnull
=
False
,
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
qs
=
qs
.
annotate
(
pdb_ligand_av
=
Case
(
When
(
compoundaction__ppi__pdb_id__isnull
=
False
,
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
# inhibition role
qs
=
qs
.
annotate
(
inhibition_role
=
Case
(
When
(
compoundactivityresult__modulation_type
=
'
I
'
,
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
# binding role
qs
=
qs
.
annotate
(
binding_role
=
Case
(
When
(
compoundactivityresult__modulation_type
=
'
B
'
,
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
# stabilisation role
qs
=
qs
.
annotate
(
stabilisation_role
=
Case
(
When
(
compoundactivityresult__modulation_type
=
'
S
'
,
then
=
True
),
default
=
False
,
output_field
=
BooleanField
()))
return
qs
return
qs
class
Compound
(
AutoFillableModel
):
class
Compound
(
AutoFillableModel
):
...
...
This diff is collapsed.
Click to expand it.
ippisite/ippidb/templates/compound_list.html
+
7
−
0
View file @
5ab2fd01
...
@@ -77,6 +77,10 @@
...
@@ -77,6 +77,10 @@
</button>
</button>
<div
class=
"dropdown-menu"
aria-labelledby=
"mmoaMenuButton"
>
<div
class=
"dropdown-menu"
aria-labelledby=
"mmoaMenuButton"
>
{% include "dropdown_checkbox.html" with label="PDB ligand available" param_name="pdb_ligand_av" value=pdb_ligand_av %}
{% include "dropdown_checkbox.html" with label="PDB ligand available" param_name="pdb_ligand_av" value=pdb_ligand_av %}
<div
class=
"dropdown-divider"
></div>
{% include "dropdown_checkbox.html" with label="Inhibition role" param_name="inhibition_role" value=inhibition_role %}
{% include "dropdown_checkbox.html" with label="Stabilisation role" param_name="stabilisation_role" value=stabilisation_role %}
{% include "dropdown_checkbox.html" with label="Binding role" param_name="binding_role" value=binding_role %}
</div>
</div>
</div>
</div>
<div
class=
"dropdown btn-group"
style=
"display: inline-flex;"
>
<div
class=
"dropdown btn-group"
style=
"display: inline-flex;"
>
...
@@ -152,6 +156,9 @@
...
@@ -152,6 +156,9 @@
{% include "slider_badge.html" with param_name="lle" param_value=lle param_value_min=lle_value_min param_value_max=lle_value_max param_label="LLE" %}
{% include "slider_badge.html" with param_name="lle" param_value=lle param_value_min=lle_value_min param_value_max=lle_value_max param_label="LLE" %}
{% include "boolean_badge.html" with param_name="pdb_ligand_av" param_value=pdb_ligand_av label="PDB ligand available"%}
{% include "boolean_badge.html" with param_name="pdb_ligand_av" param_value=pdb_ligand_av label="PDB ligand available"%}
{% include "boolean_badge.html" with param_name="inhibition_role" param_value=inhibition_role label="Inhibition role"%}
{% include "boolean_badge.html" with param_name="stabilisation_role" param_value=stabilisation_role label="Stabilisation role"%}
{% include "boolean_badge.html" with param_name="binding_role" param_value=binding_role label="Binding role"%}
{% include "selected_badge.html" with param_name="boundcomplex" values=selected_boundcomplex %}
{% include "selected_badge.html" with param_name="boundcomplex" values=selected_boundcomplex %}
{% include "selected_badge.html" with param_name="family" values=selected_family %}
{% include "selected_badge.html" with param_name="family" values=selected_family %}
...
...
This diff is collapsed.
Click to expand it.
ippisite/ippidb/views/compound_query.py
+
30
−
1
View file @
5ab2fd01
...
@@ -205,7 +205,7 @@ class TrueFilterHandler(FilterHandler):
...
@@ -205,7 +205,7 @@ class TrueFilterHandler(FilterHandler):
if
self
.
value
:
if
self
.
value
:
# filter queryset on the values being True
# filter queryset on the values being True
filter_dict
=
{
filter_dict
=
{
self
.
parameter_name
:
T
rue
,
self
.
parameter_name
:
self
.
value
==
'
t
rue
'
,
}
}
queryset
=
queryset
.
filter
(
**
filter_dict
)
queryset
=
queryset
.
filter
(
**
filter_dict
)
return
queryset
return
queryset
...
@@ -215,6 +215,34 @@ class TrueFilterHandler(FilterHandler):
...
@@ -215,6 +215,34 @@ class TrueFilterHandler(FilterHandler):
pass
pass
class
TrueListFilterHandler
(
object
):
def
__init__
(
self
,
parameter_name_list
,
filter_context
,
request_get
):
self
.
parameter_name_list
=
parameter_name_list
self
.
filter_context
=
filter_context
self
.
values
=
{}
for
parameter_name
in
self
.
parameter_name_list
:
if
request_get
.
get
(
parameter_name
):
self
.
values
[
parameter_name
]
=
request_get
.
get
(
parameter_name
).
strip
()
self
.
filter_context
[
parameter_name
]
=
self
.
values
[
parameter_name
]
def
process
(
self
,
queryset
):
"""
to be called during queryset filtering
"""
# if a value has been set for this filter
if
len
(
self
.
values
)
>
0
:
q
=
Q
()
for
parameter_name
,
value
in
self
.
values
.
items
():
q
=
q
|
Q
(
**
{
parameter_name
:
value
==
'
true
'
})
queryset
=
queryset
.
filter
(
q
)
print
(
q
)
return
queryset
def
post_process
(
self
,
compound_ids
,
queryset
):
"""
to be called after queryset filtering
"""
pass
class
CompoundListView
(
ListView
):
class
CompoundListView
(
ListView
):
model
=
Compound
model
=
Compound
...
@@ -306,6 +334,7 @@ class CompoundListView(ListView):
...
@@ -306,6 +334,7 @@ class CompoundListView(ListView):
CompoundSimilarityFilterHandler
(
'
similar_to
'
,
self
.
filter_context
,
self
.
request
.
GET
),
CompoundSimilarityFilterHandler
(
'
similar_to
'
,
self
.
filter_context
,
self
.
request
.
GET
),
TextSearchFilterHandler
(
'
q
'
,
self
.
filter_context
,
self
.
request
.
GET
),
TextSearchFilterHandler
(
'
q
'
,
self
.
filter_context
,
self
.
request
.
GET
),
TrueFilterHandler
(
'
pdb_ligand_av
'
,
self
.
filter_context
,
self
.
request
.
GET
),
TrueFilterHandler
(
'
pdb_ligand_av
'
,
self
.
filter_context
,
self
.
request
.
GET
),
TrueListFilterHandler
([
'
inhibition_role
'
,
'
stabilisation_role
'
,
'
binding_role
'
],
self
.
filter_context
,
self
.
request
.
GET
)
]
]
for
cfh
in
cfhs
:
for
cfh
in
cfhs
:
qs
=
cfh
.
process
(
qs
)
qs
=
cfh
.
process
(
qs
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment