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

discard "Kd ratio" compound activities from "best activity"

this complements work in a075f990
related to #204
parent dd172263
No related branches found
No related tags found
1 merge request!13Master
Pipeline #28891 passed
...@@ -1038,9 +1038,7 @@ class TestActivityDescription(models.Model): ...@@ -1038,9 +1038,7 @@ class TestActivityDescription(models.Model):
nb_active_compounds = models.IntegerField( nb_active_compounds = models.IntegerField(
verbose_name="Total number of active compounds" verbose_name="Total number of active compounds"
) )
cell_line = models.ForeignKey( cell_line = models.ForeignKey(CellLine, on_delete=models.SET_NULL, null=True)
CellLine, on_delete=models.SET_NULL, null=True
)
def get_complexes(self): def get_complexes(self):
""" """
...@@ -1326,7 +1324,12 @@ def update_compound_cached_properties(compounds_queryset=None): ...@@ -1326,7 +1324,12 @@ def update_compound_cached_properties(compounds_queryset=None):
), ),
best_activity=Subquery( best_activity=Subquery(
compounds_queryset.filter(id=OuterRef("id")) compounds_queryset.filter(id=OuterRef("id"))
.annotate(_best_activity=Max("compoundactivityresult__activity")) .annotate(
_best_activity=Max(
"compoundactivityresult__activity",
filter=~Q(compoundactivityresult__activity_type="KdRat"),
)
)
.values("_best_activity")[:1] .values("_best_activity")[:1]
), ),
le=Subquery( le=Subquery(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment