From 4f0452506f7990d93a1283d25a4dfc406f98ed7a Mon Sep 17 00:00:00 2001 From: Onur Sumer Date: Wed, 11 Dec 2024 18:47:48 -0500 Subject: [PATCH] Make sure study ids exist before using them in filter SQL (#11272) * make sure study ids exist before using them in filter SQL * add involved cancer studies into StudyViewFilterHelper --- .../model/StudyViewFilterContext.java | 7 +- .../helper/StudyViewFilterHelper.java | 17 +++- .../StudyViewMyBatisRepository.java | 7 +- .../impl/StudyViewColumnarServiceImpl.java | 14 +--- .../columnar/util/CustomDataFilterUtil.java | 23 ++++- .../StudyViewFilterMapper.xml | 84 ++++++++++++------- .../mybatisclickhouse/StudyViewMapper.xml | 13 +-- .../mybatisclickhouse/CNAGenesTest.java | 4 +- .../ClinicalEventTypeCountsTest.java | 4 +- .../FilteredSamplesTest.java | 18 ++-- .../GenericAssayDataCountsTest.java | 4 +- .../GenomicDataCountsTest.java | 4 +- .../MolecularProfileCountTest.java | 8 +- .../mybatisclickhouse/MutatedGenesTest.java | 8 +- .../MutationDataCountsTest.java | 4 +- .../PatientTreatmentCountsTest.java | 8 +- .../mybatisclickhouse/ProfiledCountsTest.java | 16 ++-- .../ProteinExpressionCountsTest.java | 4 +- .../SampleTreatmentCountsTest.java | 8 +- .../StructuralVariantGenesTest.java | 2 +- .../StudyViewCaseListSamplesCountsTest.java | 8 +- .../StudyViewMapperClinicalDataCountTest.java | 18 ++-- 22 files changed, 167 insertions(+), 116 deletions(-) diff --git a/src/main/java/org/cbioportal/model/StudyViewFilterContext.java b/src/main/java/org/cbioportal/model/StudyViewFilterContext.java index 71ad071ae15..e23e5f7d9d4 100644 --- a/src/main/java/org/cbioportal/model/StudyViewFilterContext.java +++ b/src/main/java/org/cbioportal/model/StudyViewFilterContext.java @@ -5,7 +5,10 @@ import java.util.List; -public record StudyViewFilterContext( StudyViewFilter studyViewFilter, - List customDataFilterSamples) { +public record StudyViewFilterContext( + StudyViewFilter studyViewFilter, + List customDataFilterSamples, + List involvedCancerStudies +) { } diff --git a/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java b/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java index b495f2c5976..23615be0ef4 100644 --- a/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java +++ b/src/main/java/org/cbioportal/persistence/helper/StudyViewFilterHelper.java @@ -23,7 +23,8 @@ public final class StudyViewFilterHelper { public static StudyViewFilterHelper build(@Nullable StudyViewFilter studyViewFilter, @Nullable Map> genericAssayProfilesMap, - @Nullable List customDataSamples) { + @Nullable List customDataSamples, + @Nullable List involvedCancerStudies) { if (Objects.isNull(studyViewFilter)) { studyViewFilter = new StudyViewFilter(); } @@ -33,6 +34,9 @@ public static StudyViewFilterHelper build(@Nullable StudyViewFilter studyViewFil if (Objects.isNull(customDataSamples)) { customDataSamples = new ArrayList<>(); } + if (Objects.isNull(involvedCancerStudies)) { + involvedCancerStudies = new ArrayList<>(); + } if (studyViewFilter.getGenomicDataFilters() != null && !studyViewFilter.getGenomicDataFilters().isEmpty()) { List mergedGenomicDataFilters = mergeDataFilters(studyViewFilter.getGenomicDataFilters()); studyViewFilter.setGenomicDataFilters(mergedGenomicDataFilters); @@ -45,19 +49,22 @@ public static StudyViewFilterHelper build(@Nullable StudyViewFilter studyViewFil List mergedGenericAssayDataFilters = mergeDataFilters(studyViewFilter.getGenericAssayDataFilters()); studyViewFilter.setGenericAssayDataFilters(mergedGenericAssayDataFilters); } - return new StudyViewFilterHelper(studyViewFilter, genericAssayProfilesMap, customDataSamples); + return new StudyViewFilterHelper(studyViewFilter, genericAssayProfilesMap, customDataSamples, involvedCancerStudies); } private final StudyViewFilter studyViewFilter; private final CategorizedGenericAssayDataCountFilter categorizedGenericAssayDataCountFilter; private final List customDataSamples; + private final List involvedCancerStudies; private StudyViewFilterHelper(@NonNull StudyViewFilter studyViewFilter, @NonNull Map> genericAssayProfilesMap, - @NonNull List customDataSamples) { + @NonNull List customDataSamples, + @NonNull List involvedCancerStudies) { this.studyViewFilter = studyViewFilter; this.categorizedGenericAssayDataCountFilter = extractGenericAssayDataCountFilters(studyViewFilter, genericAssayProfilesMap); this.customDataSamples = customDataSamples; + this.involvedCancerStudies = involvedCancerStudies; } public StudyViewFilter studyViewFilter() { @@ -71,6 +78,10 @@ public CategorizedGenericAssayDataCountFilter categorizedGenericAssayDataCountFi public List customDataSamples() { return this.customDataSamples; } + + public List involvedCancerStudies() { + return involvedCancerStudies; + } private CategorizedGenericAssayDataCountFilter extractGenericAssayDataCountFilters(final StudyViewFilter studyViewFilter, Map> genericAssayProfilesMap) { if ((studyViewFilter.getGenericAssayDataFilters() == null || genericAssayProfilesMap.isEmpty())) diff --git a/src/main/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMyBatisRepository.java b/src/main/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMyBatisRepository.java index ef3b2f52eaa..d3f594d61be 100644 --- a/src/main/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMyBatisRepository.java +++ b/src/main/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMyBatisRepository.java @@ -97,7 +97,12 @@ public List getMolecularProfileSampleCounts(StudyViewFilterCon } public StudyViewFilterHelper createStudyViewFilterHelper(StudyViewFilterContext studyViewFilterContext) { - return StudyViewFilterHelper.build(studyViewFilterContext.studyViewFilter() , getGenericAssayProfilesMap(), studyViewFilterContext.customDataFilterSamples()); + return StudyViewFilterHelper.build( + studyViewFilterContext.studyViewFilter(), + getGenericAssayProfilesMap(), + studyViewFilterContext.customDataFilterSamples(), + studyViewFilterContext.involvedCancerStudies() + ); } @Override diff --git a/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java b/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java index d9256c1fb77..d30b77dcc4f 100644 --- a/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java +++ b/src/main/java/org/cbioportal/service/impl/StudyViewColumnarServiceImpl.java @@ -161,16 +161,7 @@ public List getClinicalDataCounts(StudyViewFilter studyVi var context = createContext(studyViewFilter); - List involvedCancerStudies = new ArrayList<>(); - if (studyViewFilter.getStudyIds() != null && !studyViewFilter.getStudyIds().isEmpty()) { - involvedCancerStudies = studyViewFilter.getStudyIds(); - } else if (studyViewFilter.getSampleIdentifiers() != null && !studyViewFilter.getSampleIdentifiers().isEmpty()) { - Set studyIdSet = new HashSet<>(); - for (SampleIdentifier sampleIdentifier : studyViewFilter.getSampleIdentifiers()) { - studyIdSet.add(sampleIdentifier.getStudyId()); - } - involvedCancerStudies = studyIdSet.stream().toList(); - } + List involvedCancerStudies = context.involvedCancerStudies(); var result = studyViewRepository.getClinicalDataCounts(context, filteredAttributes); @@ -288,7 +279,8 @@ public List getMutationTypeCountsByGeneSpecific(StudyViewF private StudyViewFilterContext createContext(StudyViewFilter studyViewFilter) { List customSampleIdentifiers = customDataFilterUtil.extractCustomDataSamples(studyViewFilter); - return new StudyViewFilterContext(studyViewFilter, customSampleIdentifiers); + List involvedCancerStudies = customDataFilterUtil.extractInvolvedCancerStudies(studyViewFilter); + return new StudyViewFilterContext(studyViewFilter, customSampleIdentifiers, involvedCancerStudies); } private List generateDataCountItemsFromDataCounts(List dataCounts) { diff --git a/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java b/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java index b7c75eaa0b3..9987bf510c1 100644 --- a/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java +++ b/src/main/java/org/cbioportal/web/columnar/util/CustomDataFilterUtil.java @@ -16,10 +16,7 @@ import org.springframework.stereotype.Component; import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -37,6 +34,24 @@ public CustomDataFilterUtil(StudyViewFilterUtil studyViewFilterUtil, CustomDataS this.patientService = patientService; } + public List extractInvolvedCancerStudies(final StudyViewFilter studyViewFilter) { + List involvedCancerStudies; + + if (studyViewFilter.getStudyIds() != null && !studyViewFilter.getStudyIds().isEmpty()) { + involvedCancerStudies = studyViewFilter.getStudyIds(); + } else if (studyViewFilter.getSampleIdentifiers() != null && !studyViewFilter.getSampleIdentifiers().isEmpty()) { + Set studyIdSet = new HashSet<>(); + for (SampleIdentifier sampleIdentifier : studyViewFilter.getSampleIdentifiers()) { + studyIdSet.add(sampleIdentifier.getStudyId()); + } + involvedCancerStudies = studyIdSet.stream().toList(); + } + else { + involvedCancerStudies = Collections.emptyList(); + } + + return involvedCancerStudies; + } public List extractCustomDataSamples(final StudyViewFilter studyViewFilter) { if (studyViewFilter == null) { return null; diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml index 30f3c7557b4..584f8cf95bd 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewFilterMapper.xml @@ -4,12 +4,12 @@ - + INTERSECT SELECT sample_unique_id FROM sample_derived WHERE cancer_study_identifier IN - + #{studyId} @@ -42,18 +42,20 @@ JOIN genetic_profile gp ON sample_profile.genetic_profile_id = gp.genetic_profile_id JOIN cancer_study cs ON gp.cancer_study_id = cs.cancer_study_id JOIN sample_derived on sample_profile.sample_id = sample_derived.internal_id - - sample_derived.cancer_study_identifier IN - - #{studyId} - - AND - - - gp.stable_id=concat(#{studyId}, '_', #{genomicProfileId}) + + + sample_derived.cancer_study_identifier IN + + #{studyId} - - + AND + + + gp.stable_id=concat(#{studyId}, '_', #{genomicProfileId}) + + + + ) @@ -430,10 +432,12 @@ SELECT sample_unique_id, patient_unique_id, attribute_value FROM clinical_data_derived WHERE attribute_name = #{clinicalDataFilter.attributeId} AND type='${type}' - AND cancer_study_identifier IN - - #{studyId} - + + AND cancer_study_identifier IN + + #{studyId} + + @@ -511,10 +515,12 @@ FROM genetic_alteration_derived WHERE profile_type = #{genomicDataFilter.profileType} AND hugo_gene_symbol = #{genomicDataFilter.hugoGeneSymbol} + AND cancer_study_identifier IN - + #{studyId} + @@ -641,30 +647,40 @@ SELECT sample_unique_id FROM sample_derived WHERE cancer_study_identifier IN - + + #{studyId} + ), profiled_samples AS ( SELECT DISTINCT sgp.sample_unique_id FROM sample_to_gene_panel_derived sgp JOIN gene_panel_to_gene_derived gpg ON sgp.gene_panel_id = gpg.gene_panel_id - WHERE cancer_study_identifier IN - + WHERE + + cancer_study_identifier IN + #{studyId} - AND gpg.gene = #{mutationDataFilter.hugoGeneSymbol} - AND sgp.alteration_type = 'MUTATION_EXTENDED' + AND + + gpg.gene = #{mutationDataFilter.hugoGeneSymbol} + AND sgp.alteration_type = 'MUTATION_EXTENDED' ), mutated_samples AS ( SELECT DISTINCT sample_unique_id FROM genomic_event_derived - WHERE cancer_study_identifier IN - + WHERE + + cancer_study_identifier IN + #{studyId} - AND hugo_gene_symbol = #{mutationDataFilter.hugoGeneSymbol} - AND variant_type = 'mutation' + AND + + hugo_gene_symbol = #{mutationDataFilter.hugoGeneSymbol} + AND variant_type = 'mutation' ) SELECT DISTINCT sample_unique_id FROM @@ -706,20 +722,26 @@ FROM genetic_alteration_derived WHERE profile_type = #{genomicDataFilter.profileType} AND hugo_gene_symbol = #{genomicDataFilter.hugoGeneSymbol} + AND cancer_study_identifier IN - + #{studyId} + ) SELECT DISTINCT sd.sample_unique_id FROM sample_derived sd LEFT JOIN cna_query ON sd.sample_unique_id = cna_query.sampleUniqueId - WHERE cancer_study_identifier IN - + WHERE + + cancer_study_identifier IN + #{studyId} - + AND + + alteration_value IS null diff --git a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml index e140fd00b6d..bfc49eddc67 100644 --- a/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml +++ b/src/main/resources/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapper.xml @@ -346,11 +346,14 @@ ( SELECT count() > 0 FROM genetic_profile - WHERE patient_level = 1 - AND stable_id IN - - concat(#{studyId}, '_', #{profileType}) - + WHERE + patient_level = 1 + + AND stable_id IN + + concat(#{studyId}, '_', #{profileType}) + + ), (SELECT * FROM ()), (SELECT * FROM ()) diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/CNAGenesTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/CNAGenesTest.java index 3cfb2e04209..18df4041406 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/CNAGenesTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/CNAGenesTest.java @@ -40,7 +40,7 @@ public class CNAGenesTest extends AbstractTestcontainers { public void getCnaGenes() { StudyViewFilter studyViewFilter = new StudyViewFilter(); studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); - var alterationCountByGenes = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(studyViewFilter.getAlterationFilter())); assertEquals(3, alterationCountByGenes.size()); @@ -63,7 +63,7 @@ public void getCnaGenesWithAlterationFilter() { cnaEventTypeFilterMap.put(CNA.AMP, true); alterationFilter.setCopyNumberAlterationEventTypes(cnaEventTypeFilterMap); - var alterationCountByGenes = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(alterationFilter)); assertEquals(2, alterationCountByGenes.size()); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ClinicalEventTypeCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ClinicalEventTypeCountsTest.java index aef5757d5f6..00bf968c29d 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ClinicalEventTypeCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ClinicalEventTypeCountsTest.java @@ -39,7 +39,7 @@ public void getClinicalEventTypeCounts() { StudyViewFilter studyViewFilter = new StudyViewFilter(); studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); - var clinicalEventTypeCounts = studyViewMapper.getClinicalEventTypeCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var clinicalEventTypeCounts = studyViewMapper.getClinicalEventTypeCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(4, clinicalEventTypeCounts.size()); @@ -55,7 +55,7 @@ public void getClinicalEventTypeCounts() { dataFilter.setValues(List.of(dataFilterValue)); studyViewFilter.setClinicalEventFilters(List.of(dataFilter)); - clinicalEventTypeCounts = studyViewMapper.getClinicalEventTypeCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + clinicalEventTypeCounts = studyViewMapper.getClinicalEventTypeCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(3, clinicalEventTypeCounts.size()); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/FilteredSamplesTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/FilteredSamplesTest.java index d7c50aa5fbd..d4926855e97 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/FilteredSamplesTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/FilteredSamplesTest.java @@ -42,7 +42,7 @@ public class FilteredSamplesTest extends AbstractTestcontainers { public void getFilteredSamples() { StudyViewFilter studyViewFilter = new StudyViewFilter(); studyViewFilter.setStudyIds(Arrays.asList(STUDY_TCGA_PUB, STUDY_ACC_TCGA)); - var filteredSamples = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var filteredSamples = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(19, filteredSamples.size()); ClinicalDataFilter customDataFilter = new ClinicalDataFilter(); @@ -50,13 +50,13 @@ public void getFilteredSamples() { DataFilterValue value = new DataFilterValue(); customDataFilter.setValues(List.of(value)); studyViewFilter.setCustomDataFilters(List.of(customDataFilter)); - var filteredSamples1 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples1 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); assertEquals(0, filteredSamples1.size()); CustomSampleIdentifier customSampleIdentifier = new CustomSampleIdentifier(); customSampleIdentifier.setStudyId("acc_tcga"); customSampleIdentifier.setSampleId("tcga-a1-a0sb-01"); - var filteredSamples2 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, Arrays.asList(customSampleIdentifier))); + var filteredSamples2 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, Arrays.asList(customSampleIdentifier), studyViewFilter.getStudyIds())); assertEquals(1, filteredSamples2.size()); } @@ -75,7 +75,7 @@ public void getSamplesFilteredByClinicalData() { ) ) ); - var filteredSamples1 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples1 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); assertEquals(4, filteredSamples1.size()); // samples of patients with AGE <= 20.0 or (80.0, 82.0] @@ -89,7 +89,7 @@ public void getSamplesFilteredByClinicalData() { ) ) ); - var filteredSamples2 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples2 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); assertEquals(6, filteredSamples2.size()); // samples of patients with UNKNOWN AGE @@ -102,7 +102,7 @@ public void getSamplesFilteredByClinicalData() { ) ) ); - var filteredSamples3 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples3 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); assertEquals(1, filteredSamples3.size()); // samples of patients with AGE <= 20.0 or (80.0, 82.0] or UNKNOWN @@ -118,7 +118,7 @@ public void getSamplesFilteredByClinicalData() { ) ) ); - var filteredSamples4 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples4 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); assertEquals(7, filteredSamples4.size()); // NA filter @@ -131,7 +131,7 @@ public void getSamplesFilteredByClinicalData() { ) ) ); - var filteredSamples5 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples5 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); // 4 acc_tcga + 7 study_genie_pub samples with "NA" AGE data or no AGE data assertEquals(11, filteredSamples5.size()); @@ -146,7 +146,7 @@ public void getSamplesFilteredByClinicalData() { ) ) ); - var filteredSamples6 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>())); + var filteredSamples6 = studyViewMapper.getFilteredSamples(StudyViewFilterHelper.build(studyViewFilter, null, new ArrayList<>(), studyViewFilter.getStudyIds())); // 11 NA + 1 UNKNOWN assertEquals(12, filteredSamples6.size()); } diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenericAssayDataCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenericAssayDataCountsTest.java index 82b893b8506..086b18593df 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenericAssayDataCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenericAssayDataCountsTest.java @@ -41,7 +41,7 @@ public void getSampleCategoricalGenericAssayDataCounts() { GenericAssayDataFilter genericAssayDataFilter = new GenericAssayDataFilter("1p_status", "armlevel_cna"); List actualCounts = studyViewMapper.getGenericAssayDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genericAssayDataFilter) ); @@ -67,7 +67,7 @@ public void getPatientCategoricalGenericAssayDataCounts() { GenericAssayDataFilter genericAssayDataFilter = new GenericAssayDataFilter("DMETS_DX_ADRENAL", "distant_mets"); List actualCounts = studyViewMapper.getGenericAssayDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genericAssayDataFilter) ); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenomicDataCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenomicDataCountsTest.java index 8e5e62be3b7..9e569b0e4a1 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenomicDataCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/GenomicDataCountsTest.java @@ -39,7 +39,7 @@ public void getCNACounts() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); GenomicDataFilter genomicDataFilterCNA = new GenomicDataFilter("AKT1", "cna"); - List actualCountsCNA = studyViewMapper.getCNACounts(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataFilterCNA)); + List actualCountsCNA = studyViewMapper.getCNACounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genomicDataFilterCNA)); List expectedCountsCNA = List.of( new GenomicDataCountItem("AKT1", "cna", List.of( new GenomicDataCount("Homozygously deleted", "-2", 2), @@ -55,7 +55,7 @@ public void getCNACounts() { .isEqualTo(expectedCountsCNA); GenomicDataFilter genomicDataFilterGISTIC = new GenomicDataFilter("AKT1", "gistic"); - List actualCountsGISTIC = studyViewMapper.getCNACounts(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataFilterGISTIC)); + List actualCountsGISTIC = studyViewMapper.getCNACounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genomicDataFilterGISTIC)); List expectedCountsGISTIC = List.of( new GenomicDataCountItem("AKT1", "gistic", List.of( new GenomicDataCount("Homozygously deleted", "-2", 2), diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MolecularProfileCountTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MolecularProfileCountTest.java index 4df51f2c867..f9748a09110 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MolecularProfileCountTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MolecularProfileCountTest.java @@ -44,7 +44,7 @@ public void getMolecularProfileCounts() { studyViewFilter.setGenomicProfiles(profileGroups); - var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); var size = molecularProfileCounts.stream().filter(gc->gc.getValue().equals("mutations")) .findFirst().get().getCount().intValue(); @@ -62,7 +62,7 @@ public void getMolecularProfileCountsMultipleStudies() { studyViewFilter.setGenomicProfiles(profileGroups); - var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); var size = molecularProfileCounts.stream().filter(gc->gc.getValue().equals("mutations")) .findFirst().get().getCount().intValue(); @@ -80,7 +80,7 @@ public void getMolecularProfileCountsMultipleProfilesUnion() { studyViewFilter.setGenomicProfiles(profileGroups); - var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); var sizeMutations = molecularProfileCounts.stream().filter(gc->gc.getValue().equals("mutations")) .findFirst().get().getCount().intValue(); @@ -103,7 +103,7 @@ public void getMolecularProfileCountsMultipleProfilesIntersect() { studyViewFilter.setGenomicProfiles(profileGroups); - var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var molecularProfileCounts = studyViewMapper.getMolecularProfileSampleCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); var sizeMutations = molecularProfileCounts.stream().filter(gc->gc.getValue().equals("mutations")) .findFirst().get().getCount().intValue(); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutatedGenesTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutatedGenesTest.java index e6f5035f4e3..dd8001ded6f 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutatedGenesTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutatedGenesTest.java @@ -40,7 +40,7 @@ public class MutatedGenesTest extends AbstractTestcontainers { public void getMutatedGenes() { StudyViewFilter studyViewFilter = new StudyViewFilter(); studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); - var alterationCountByGenes = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(studyViewFilter.getAlterationFilter())); assertEquals(3, alterationCountByGenes.size()); @@ -61,7 +61,7 @@ public void getMutatedGenesWithAlterationFilter() { mutationEventTypeFilterMap.put(MutationEventType.other, Boolean.FALSE); alterationFilter.setMutationEventTypes(mutationEventTypeFilterMap); - var alterationCountByGenes = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(alterationFilter)); assertEquals(2, alterationCountByGenes.size()); @@ -71,7 +71,7 @@ public void getMutatedGenesWithAlterationFilter() { onlyMutationStatusFilter.setIncludeSomatic(false); onlyMutationStatusFilter.setIncludeUnknownStatus(true); - var alterationCountByGenes1 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes1 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(onlyMutationStatusFilter)); assertEquals(1, alterationCountByGenes1.size()); @@ -82,7 +82,7 @@ public void getMutatedGenesWithAlterationFilter() { mutationTypeAndStatusFilter.setIncludeSomatic(false); mutationTypeAndStatusFilter.setIncludeUnknownStatus(true); - var alterationCountByGenes2 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes2 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(onlyMutationStatusFilter)); assertEquals(1, alterationCountByGenes2.size()); } diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutationDataCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutationDataCountsTest.java index e037a8e5efc..d04adb06575 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutationDataCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/MutationDataCountsTest.java @@ -41,7 +41,7 @@ public void getMutationCounts() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); GenomicDataFilter genomicDataFilterMutation = new GenomicDataFilter("AKT1", "cna"); - Map actualMutationCounts = studyViewMapper.getMutationCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), genomicDataFilterMutation); + Map actualMutationCounts = studyViewMapper.getMutationCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), genomicDataFilterMutation); Map expectedMutationCounts = new HashMap<>(); expectedMutationCounts.put("mutatedCount", 2); expectedMutationCounts.put("notMutatedCount", 8); @@ -58,7 +58,7 @@ public void getMutationCountsByType() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); GenomicDataFilter genomicDataFilterMutation = new GenomicDataFilter("AKT1", "mutation"); - List actualMutationCountsByType = studyViewMapper.getMutationCountsByType(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataFilterMutation)); + List actualMutationCountsByType = studyViewMapper.getMutationCountsByType(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genomicDataFilterMutation)); List expectedMutationCountsByType = List.of( new GenomicDataCountItem("AKT1", "mutations", List.of( new GenomicDataCount("nonsense mutation", "nonsense_mutation", 2, 1), diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/PatientTreatmentCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/PatientTreatmentCountsTest.java index fba0574001a..b23fc8f266f 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/PatientTreatmentCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/PatientTreatmentCountsTest.java @@ -39,9 +39,9 @@ public void getPatientTreatmentReportCounts() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); - var patientTreatmentCounts = studyViewMapper.getPatientTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var patientTreatmentCounts = studyViewMapper.getPatientTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); - var patientTreatments = studyViewMapper.getPatientTreatments(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var patientTreatments = studyViewMapper.getPatientTreatments(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(1, patientTreatmentCounts); assertEquals("madeupanib", patientTreatments.getFirst().treatment()); @@ -56,9 +56,9 @@ public void getPatientTreatmentReportCounts() { andedPatientTreatmentFilters.setFilters(List.of(oredPatientTreatmentFilters)); studyViewFilter.setPatientTreatmentFilters(andedPatientTreatmentFilters); - patientTreatmentCounts = studyViewMapper.getPatientTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + patientTreatmentCounts = studyViewMapper.getPatientTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); - patientTreatments = studyViewMapper.getPatientTreatments(StudyViewFilterHelper.build(studyViewFilter, null, null)); + patientTreatments = studyViewMapper.getPatientTreatments(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(1, patientTreatmentCounts); assertEquals("madeupanib", patientTreatments.getFirst().treatment()); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProfiledCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProfiledCountsTest.java index fcfe7fdb6f2..aa3e4a12f4f 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProfiledCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProfiledCountsTest.java @@ -38,13 +38,13 @@ public void getTotalProfiledCountsByGene() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); // Testing profiled counts on samples with gene panel data and WES for one study - var totalProfiledCountsForMutationsMap = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), + var totalProfiledCountsForMutationsMap = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "MUTATION_EXTENDED", List.of()); - var totalProfiledCountsForCnaMap = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), + var totalProfiledCountsForCnaMap = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "COPY_NUMBER_ALTERATION", List.of()); - var sampleProfiledCountsForMutationsWithoutPanelDataMap = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null), + var sampleProfiledCountsForMutationsWithoutPanelDataMap = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "MUTATION_EXTENDED"); - var sampleProfiledCountsForCnaWithoutPanelDataMap = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null), + var sampleProfiledCountsForCnaWithoutPanelDataMap = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "COPY_NUMBER_ALTERATION"); // Assert the count of genes with profiled cases for mutations @@ -92,13 +92,13 @@ public void getTotalProfiledCountsByGene() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB, STUDY_GENIE_PUB)); // Testing profiled counts on samples with gene panel data and WES for a combined study - var totalProfiledCountsForMutationsMap1 = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), + var totalProfiledCountsForMutationsMap1 = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "MUTATION_EXTENDED", List.of()); - var totalProfiledCountsForCnaMap1 = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), + var totalProfiledCountsForCnaMap1 = studyViewMapper.getTotalProfiledCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "COPY_NUMBER_ALTERATION", List.of()); - var sampleProfiledCountsForMutationsWithoutPanelDataMap1 = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null), + var sampleProfiledCountsForMutationsWithoutPanelDataMap1 = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "MUTATION_EXTENDED"); - var sampleProfiledCountsForCnaWithoutPanelDataMap1 = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null), + var sampleProfiledCountsForCnaWithoutPanelDataMap1 = studyViewMapper.getSampleProfileCountWithoutPanelData(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), "COPY_NUMBER_ALTERATION"); // Assert the count of genes with profiled cases for mutations in a combined study diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProteinExpressionCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProteinExpressionCountsTest.java index 95167f245de..332dff493b4 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProteinExpressionCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/ProteinExpressionCountsTest.java @@ -45,7 +45,7 @@ public void getProteinExpressionCounts() { genomicDataBinFilterRPPA.setHugoGeneSymbol("AKT1"); genomicDataBinFilterRPPA.setProfileType("rppa"); - List actualRPPACounts1 = studyViewMapper.getGenomicDataBinCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataBinFilterRPPA)); + List actualRPPACounts1 = studyViewMapper.getGenomicDataBinCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genomicDataBinFilterRPPA)); ClinicalDataCount expectedRPPACount1 = new ClinicalDataCount(); expectedRPPACount1.setAttributeId("AKT1rppa"); @@ -81,7 +81,7 @@ public void getProteinExpressionCounts() { genomicDataFilterRPPA.setValues(List.of(dataFilterValue)); studyViewFilter.setGenomicDataFilters(List.of(genomicDataFilterRPPA)); - List actualRPPACounts2 = studyViewMapper.getGenomicDataBinCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataBinFilterRPPA)); + List actualRPPACounts2 = studyViewMapper.getGenomicDataBinCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of(genomicDataBinFilterRPPA)); ClinicalDataCount expectedRPPACount = new ClinicalDataCount(); expectedRPPACount.setAttributeId("AKT1rppa"); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/SampleTreatmentCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/SampleTreatmentCountsTest.java index 523b3970a55..5baa9149739 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/SampleTreatmentCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/SampleTreatmentCountsTest.java @@ -40,9 +40,9 @@ public void getSampleTreatmentCounts() { studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB)); - var totalSampleTreatmentCount = studyViewMapper.getTotalSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var totalSampleTreatmentCount = studyViewMapper.getTotalSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); - var sampleTreatmentCounts = studyViewMapper.getSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + var sampleTreatmentCounts = studyViewMapper.getSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(1, totalSampleTreatmentCount); assertEquals("madeupanib", sampleTreatmentCounts.getFirst().treatment()); @@ -60,9 +60,9 @@ public void getSampleTreatmentCounts() { andedSampleTreatmentFilters.setFilters(List.of(oredSampleTreatmentFilters)); studyViewFilter.setSampleTreatmentFilters(andedSampleTreatmentFilters); - totalSampleTreatmentCount = studyViewMapper.getTotalSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + totalSampleTreatmentCount = studyViewMapper.getTotalSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); - sampleTreatmentCounts = studyViewMapper.getSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null)); + sampleTreatmentCounts = studyViewMapper.getSampleTreatmentCounts(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds())); assertEquals(0, totalSampleTreatmentCount); assertEquals(0, sampleTreatmentCounts.size()); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StructuralVariantGenesTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StructuralVariantGenesTest.java index f55e1d425da..f3a1dc6db00 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StructuralVariantGenesTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StructuralVariantGenesTest.java @@ -37,7 +37,7 @@ public class StructuralVariantGenesTest extends AbstractTestcontainers { public void getStructuralVariantGenes() { StudyViewFilter studyViewFilter = new StudyViewFilter(); studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB, STUDY_ACC_TCGA)); - var alterationCountByGenes = studyViewMapper.getStructuralVariantGenes(StudyViewFilterHelper.build(studyViewFilter, null, null), + var alterationCountByGenes = studyViewMapper.getStructuralVariantGenes(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), AlterationFilterHelper.build(studyViewFilter.getAlterationFilter())); assertEquals(8, alterationCountByGenes.size()); diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewCaseListSamplesCountsTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewCaseListSamplesCountsTest.java index 551eaa30b19..66d72a34a88 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewCaseListSamplesCountsTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewCaseListSamplesCountsTest.java @@ -45,7 +45,7 @@ public void getMolecularProfileCounts() { studyViewFilter.setCaseLists(caseListGroups); - var sampleListCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null) ); + var sampleListCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()) ); var size = sampleListCounts.stream().filter(gc->gc.getValue().equals("mrna")) .findFirst().get().getCount().intValue(); @@ -63,7 +63,7 @@ public void getMolecularProfileCountsMultipleListsOr() { studyViewFilter.setCaseLists(caseListGroups); - var sampleListCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null) ); + var sampleListCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()) ); var size = sampleListCounts.stream().filter(gc->gc.getValue().equals("mrna")) .findFirst().get().getCount().intValue(); @@ -82,7 +82,7 @@ public void getMolecularProfileCountsMultipleListsAnd() { studyViewFilter.setCaseLists(caseListGroups); - var sampleListCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null) ); + var sampleListCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()) ); var size = sampleListCounts.stream().filter(gc->gc.getValue().equals("mrna")) .findFirst().get().getCount().intValue(); @@ -100,7 +100,7 @@ public void getMolecularProfileCountsAcrossStudies() { studyViewFilter.setCaseLists(caseListGroups); - var unMergedCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null) ); + var unMergedCounts = studyViewMapper.getCaseListDataCountsPerStudy(StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()) ); var caseListCountsMerged = StudyViewColumnarServiceUtil.mergeCaseListCounts( unMergedCounts diff --git a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperClinicalDataCountTest.java b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperClinicalDataCountTest.java index b34976d897e..a0f5fb67772 100644 --- a/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperClinicalDataCountTest.java +++ b/src/test/java/org/cbioportal/persistence/mybatisclickhouse/StudyViewMapperClinicalDataCountTest.java @@ -42,7 +42,7 @@ public void getMutationCounts() { studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB)); var clinicalDataCountItems = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("mutation_count"), Collections.emptyList() ); @@ -69,7 +69,7 @@ public void getCenterCounts() { studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB)); var clinicalDataCounts = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("center"), Collections.emptyList() ); @@ -97,7 +97,7 @@ public void getDeadCounts() { studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB)); var clinicalDataCounts = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("dead"), Collections.emptyList() ); @@ -124,7 +124,7 @@ public void getMutationAndCenterCounts() { studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB)); var combinedClinicalDataCounts = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("mutation_count", "center"), Collections.emptyList() ); @@ -138,7 +138,7 @@ public void getAgeCounts() { studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB)); var clinicalDataCountItems = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("age"), Collections.emptyList() ); @@ -161,7 +161,7 @@ public void getAgeCountsForMultipleStudies() { studyViewFilter.setStudyIds(List.of(STUDY_GENIE_PUB, STUDY_ACC_TCGA)); var clinicalDataCountItems = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("age"), Collections.emptyList() ); @@ -211,7 +211,7 @@ public void getMutationCountsFilteredByAge() { studyViewFilter.setClinicalDataFilters(List.of(filter)); var clinicalDataCountItems = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("mutation_count"), Collections.emptyList() ); @@ -239,7 +239,7 @@ public void getMutationCountsFilteredByAgeWithOpenStartValues() { studyViewFilter.setClinicalDataFilters(List.of(filter)); var clinicalDataCountItems = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("mutation_count"), Collections.emptyList() ); @@ -271,7 +271,7 @@ public void getMutationCountsFilteredByAgeWithOpenEndValues() { studyViewFilter.setClinicalDataFilters(List.of(filter)); var clinicalDataCountItems = studyViewMapper.getClinicalDataCounts( - StudyViewFilterHelper.build(studyViewFilter, null, null), + StudyViewFilterHelper.build(studyViewFilter, null, null, studyViewFilter.getStudyIds()), List.of("mutation_count"), Collections.emptyList() );