Skip to content

Commit

Permalink
Demo rfc80 poc genomic data filter tests (#11036)
Browse files Browse the repository at this point in the history
* add genomic data filter tests testing for missing NAs
* add NA genomic data filter tests

---------

Co-authored-by: Bryan Lai <[email protected]>
  • Loading branch information
2 people authored and fuzhaoyuan committed Oct 2, 2024
1 parent c725df9 commit 3a8536d
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package org.cbioportal.persistence.mybatisclickhouse;

import org.cbioportal.model.ClinicalDataCount;
import org.cbioportal.model.GenomicDataCount;
import org.cbioportal.model.GenomicDataCountItem;
import org.cbioportal.persistence.helper.StudyViewFilterHelper;
import org.cbioportal.persistence.mybatisclickhouse.config.MyBatisConfig;
import org.cbioportal.web.parameter.DataFilterValue;
import org.cbioportal.web.parameter.GenomicDataBinFilter;
import org.cbioportal.web.parameter.GenomicDataFilter;
import org.cbioportal.web.parameter.StudyViewFilter;
import org.junit.Test;
Expand Down Expand Up @@ -108,4 +111,66 @@ public void getMutationCountsByType() {
.ignoringCollectionOrder()
.isEqualTo(expectedMutationCountsByType);
}

@Test
public void getProteinExpressionCounts() {
// Testing combined study missing samples when one lacks a relevant genomic profile
StudyViewFilter studyViewFilter = new StudyViewFilter();
studyViewFilter.setStudyIds(List.of(STUDY_TCGA_PUB, STUDY_ACC_TCGA));

GenomicDataBinFilter genomicDataBinFilterRPPA = new GenomicDataBinFilter();
genomicDataBinFilterRPPA.setHugoGeneSymbol("AKT1");
genomicDataBinFilterRPPA.setProfileType("rppa");

List<ClinicalDataCount> actualRPPACounts1 = studyViewMapper.getGenomicDataBinCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataBinFilterRPPA));

ClinicalDataCount expectedRPPACount1 = new ClinicalDataCount();
expectedRPPACount1.setAttributeId("AKT1rppa");
expectedRPPACount1.setValue("0.7360");
expectedRPPACount1.setCount(1);
ClinicalDataCount expectedRPPACount2 = new ClinicalDataCount();
expectedRPPACount2.setAttributeId("AKT1rppa");
expectedRPPACount2.setValue("-0.8097");
expectedRPPACount2.setCount(1);
ClinicalDataCount expectedRPPACount3 = new ClinicalDataCount();
expectedRPPACount3.setAttributeId("AKT1rppa");
expectedRPPACount3.setValue("-0.1260");
expectedRPPACount3.setCount(1);
ClinicalDataCount expectedRPPACountNA = new ClinicalDataCount();
expectedRPPACountNA.setAttributeId("AKT1rppa");
expectedRPPACountNA.setValue("NA");
expectedRPPACountNA.setCount(16);

List<ClinicalDataCount> expectedRPPACounts1 = List.of(
expectedRPPACount1, expectedRPPACount2, expectedRPPACount3, expectedRPPACountNA
);
assertThat(actualRPPACounts1)
.usingRecursiveComparison()
.ignoringCollectionOrder()
.isEqualTo(expectedRPPACounts1);


// Testing NA filtering on combined study missing samples when one lacks a relevant genomic profile
// Make genomic data filter to put in study view filter
GenomicDataFilter genomicDataFilterRPPA = new GenomicDataFilter("AKT1", "rppa");
DataFilterValue dataFilterValue = new DataFilterValue();
dataFilterValue.setValue("NA");
genomicDataFilterRPPA.setValues(List.of(dataFilterValue));
studyViewFilter.setGenomicDataFilters(List.of(genomicDataFilterRPPA));

List<ClinicalDataCount> actualRPPACounts2 = studyViewMapper.getGenomicDataBinCounts(StudyViewFilterHelper.build(studyViewFilter, null, null), List.of(genomicDataBinFilterRPPA));

ClinicalDataCount expectedRPPACount = new ClinicalDataCount();
expectedRPPACount.setAttributeId("AKT1rppa");
expectedRPPACount.setValue("NA");
expectedRPPACount.setCount(16);

List<ClinicalDataCount> expectedRPPACounts2 = List.of(
expectedRPPACount
);
assertThat(actualRPPACounts2)
.usingRecursiveComparison()
.ignoringCollectionOrder()
.isEqualTo(expectedRPPACounts2);
}
}
5 changes: 4 additions & 1 deletion src/test/resources/clickhouse_data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ insert into genetic_profile (genetic_profile_id,stable_id,cancer_study_id,geneti
insert into genetic_profile (genetic_profile_id,stable_id,cancer_study_id,genetic_alteration_type,datatype,name,description,show_profile_in_analysis_tab,generic_assay_type) values (11,'study_tcga_pub_treatment_ic50',1,'generic_assay','ic50','treatment ic50 values','treatment response ic50 values',1,'treatment_response');
insert into genetic_profile (genetic_profile_id,stable_id,cancer_study_id,genetic_alteration_type,datatype,name,description,show_profile_in_analysis_tab,generic_assay_type) values (12,'study_tcga_pub_mutational_signature',1,'generic_assay','limit-value','mutational_signature values','mutational_signature values',1,'mutational_signature');
insert into genetic_profile (genetic_profile_id,stable_id,cancer_study_id,genetic_alteration_type,datatype,name,description,show_profile_in_analysis_tab) values (14,'study_tcga_pub_cna',1,'COPY_NUMBER_ALTERATION','discrete','Copy-number alterations','Copy number alterations (amplifications and deletions) from targeted sequencing.',1);
insert into genetic_profile (genetic_profile_id,stable_id,cancer_study_id,genetic_alteration_type,datatype,name,description,show_profile_in_analysis_tab) values (15,'study_tcga_pub_rppa',1,'PROTEIN_LEVEL','log2-value','Protein expression (RPPA)','Protein expression measured by reverse-phase protein array',0);

insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (2,'1,2,3,4,5,6,7,8,9,10,11,12,13,14,');
insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (3,'2,3,6,8,9,10,12,13,');
insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (4,'1,2,3,4,5,6,7,8,9,10,11,12,13,14,');
insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (5,'2,');
insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (11,'1,2,3,4,5,6,7,8,9,10,11,12,13,14,');
insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (14,'1,2,3,4,5,6,7,8,9,10,11,12,');
insert into genetic_profile_samples (genetic_profile_id,ordered_sample_list) values (15,'1,2,3,4,');

insert into patient (internal_id,stable_id,cancer_study_id) values (1,'tcga-a1-a0sb',1);
insert into patient (internal_id,stable_id,cancer_study_id) values (2,'tcga-a1-a0sd',1);
Expand Down Expand Up @@ -638,4 +640,5 @@ insert into generic_entity_properties (id,genetic_entity_id,name,value) values (

insert into genetic_alteration (genetic_profile_id,genetic_entity_id,`values`) values (12,28,'-0.0670,-0.6270,-1.2266,-1.2079,-1.2262,0.6962,-0.3338,-0.1260,0.7559,-1.1267,-0.5893,-1.1506,-1.0027,-1.3157,');
insert into genetic_alteration (genetic_profile_id,genetic_entity_id,`values`) values (12,29,'1.0106,-0.0662,-0.8585,-1.6576,-0.3552,-0.8306,0.8102,0.1106,0.3098,0.0309,0.0927,-0.8665,-0.0750,-0.7221,');
insert into genetic_alteration (genetic_profile_id,genetic_entity_id,`values`) values (14,1,'1,-1,NA,2,0,-2,1,NA,-1,0,2,-2,');
insert into genetic_alteration (genetic_profile_id,genetic_entity_id,`values`) values (14,1,'1,-1,NA,2,0,-2,1,NA,-1,0,2,-2,');
insert into genetic_alteration (genetic_profile_id,genetic_entity_id,`values`) values (15,1,'-0.8097,0.7360,-0.1260,NA,');

0 comments on commit 3a8536d

Please sign in to comment.