Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back custom driver tests #11249

Open
wants to merge 1 commit into
base: demo-rfc80-poc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/main/resources/db-scripts/clickhouse/clickhouse.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,17 @@ SELECT concat(cs.cancer_study_identifier, '_', sample.stable_id) AS sample_uniqu
me.protein_change AS mutation_variant,
me.mutation_type AS mutation_type,
mutation.mutation_status AS mutation_status,
'NA' AS driver_filter,
ada.driver_filter AS driver_filter,
'NA' AS drivet_tiers_filter,
NULL AS cna_alteration,
'' AS cna_cytoband,
'' AS sv_event_info,
concat(cs.cancer_study_identifier, '_', patient.stable_id) AS patient_unique_id
FROM mutation
INNER JOIN alteration_driver_annotation ada
ON mutation.mutation_event_id = ada.alteration_event_id
AND mutation.sample_id = ada.sample_id
AND mutation.genetic_profile_id = ada.genetic_profile_id
INNER JOIN mutation_event AS me ON mutation.mutation_event_id = me.mutation_event_id
INNER JOIN sample_profile sp
ON mutation.sample_id = sp.sample_id AND mutation.genetic_profile_id = sp.genetic_profile_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,42 @@ public void getCnaGenesWithAlterationFilter() {
.mapToInt(c -> c.getTotalCount().intValue())
.sum();
assertEquals(2, testAKT1AlterationCount);

// Testing custom driver filter
AlterationFilter onlyDriverFilter = new AlterationFilter();
onlyDriverFilter.setIncludeDriver(true);
onlyDriverFilter.setIncludeVUS(false);
onlyDriverFilter.setIncludeUnknownOncogenicity(false);

var alterationCountByGenes1 = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyDriverFilter));
assertEquals(0, alterationCountByGenes1.size());

AlterationFilter onlyVUSFilter = new AlterationFilter();
onlyVUSFilter.setIncludeDriver(false);
onlyVUSFilter.setIncludeVUS(true);
onlyVUSFilter.setIncludeUnknownOncogenicity(false);

var alterationCountByGenes2 = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyVUSFilter));
assertEquals(0, alterationCountByGenes2.size());

AlterationFilter onlyUnknownOncogenicityFilter = new AlterationFilter();
onlyUnknownOncogenicityFilter.setIncludeDriver(false);
onlyUnknownOncogenicityFilter.setIncludeVUS(false);
onlyUnknownOncogenicityFilter.setIncludeUnknownOncogenicity(true);

var alterationCountByGenes3 = studyViewMapper.getCnaGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyUnknownOncogenicityFilter));
assertEquals(3, alterationCountByGenes3.size());

var akt1AlteredCounts3 = alterationCountByGenes3.stream().filter(c -> c.getHugoGeneSymbol().equals("AKT1"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(2, akt1AlteredCounts3);
var akt2AlteredCounts3 = alterationCountByGenes3.stream().filter(c -> c.getHugoGeneSymbol().equals("AKT2"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(1, akt2AlteredCounts3);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,59 @@ public void getMutatedGenesWithAlterationFilter() {
var alterationCountByGenes2 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyMutationStatusFilter));
assertEquals(1, alterationCountByGenes2.size());

// Testing custom driver filter
AlterationFilter onlyDriverFilter = new AlterationFilter();
onlyDriverFilter.setIncludeDriver(true);
onlyDriverFilter.setIncludeVUS(false);
onlyDriverFilter.setIncludeUnknownOncogenicity(false);

var alterationCountByGenes3 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyDriverFilter));
assertEquals(2, alterationCountByGenes3.size());

var akt1AlteredCounts3 = alterationCountByGenes3.stream().filter(c -> c.getHugoGeneSymbol().equals("AKT1"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(1, akt1AlteredCounts3);
var akt2AlteredCounts3 = alterationCountByGenes3.stream().filter(c -> c.getHugoGeneSymbol().equals("AKT2"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(0, akt2AlteredCounts3);
var brca1AlteredCounts3 = alterationCountByGenes3.stream().filter(c -> c.getHugoGeneSymbol().equals("BRCA1"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(3, brca1AlteredCounts3);

AlterationFilter onlyVUSFilter = new AlterationFilter();
onlyVUSFilter.setIncludeDriver(false);
onlyVUSFilter.setIncludeVUS(true);
onlyVUSFilter.setIncludeUnknownOncogenicity(false);

var alterationCountByGenes4 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyVUSFilter));
assertEquals(3, alterationCountByGenes4.size());

var akt1AlteredCounts4 = alterationCountByGenes4.stream().filter(c -> c.getHugoGeneSymbol().equals("AKT1"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(1, akt1AlteredCounts4);
var akt2AlteredCounts4 = alterationCountByGenes4.stream().filter(c -> c.getHugoGeneSymbol().equals("AKT2"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(1, akt2AlteredCounts4);
var brca1AlteredCounts4 = alterationCountByGenes4.stream().filter(c -> c.getHugoGeneSymbol().equals("BRCA1"))
.mapToInt(c -> c.getNumberOfAlteredCases().intValue())
.sum();
assertEquals(2, brca1AlteredCounts4);

AlterationFilter onlyUnknownOncogenicityFilter = new AlterationFilter();
onlyUnknownOncogenicityFilter.setIncludeDriver(false);
onlyUnknownOncogenicityFilter.setIncludeVUS(false);
onlyUnknownOncogenicityFilter.setIncludeUnknownOncogenicity(true);

var alterationCountByGenes5 = studyViewMapper.getMutatedGenes(StudyViewFilterHelper.build(studyViewFilter, null, null),
AlterationFilterHelper.build(onlyUnknownOncogenicityFilter));
assertEquals(0, alterationCountByGenes5.size());
}
}
Loading