Skip to content

Commit

Permalink
update sql query
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryan Lai committed Jun 18, 2024
1 parent 3d35484 commit 6144043
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 38 deletions.
17 changes: 0 additions & 17 deletions docker-compose.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,21 @@
#{studyId}
</foreach>
</if>
<!-- sample-lists-counts filter -->
<!-- filter for samples which belong to the sample lists (aka case lists) selected by the user and appearing in the studyViewFilter.caseLists collection -->
<if test="studyViewFilter.caseLists != null and !studyViewFilter.caseLists.isEmpty()">
INTERSECT
<!-- get samples that are in each sample list in the filter -->
SELECT * FROM (
<foreach item="ANDGroup" collection="studyViewFilter.caseLists" separator="INTERSECT">
SELECT sv.sample_unique_id
FROM sample_list_list sll
LEFT JOIN sample_view sv ON sll.sample_id=sv.internal_id
LEFT JOIN sample_list sl on sll.list_id=sl.list_id
<where>
<!-- samples that are in the studies in the filter -->
sv.cancer_study_identifier IN
<foreach item="studyId" collection="studyViewFilter.studyIds" open="(" separator="," close=")">
#{studyId}
</foreach>
AND
<!-- a sample is in a sample list if its list id is in the sample list name -->
<foreach item="sampleListId" collection="ANDGroup" open="(" separator="OR" close=")">
sl.stable_id LIKE '%_${sampleListId}'
SELECT sample_unique_id
FROM sample_list_list sll
LEFT JOIN sample_view sv ON sll.sample_id=sv.internal_id
LEFT JOIN sample_list sl on sll.list_id=sl.list_id
<!-- a sample is in a sample list if the sampleListId is part of the sample's list stable id (stable_id) -->
<where>
<foreach item="sampleLists" collection="studyViewFilter.caseLists" separator="INTERSECT">
<foreach item="sampleListId" collection="sampleLists" open="(" separator="OR" close=")">
stable_id LIKE '%_${sampleListId}'
</foreach>
</where>
</foreach>
)
</foreach>
</where>
</if>
<if test="studyViewFilter.sampleIdentifiers != null and !studyViewFilter.sampleIdentifiers.isEmpty()">
INTERSECT
Expand Down

0 comments on commit 6144043

Please sign in to comment.