IndicatorUtils { public static IndicatorQueryResp processQuery(Query query, Set<LevelOfEvidence> levels, Boolean highestLevelOnly, Set<EvidenceType> evidenceTypes) { highestLevelOnly = highestLevelOnly == null ? false : highestLevelOnly; levels = levels == null ? LevelUtils.getPublicLevels() : new HashSet<>(CollectionUtils.intersection(levels, LevelUtils.getPublicLevels())); Set<EvidenceType> selectedTreatmentEvidence = new HashSet<>(); if (evidenceTypes == null || evidenceTypes.isEmpty()) { evidenceTypes = new HashSet<>(EvidenceTypeUtils.getAllEvidenceTypes()); selectedTreatmentEvidence = EvidenceTypeUtils.getTreatmentEvidenceTypes(); } else { selectedTreatmentEvidence = Sets.intersection(evidenceTypes, EvidenceTypeUtils.getTreatmentEvidenceTypes()); } boolean hasTreatmentEvidence = !selectedTreatmentEvidence.isEmpty(); boolean hasDiagnosticImplicationEvidence = evidenceTypes.contains(EvidenceType.DIAGNOSTIC_IMPLICATION); boolean hasPrognosticImplicationEvidence = evidenceTypes.contains(EvidenceType.PROGNOSTIC_IMPLICATION); boolean hasOncogenicEvidence = evidenceTypes.contains(EvidenceType.ONCOGENIC); boolean hasMutationEffectEvidence = evidenceTypes.contains(EvidenceType.MUTATION_EFFECT); IndicatorQueryResp indicatorQuery = new IndicatorQueryResp(); indicatorQuery.setQuery(query); Gene gene = null; List<Alteration> relevantAlterations = new ArrayList<>(); Set<Evidence> allQueryRelatedEvidences = new HashSet<>(); Alteration alteration; if (query == null) { return indicatorQuery; } query.enrich(); if (!com.mysql.jdbc.StringUtils.isNullOrEmpty(query.getAlteration()) && query.getAlteration().equals("EGFRvIII")) { query.setAlteration("vIII"); } if (StringUtils.containsIgnoreCase(query.getAlteration(), "intragenic")) { query.setAlterationType(AlterationType.STRUCTURAL_VARIANT.name()); query.setSvType(StructuralVariantType.DELETION); query.setAlteration(""); } Boolean isStructuralVariantEvent = false; AlterationType alterationType = AlterationType.getByName(query.getAlterationType()); Map<String, Object> fusionGeneAltsMap = new HashMap<>(); if (query.getHugoSymbol() != null && alterationType != null && alterationType.equals(AlterationType.FUSION)) { isStructuralVariantEvent = true; fusionGeneAltsMap = findFusionGeneAndRelevantAlts(query); if (query.getSvType() != null && query.getSvType().equals(StructuralVariantType.DELETION)) { Set<String> queryFusionGenes = (Set<String>) fusionGeneAltsMap.get("queryFusionGenes"); if (queryFusionGenes.size() == 1) { Gene queryFusionGene = GeneUtils.getGeneByHugoSymbol(queryFusionGenes.iterator().next()); if (queryFusionGene != null) { Alteration deletion = AlterationUtils.findAlteration(queryFusionGene, query.getReferenceGenome(), "Deletion"); if (deletion != null) { query.setAlteration("deletion"); query.setConsequence("feature_truncation"); fusionGeneAltsMap = findFusionGeneAndRelevantAlts(query); } } } } gene = (Gene) fusionGeneAltsMap.get("pickedGene"); relevantAlterations = (List<Alteration>) fusionGeneAltsMap.get("relevantAlts"); Set<Gene> allGenes = (LinkedHashSet<Gene>) fusionGeneAltsMap.get("allGenes"); } else if (alterationType != null && alterationType.equals(AlterationType.STRUCTURAL_VARIANT)) { isStructuralVariantEvent = true; VariantConsequence variantConsequence = VariantConsequenceUtils.findVariantConsequenceByTerm(query.getConsequence()); Boolean isFunctionalFusion = variantConsequence != null && variantConsequence.getTerm().equals("fusion"); if (isFunctionalFusion || !com.mysql.jdbc.StringUtils.isNullOrEmpty(query.getAlteration())) { fusionGeneAltsMap = findFusionGeneAndRelevantAlts(query); gene = (Gene) fusionGeneAltsMap.get("pickedGene"); relevantAlterations = (List<Alteration>) fusionGeneAltsMap.get("relevantAlts"); } else { query.setAlteration("truncating mutation"); query.setConsequence("feature_truncation"); fusionGeneAltsMap = findFusionGeneAndRelevantAlts(query); if (query.getSvType() != null && query.getSvType().equals(StructuralVariantType.DELETION)) { Set<String> queryFusionGenes = (Set<String>) fusionGeneAltsMap.get("queryFusionGenes"); if (queryFusionGenes.size() == 1) { Gene queryFusionGene = GeneUtils.getGeneByHugoSymbol(queryFusionGenes.iterator().next()); if (queryFusionGene != null) { Alteration deletion = AlterationUtils.findAlteration(queryFusionGene, query.getReferenceGenome(), "Deletion"); if (deletion != null) { query.setAlteration("deletion"); fusionGeneAltsMap = findFusionGeneAndRelevantAlts(query); } } } } gene = (Gene) fusionGeneAltsMap.get("pickedGene"); fusionGeneAltsMap = new HashMap<>(); Alteration truncatingMutations = AlterationUtils.getTruncatingMutations(gene); if (truncatingMutations != null && !relevantAlterations.contains(truncatingMutations)) { relevantAlterations.add(truncatingMutations); List<Alteration> truncMutRelevants = AlterationUtils.getRelevantAlterations(query.getReferenceGenome(), truncatingMutations); for (Alteration alt : truncMutRelevants) { if (!relevantAlterations.contains(alt)) { relevantAlterations.add(alt); } } } } } else { gene = GeneUtils.getGene(query.getEntrezGeneId(), query.getHugoSymbol()); if (gene != null) { Alteration alt = AlterationUtils.getAlteration(gene.getHugoSymbol(), query.getAlteration(), null, query.getConsequence(), query.getProteinStart(), query.getProteinEnd()); AlterationUtils.annotateAlteration(alt, alt.getAlteration()); relevantAlterations = AlterationUtils.getRelevantAlterations(query.getReferenceGenome(), alt); } } if (fusionGeneAltsMap.containsKey("hasRelevantAltsGenes")) { TreeSet<IndicatorQueryResp> result = new TreeSet<>(new IndicatorQueryRespComp()); for (Gene tmpGene : (List<Gene>) fusionGeneAltsMap.get("hasRelevantAltsGenes")) { Query tmpQuery = new Query(query.getId(), query.getReferenceGenome(), query.getType(), tmpGene.getEntrezGeneId(), tmpGene.getHugoSymbol(), query.getAlteration(), null, query.getSvType(), query.getTumorType(), query.getConsequence(), query.getProteinStart(), query.getProteinEnd(), query.getHgvs()); result.add(IndicatorUtils.processQuery(tmpQuery, levels, highestLevelOnly, evidenceTypes)); } return result.iterator().next(); } if (gene != null) { query.setHugoSymbol(gene.getHugoSymbol()); query.setEntrezGeneId(gene.getEntrezGeneId()); indicatorQuery.setGeneExist(gene.getEntrezGeneId() > 0); if (evidenceTypes.contains(EvidenceType.GENE_SUMMARY)) { indicatorQuery.setGeneSummary(SummaryUtils.geneSummary(gene)); allQueryRelatedEvidences.addAll(EvidenceUtils.getEvidenceByGeneAndEvidenceTypes(gene, Collections.singleton(EvidenceType.GENE_SUMMARY))); } alteration = AlterationUtils.getAlteration(gene.getHugoSymbol(), query.getAlteration(), null, query.getConsequence(), query.getProteinStart(), query.getProteinEnd()); AlterationUtils.annotateAlteration(alteration, alteration.getAlteration()); List<Alteration> nonVUSRelevantAlts = AlterationUtils.excludeVUS(relevantAlterations); Map<String, LevelOfEvidence> highestLevels = new HashMap<>(); List<TumorType> relevantUpwardTumorTypes = new ArrayList<>(); List<TumorType> relevantDownwardTumorTypes = new ArrayList<>(); Alteration matchedAlt = null; LinkedHashSet<Alteration> matchedAlterations = AlterationUtils.findMatchedAlterations(query.getReferenceGenome(), alteration); if (matchedAlterations.size() > 1) { matchedAlt = pickMatchedAlteration(new ArrayList<>(matchedAlterations), query, levels, highestLevelOnly, evidenceTypes); } else if (matchedAlterations.size() == 1) { matchedAlt = matchedAlterations.iterator().next(); } if (matchedAlt == null && isStructuralVariantEvent) { matchedAlt = AlterationUtils.getRevertFusions(query.getReferenceGenome(), alteration); } indicatorQuery.setVariantExist(matchedAlt != null); if(matchedAlt == null) { matchedAlt = alteration; } List<Alteration> alleles = AlterationUtils.getAlleleAlterations(query.getReferenceGenome(), matchedAlt); List<Alteration> relevantAlterationsWithoutAlternativeAlleles = new ArrayList<>(relevantAlterations); AlterationUtils.removeAlternativeAllele(query.getReferenceGenome(), matchedAlt, relevantAlterationsWithoutAlternativeAlleles); if (query.getProteinEnd() == null || query.getProteinStart() == null) { indicatorQuery.setHotspot(HotspotUtils.isHotspot(matchedAlt)); } else { indicatorQuery.setHotspot(HotspotUtils.isHotspot(matchedAlt)); } if (query.getTumorType() != null) { relevantUpwardTumorTypes = TumorTypeUtils.getMappedOncoTreeTypesBySource(query.getTumorType()); } relevantDownwardTumorTypes = TumorTypeUtils.findTumorTypes(query.getTumorType(), RelevantTumorTypeDirection.DOWNWARD); indicatorQuery.setVUS(isVUS(matchedAlt)); if (indicatorQuery.getVUS()) { List<Evidence> vusEvidences = EvidenceUtils.getEvidence(Collections.singletonList(matchedAlt), Collections.singleton(EvidenceType.VUS), null); if (vusEvidences != null) { allQueryRelatedEvidences.addAll(vusEvidences); } } if (alleles == null || alleles.size() == 0) { indicatorQuery.setAlleleExist(false); } else { indicatorQuery.setAlleleExist(true); } Set<Evidence> treatmentEvidences = new HashSet<>(); if (nonVUSRelevantAlts.size() > 0) { if (hasOncogenicEvidence) { IndicatorQueryOncogenicity indicatorQueryOncogenicity = getOncogenicity(matchedAlt, alleles, nonVUSRelevantAlts); if (indicatorQueryOncogenicity.getOncogenicityEvidence() != null) { allQueryRelatedEvidences.add(indicatorQueryOncogenicity.getOncogenicityEvidence()); } if (indicatorQuery.getOncogenic() == null && indicatorQueryOncogenicity.getOncogenicity() != null) { indicatorQuery.setOncogenic(indicatorQueryOncogenicity.getOncogenicity().getOncogenic()); } } if (hasMutationEffectEvidence) { IndicatorQueryMutationEffect indicatorQueryMutationEffect = getMutationEffect(matchedAlt, alleles, nonVUSRelevantAlts); if (indicatorQueryMutationEffect.getMutationEffectEvidence() != null) { allQueryRelatedEvidences.add(indicatorQueryMutationEffect.getMutationEffectEvidence()); } if (indicatorQuery.getMutationEffect() == null && indicatorQueryMutationEffect.getMutationEffect() != null) { MutationEffectResp mutationEffectResp = new MutationEffectResp(); mutationEffectResp.setKnownEffect(indicatorQueryMutationEffect.getMutationEffect().getMutationEffect()); if (indicatorQueryMutationEffect.getMutationEffectEvidence() != null) { mutationEffectResp.setDescription(indicatorQueryMutationEffect.getMutationEffectEvidence().getDescription()); mutationEffectResp.setCitations(MainUtils.getCitationsByEvidence(indicatorQueryMutationEffect.getMutationEffectEvidence())); } indicatorQuery.setMutationEffect(mutationEffectResp); } } if (hasTreatmentEvidence) { treatmentEvidences = EvidenceUtils.keepHighestLevelForSameTreatments( EvidenceUtils.getRelevantEvidences(query, matchedAlt, selectedTreatmentEvidence, levels, relevantAlterationsWithoutAlternativeAlleles, alleles), query.getReferenceGenome(), matchedAlt); } if (hasDiagnosticImplicationEvidence) { indicatorQuery.setDiagnosticImplications(getImplications(matchedAlt, alleles, relevantAlterationsWithoutAlternativeAlleles, EvidenceType.DIAGNOSTIC_IMPLICATION, new HashSet<>(relevantDownwardTumorTypes))); if (indicatorQuery.getDiagnosticImplications().size() > 0) { indicatorQuery.setHighestDiagnosticImplicationLevel(LevelUtils.getHighestDiagnosticImplicationLevel(indicatorQuery.getDiagnosticImplications().stream().map(implication -> implication.getLevelOfEvidence()).collect(Collectors.toSet()))); } } if (hasPrognosticImplicationEvidence) { indicatorQuery.setPrognosticImplications(getImplications(matchedAlt, alleles, relevantAlterationsWithoutAlternativeAlleles, EvidenceType.PROGNOSTIC_IMPLICATION, new HashSet<>(relevantUpwardTumorTypes))); if (indicatorQuery.getPrognosticImplications().size() > 0) { indicatorQuery.setHighestPrognosticImplicationLevel(LevelUtils.getHighestPrognosticImplicationLevel(indicatorQuery.getPrognosticImplications().stream().map(implication -> implication.getLevelOfEvidence()).collect(Collectors.toSet()))); } } } if (indicatorQuery.getHotspot() && !MainUtils.isValidHotspotOncogenicity(Oncogenicity.getByEffect(indicatorQuery.getOncogenic()))) { indicatorQuery.setOncogenic(Oncogenicity.PREDICTED.getOncogenic()); Alteration oncogenicMutation = AlterationUtils.findAlteration(gene, query.getReferenceGenome(), "Oncogenic Mutations"); if (oncogenicMutation != null) { relevantAlterations.add(oncogenicMutation); if (hasTreatmentEvidence) { treatmentEvidences.addAll(EvidenceUtils.keepHighestLevelForSameTreatments( EvidenceUtils.convertEvidenceLevel( EvidenceUtils.getEvidence(Collections.singletonList(oncogenicMutation), selectedTreatmentEvidence, levels), new HashSet<>(relevantUpwardTumorTypes)), query.getReferenceGenome(), matchedAlt)); } } } if (hasTreatmentEvidence && treatmentEvidences != null && !treatmentEvidences.isEmpty()) { if (highestLevelOnly) { Set<Evidence> filteredEvis = new HashSet<>(); Set<Evidence> sensitiveEvidences = EvidenceUtils.getSensitiveEvidences(treatmentEvidences); filteredEvis.addAll(EvidenceUtils.getOnlySignificantLevelsEvidences(sensitiveEvidences)); Set<Evidence> resistanceEvidences = EvidenceUtils.getResistanceEvidences(treatmentEvidences); filteredEvis.addAll(EvidenceUtils.getOnlyHighestLevelEvidences(resistanceEvidences, query.getReferenceGenome(), matchedAlt)); treatmentEvidences = filteredEvis; } if (!treatmentEvidences.isEmpty()) { List<IndicatorQueryTreatment> treatments = getIndicatorQueryTreatments(treatmentEvidences); if (gene.getHugoSymbol().equals("KIT")) { CustomizeComparator.sortKitTreatment(treatments); } indicatorQuery.setTreatments(treatments); highestLevels = findHighestLevel(new HashSet<>(treatments)); indicatorQuery.setHighestSensitiveLevel(highestLevels.get("sensitive")); indicatorQuery.setHighestResistanceLevel(highestLevels.get("resistant")); indicatorQuery.setOtherSignificantSensitiveLevels(getOtherSignificantLevels(indicatorQuery.getHighestSensitiveLevel(), "sensitive", treatmentEvidences)); indicatorQuery.setOtherSignificantResistanceLevels(getOtherSignificantLevels(indicatorQuery.getHighestResistanceLevel(), "resistance", treatmentEvidences)); allQueryRelatedEvidences.addAll(treatmentEvidences); } } if (evidenceTypes.contains(EvidenceType.TUMOR_TYPE_SUMMARY) && query.getTumorType() != null) { Map<String, Object> tumorTypeSummary = SummaryUtils.tumorTypeSummary(EvidenceType.TUMOR_TYPE_SUMMARY, gene, query, matchedAlt, new ArrayList<>(relevantAlterationsWithoutAlternativeAlleles), relevantUpwardTumorTypes); if (tumorTypeSummary != null) { indicatorQuery.setTumorTypeSummary((String) tumorTypeSummary.get("summary")); Date lateEdit = tumorTypeSummary.get("lastEdit") == null ? null : (Date) tumorTypeSummary.get("lastEdit"); if (lateEdit != null) { Evidence lastEditTTSummary = new Evidence(); lastEditTTSummary.setLastEdit(lateEdit); allQueryRelatedEvidences.add(lastEditTTSummary); } } } if (evidenceTypes.contains(EvidenceType.MUTATION_SUMMARY)) { indicatorQuery.setVariantSummary(SummaryUtils.variantSummary(gene, matchedAlt, new ArrayList<>(relevantAlterations), query)); } if (evidenceTypes.contains(EvidenceType.DIAGNOSTIC_SUMMARY)) { Map<String, Object> diagnosticSummary = SummaryUtils.tumorTypeSummary(EvidenceType.DIAGNOSTIC_SUMMARY, gene, query, matchedAlt, new ArrayList<>(relevantAlterationsWithoutAlternativeAlleles), relevantUpwardTumorTypes); if (diagnosticSummary != null) { indicatorQuery.setDiagnosticSummary((String) diagnosticSummary.get("summary")); Date lateEdit = diagnosticSummary.get("lastEdit") == null ? null : (Date) diagnosticSummary.get("lastEdit"); if (lateEdit != null) { Evidence lastEditTTSummary = new Evidence(); lastEditTTSummary.setLastEdit(lateEdit); allQueryRelatedEvidences.add(lastEditTTSummary); } } } if (evidenceTypes.contains(EvidenceType.PROGNOSTIC_SUMMARY)) { Map<String, Object> prognosticSummary = SummaryUtils.tumorTypeSummary(EvidenceType.PROGNOSTIC_SUMMARY, gene, query, matchedAlt, new ArrayList<>(relevantAlterationsWithoutAlternativeAlleles), relevantUpwardTumorTypes); if (prognosticSummary != null) { indicatorQuery.setPrognosticSummary((String) prognosticSummary.get("summary")); Date lateEdit = prognosticSummary.get("lastEdit") == null ? null : (Date) prognosticSummary.get("lastEdit"); if (lateEdit != null) { Evidence lastEditTTSummary = new Evidence(); lastEditTTSummary.setLastEdit(lateEdit); allQueryRelatedEvidences.add(lastEditTTSummary); } } } if (gene != null && (gene.getHugoSymbol().equals("KRAS") || gene.getHugoSymbol().equals("NRAS")) && query.getAlteration() != null && StringUtils.containsIgnoreCase(query.getAlteration(), "wildtype")) { if (relevantUpwardTumorTypes.contains(TumorTypeUtils.getOncoTreeCancerType("Colorectal Cancer"))) { indicatorQuery.setGeneSummary("RAS (KRAS/NRAS) which is wildtype (not mutated) in this sample, encodes an upstream activator of the pro-oncogenic MAP- and PI3-kinase pathways and is mutated in approximately 40% of late stage colorectal cancers."); indicatorQuery.setVariantSummary("The absence of a mutation in the RAS genes is clinically important because it expands approved treatments available to treat this tumor. RAS status in stage IV colorectal cancer influences patient responses to the anti-EGFR antibody therapies cetuximab and panitumumab."); indicatorQuery.setTumorTypeSummary("These drugs are FDA-approved for the treatment of KRAS wildtype colorectal tumors together with chemotherapy or alone following progression through standard chemotherapy."); } else { indicatorQuery.setVariantSummary(""); indicatorQuery.setTumorTypeSummary(""); indicatorQuery.setTreatments(new ArrayList<IndicatorQueryTreatment>()); indicatorQuery.setHighestResistanceLevel(null); indicatorQuery.setHighestSensitiveLevel(null); } } } else { indicatorQuery.setGeneExist(false); } if (indicatorQuery.getMutationEffect() == null) { indicatorQuery.setMutationEffect(getDefaultMutationEffectResponse()); } indicatorQuery.setDataVersion(MainUtils.getDataVersion()); Date lastUpdate = getLatestDateFromEvidences(allQueryRelatedEvidences); indicatorQuery.setLastUpdate(lastUpdate == null ? MainUtils.getDataVersionDate() : new SimpleDateFormat("MM/dd/yyy").format(lastUpdate)); if (indicatorQuery.getOncogenic() == null) { indicatorQuery.setOncogenic(""); } return indicatorQuery; }  static IndicatorQueryResp processQuery(Query query,
                                                  Set<LevelOfEvidence> levels, Boolean highestLevelOnly,
                                                  Set<EvidenceType> evidenceTypes); static List<Implication> filterImplication(List<Implication> implications); static IndicatorQueryOncogenicity getOncogenicity(Alteration alteration, List<Alteration> alternativeAllele, List<Alteration> relevantAlterations); static Map<String, LevelOfEvidence> findHighestLevelByEvidences(Set<Evidence> treatmentEvidences); static Map<String, Object> findFusionGeneAndRelevantAlts(Query query);  }
@Test public void testProcessQuery() throws Exception { Query query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TEST", "V123M", null, null, "Pancreatic Adenocarcinoma", null, null, null, null); IndicatorQueryResp indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The geneExist in the response is not false, but it should be.", indicatorQueryResp.getGeneExist() == false); assertEquals("The oncogenicity is not empty, but it should.", "", indicatorQueryResp.getOncogenic()); assertTrue("There is treatment(s) in the response, but it should no have any.", indicatorQueryResp.getTreatments().size() == 0); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "CD74-CD74", null, "structural_variant", StructuralVariantType.DELETION, "Pancreatic Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("Gene should not exist, but it does.", false, indicatorQueryResp.getGeneExist()); assertEquals("The oncogenicity is not empty, but it should.", "", indicatorQueryResp.getOncogenic()); assertTrue("There is treatment(s) in the response, but it should no have any.", indicatorQueryResp.getTreatments().size() == 0); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "CD74-CD74", null, "structural_variant", StructuralVariantType.DELETION, "Pancreatic Adenocarcinoma", "fusion", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("Gene should not exist, but it does.", false, indicatorQueryResp.getGeneExist()); assertEquals("The oncogenicity is not empty, but it should.", "", indicatorQueryResp.getOncogenic()); assertTrue("There is treatment(s) in the response, but it should no have any.", indicatorQueryResp.getTreatments().size() == 0); SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); try { Date date = formatter.parse(indicatorQueryResp.getLastUpdate()); assertTrue("The last update should be a valid date format MM/dd/yyyy, but it is not.", date != null); } catch (ParseException e) { e.printStackTrace(); } query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "MSH2", "", null, null, "CANCER", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity is not empty, but it should.", "", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TP53", "R248Q", null, null, "Pancreatic Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity is not matched in variant summary.", "The TP53 R248Q mutation is likely oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KRAS", "V14I", null, null, "Pancreatic Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity is not matched in variant summary.", "The KRAS V14I mutation is likely oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Melanoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The geneExist in the response is not true, but it should.", indicatorQueryResp.getGeneExist() == true); assertTrue("The variantExist in the response is not true, but it should.", indicatorQueryResp.getVariantExist() == true); assertTrue("The alleleExist in the response is not true, but it should.", indicatorQueryResp.getAlleleExist() == true); assertTrue("The query is not hotspot, but it should.", indicatorQueryResp.getHotspot() == true); assertTrue("The query is VUS, but it should not be.", indicatorQueryResp.getVUS() == false); assertEquals("The oncogenicity should be 'Oncogenic'", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be 1", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); assertTrue("The highest resistance level should be null", indicatorQueryResp.getHighestResistanceLevel() == null); assertTrue("Should have no other significant level", indicatorQueryResp.getOtherSignificantSensitiveLevels().size() == 0); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "CUL1-BRAF Fusion", null, null, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The highest sensitive level of CUL1-BRAF fusion should be Level 3A", LevelOfEvidence.LEVEL_3A, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The oncogenicity of CUL1-BRAF fusion should be Likely Oncogenic", "Likely Oncogenic", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF-TMPRSS2", null, "fusion", null, "Prostate Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The highest sensitive level of CUL1-BRAF fusion should be Level 3A", LevelOfEvidence.LEVEL_3B, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The oncogenicity of BRAF-TMPRSS2 fusion should be Likely Oncogenic", "Likely Oncogenic", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "NOTCH1", "NOTCH1-intragenic", null, null, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity of NOTCH1-intragenic should be Likely Oncogenic", "Likely Oncogenic", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "NOTCH1", "NOTCH1 intragenic", null, null, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity of NOTCH1 intragenic should be Likely Oncogenic", "Likely Oncogenic", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Bladder Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The highest sensitive level should be 3B", LevelOfEvidence.LEVEL_3B, indicatorQueryResp.getHighestSensitiveLevel()); assertTrue("The highest resistance level should be null", indicatorQueryResp.getHighestResistanceLevel() == null); assertTrue(treatmentsContainLevel(indicatorQueryResp.getTreatments(), LevelOfEvidence.LEVEL_3B)); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Breast Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The highest sensitive level should be 3B", LevelOfEvidence.LEVEL_3B, indicatorQueryResp.getHighestSensitiveLevel()); assertTrue("The highest resistance level should be null", indicatorQueryResp.getHighestResistanceLevel() == null); assertTrue("Shouldn't have any significant level", indicatorQueryResp.getOtherSignificantSensitiveLevels().size() == 0); assertTrue(treatmentsContainLevel(indicatorQueryResp.getTreatments(), LevelOfEvidence.LEVEL_3B)); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "PIK3R1", "K567E", null, null, "Pancreatic Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The oncogenicity should be 'Predicted Oncogenic'", Oncogenicity.PREDICTED.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The isHotspot is not true, but it should be.", Boolean.TRUE, indicatorQueryResp.getHotspot()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ALK", "R401Q", null, null, "Colon Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The oncogenicity should not be 'Predicted Oncogenic'", "", indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The biologic significance of the ALK R401Q mutation is unknown (last reviewed 02/01/2019).", indicatorQueryResp.getVariantSummary()); assertEquals("The isHotspot is not false, but it should be.", Boolean.FALSE, indicatorQueryResp.getHotspot()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KRAS", "Q61K", null, null, "Colorectal Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The oncogenicity should be 'Likely Oncogenic'", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be 4", LevelOfEvidence.LEVEL_4, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The highest resistance level should be R1", LevelOfEvidence.LEVEL_R1, indicatorQueryResp.getHighestResistanceLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", InferredMutation.ONCOGENIC_MUTATIONS.getVariant(), null, null, "Colorectal Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The oncogenicity should be 'Unknown'", Oncogenicity.UNKNOWN.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The mutation effect is not unknown, but it should be.", MutationEffect.UNKNOWN.getMutationEffect(), indicatorQueryResp.getMutationEffect().getKnownEffect()); assertEquals("The variant summary does not match", ONCOGENIC_MUTATIONS_DEFAULT_SUMMARY, indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ALK", "I1171N", null, null, "Lung Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The oncogenicity should be 'Oncogenic'", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be 4", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The highest resistance level should be R1", LevelOfEvidence.LEVEL_R2, indicatorQueryResp.getHighestResistanceLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "C797S", null, null, "Lung Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The oncogenicity should be 'Oncogenic'", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be 4", null, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The highest resistance level should be R1", LevelOfEvidence.LEVEL_R2, indicatorQueryResp.getHighestResistanceLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "S768_V769delinsIL", null, null, "Non-Small Cell Lung Cancer", MISSENSE_VARIANT, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("Gene should exist", true, indicatorQueryResp.getGeneExist()); assertEquals("Variant should exist(mapped to S768I)", true, indicatorQueryResp.getVariantExist()); assertEquals("Is expected to be likely oncogenic", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be 1", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TMPRSS2-ERG", null, "Fusion", null, "Prostate Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("Gene should exist", true, indicatorQueryResp.getGeneExist()); assertEquals("The Oncogenicity is not YES, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be null", null, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "CDKN2A", "M1?", null, null, "Colon Adenocarcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("Gene should exist", true, indicatorQueryResp.getGeneExist()); assertEquals("The Oncogenicity is not Likely Oncogenic, but it should be.", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600K", null, null, "anaplastic thyroid cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The tumor type summary does not match.", "The RAF-targeted inhibitor dabrafenib in combination with the MEK1/2-targeted inhibitor trametinib is FDA-approved for the treatment of patients with BRAF V600E mutant anaplastic thyroid cancer (ATC), and NCCN-compendium listed for the treatment of patients with BRAF V600-mutant ATC.", indicatorQueryResp.getTumorTypeSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "PDGFRA", "D842Y", null, null, "Gastrointestinal Stromal Tumor", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("Gene should exist", true, indicatorQueryResp.getGeneExist()); assertEquals("The Oncogenicity is not Likely Oncogenic, but it should be.", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level should be 1, but it is not.", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The highest resistance level should be null, but it is not.", null, indicatorQueryResp.getHighestResistanceLevel()); assertEquals("The number of treatments should be two", 1, indicatorQueryResp.getTreatments().size()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "R462I", null, null, "Gastrointestinal Stromal Tumor", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not likely neutral, but it should be.", Oncogenicity.LIKELY_NEUTRAL.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level of BRAF R462I should be null.", null, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The highest resistance level of BRAF R462I should be null.", null, indicatorQueryResp.getHighestResistanceLevel()); assertEquals("The tumor type summary does not match.", "There are no FDA-approved or NCCN-compendium listed treatments specifically for patients with BRAF R462I mutant gastrointestinal stromal tumors.", indicatorQueryResp.getTumorTypeSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "AKT1", "P42I", null, null, "Anaplastic Astrocytoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not unknown, but it should be.", Oncogenicity.UNKNOWN.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The mutation effect is not unknown, but it should be.", MutationEffect.UNKNOWN.getMutationEffect(), indicatorQueryResp.getMutationEffect().getKnownEffect()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "EGFRvIII", null, null, "Gastrointestinal Stromal Tumor", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vIII alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "vIII", null, null, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vIII alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "vII", null, null, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vII alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "vV", null, null, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vV alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "CTD", null, null, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR C-terminal domain (CTD) alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "KDD", null, null, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR kinase domain duplication (KDD) alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); assertEquals("The highest sensitive level should be 1", LevelOfEvidence.LEVEL_3A, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "KDD", "structural_variant", StructuralVariantType.DELETION, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR kinase domain duplication (KDD) alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); assertEquals("The highest sensitive level should be 1", LevelOfEvidence.LEVEL_3A, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "kinase domain duplication", null, null, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR kinase domain duplication alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); assertEquals("The highest sensitive level should be 1", LevelOfEvidence.LEVEL_3A, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "FLT3", "ITD", null, null, "AML", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, false, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The FLT3 internal tandem duplication (ITD) alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); assertEquals("The highest sensitive level should be 1", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); assertTrue("There should be level 1 treatment in the list", treatmentsContainLevel(indicatorQueryResp.getTreatments(), LevelOfEvidence.LEVEL_1)); assertTrue("There should be level 3A treatment in the list", treatmentsContainLevel(indicatorQueryResp.getTreatments(), LevelOfEvidence.LEVEL_3A)); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR-EGFR", "vIII", "structural_variant", StructuralVariantType.DELETION, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vIII alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR-EGFR", "vIII", "structural_variant", StructuralVariantType.DELETION, "NSCLC", "", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vIII alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "vIII", "structural_variant", StructuralVariantType.DELETION, "NSCLC", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", "The EGFR vIII alteration is known to be oncogenic.", indicatorQueryResp.getVariantSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ALK", "", "structural_variant", StructuralVariantType.DELETION, "Gastrointestinal Stromal Tumor", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not empty.", "", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ALK", "", "structural_variant", StructuralVariantType.DELETION, "Gastrointestinal Stromal Tumor", "fusion", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not likely oncogenic, but it should be.", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "AKT1", "P68_C77dup", null, null, "Gastrointestinal Stromal Tumor", "In_Frame_Ins", 78, 78, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not Likely Oncogenic, but it should be.", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The isHotspot is not true, but it should be.", Boolean.TRUE, indicatorQueryResp.getHotspot()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRCA2", null, "structural_variant", StructuralVariantType.DELETION, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The mutation effect is not expected.", "Loss-of-function", indicatorQueryResp.getMutationEffect().getKnownEffect()); assertEquals("The highest level of sensitive treatment is not level 1, but it should be.", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "NTRK3", "ETV6-NTRK3", AlterationType.FUSION.label(), null, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "NTRK3", "ETV6-NTRK3", "Mutation", null, "Ovarian Cancer", "Fusion", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "PIK3CA", "C378Y", null, null, null, null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The alteration should exist.", true, indicatorQueryResp.getVariantExist()); assertEquals("The Oncogenicity is not inconclusive, but it should be.", Oncogenicity.INCONCLUSIVE.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The mutation summary does not match.", "There is conflicting and/or weak data describing the biological significance of the PIK3CA C378Y mutation.", indicatorQueryResp.getVariantSummary()); assertEquals("There should not be any sensitive therapeutic associated.", null, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("There should not be any resistance therapeutic associated.", null, indicatorQueryResp.getHighestResistanceLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TERT", "Promoter", null, null, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", SummaryUtils.TERT_PROMOTER_MUTATION_SUMMARY, indicatorQueryResp.getVariantSummary()); assertEquals("The tumor type summary is not expected.", SummaryUtils.TERT_PROMOTER_NO_THERAPY_TUMOR_TYPE_SUMMARY.replace("[[tumor type]]", "ovarian cancer"), indicatorQueryResp.getTumorTypeSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TERT", "promoter ", null, null, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The variant summary is not expected.", SummaryUtils.TERT_PROMOTER_MUTATION_SUMMARY, indicatorQueryResp.getVariantSummary()); assertEquals("The tumor type summary is not expected.", SummaryUtils.TERT_PROMOTER_NO_THERAPY_TUMOR_TYPE_SUMMARY.replace("[[tumor type]]", "ovarian cancer"), indicatorQueryResp.getTumorTypeSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KIT", "", null, null, "Ovarian Cancer", MISSENSE_VARIANT, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The Oncogenicity is not empty, but it should be.", "", indicatorQueryResp.getOncogenic()); assertTrue("There should not be any treatments", indicatorQueryResp.getTreatments().isEmpty()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "PIK3R1", "W583del", null, null, null, null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The mutation effect is null, but it should not be.", indicatorQueryResp.getMutationEffect() != null); assertEquals("The mutation effect is not unknown, but it should be.", "Unknown", indicatorQueryResp.getMutationEffect().getKnownEffect()); Query query1, query2; IndicatorQueryResp resp1, resp2; query1 = new Query("PTEN", "Gain", null); query2 = new Query("PTEN", "Amplification", null); resp1 = IndicatorUtils.processQuery(query1, null, false, null); resp2 = IndicatorUtils.processQuery(query2, null, false, null); assertTrue("The oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("The treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); query1 = new Query("PTEN", "Loss", null); query2 = new Query("PTEN", "Deletion", null); resp1 = IndicatorUtils.processQuery(query1, null, false, null); resp2 = IndicatorUtils.processQuery(query2, null, false, null); assertTrue("The oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("The treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); query1 = new Query("ESR1", "ESR1 intragenic", "Melanoma"); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ESR1", null, "structural_variant", StructuralVariantType.DELETION, "Melanoma", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, false, null); resp2 = IndicatorUtils.processQuery(query2, null, false, null); assertTrue("The oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("The treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, 2099, null, null, "structural_variant", StructuralVariantType.DELETION, "Melanoma", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ESR1", null, "structural_variant", StructuralVariantType.DELETION, "Melanoma", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, false, null); resp2 = IndicatorUtils.processQuery(query2, null, false, null); assertTrue("The oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("The treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); query1 = new Query("MAP3K1", "T779*", null); query2 = new Query("MAP3K1", "Deletion", null); resp1 = IndicatorUtils.processQuery(query1, null, false, null); resp2 = IndicatorUtils.processQuery(query2, null, false, null); assertTrue("The oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("The treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "CUL1-BRAF Fusion", null, null, "Ovarian Cancer", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "CUL1-BRAF", null, "fusion", null, "Ovarian Cancer", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); assertTrue("Oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("Treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); assertTrue("Highest sensitive levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestSensitiveLevel(), resp2.getHighestSensitiveLevel())); assertTrue("Highest resistance levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestResistanceLevel(), resp2.getHighestResistanceLevel())); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, 673, null, "V600E", null, null, "Melanoma", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Melanoma", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); assertTrue("Genes are not the same, but they should.", resp1.getGeneSummary().equals(resp2.getGeneSummary())); assertTrue("Oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("Treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); assertTrue("Highest sensitive levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestSensitiveLevel(), resp2.getHighestSensitiveLevel())); assertTrue("Highest resistance levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestResistanceLevel(), resp2.getHighestResistanceLevel())); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, 673, "EGFR", "V600E", null, null, "Melanoma", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Melanoma", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); assertTrue("Genes are not the same, but they should.", resp1.getGeneSummary().equals(resp2.getGeneSummary())); assertTrue("Oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("Treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); assertTrue("Highest sensitive levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestSensitiveLevel(), resp2.getHighestSensitiveLevel())); assertTrue("Highest resistance levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestResistanceLevel(), resp2.getHighestResistanceLevel())); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, 673, "", "V600E", null, null, "Melanoma", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Melanoma", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); assertTrue("Genes are not the same, but they should.", resp1.getGeneSummary().equals(resp2.getGeneSummary())); assertTrue("Oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("Treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); assertTrue("Highest sensitive levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestSensitiveLevel(), resp2.getHighestSensitiveLevel())); assertTrue("Highest resistance levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestResistanceLevel(), resp2.getHighestResistanceLevel())); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "EGFR CTD", null, null, "Gastrointestinal Stromal Tumor", null, null, null, null); resp1 = IndicatorUtils.processQuery(query, null, true, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "CTD", null, null, "Gastrointestinal Stromal Tumor", null, null, null, null); resp2 = IndicatorUtils.processQuery(query, null, true, null); assertTrue("Genes are not the same, but they should.", resp1.getGeneSummary().equals(resp2.getGeneSummary())); assertTrue("The Oncogenicities are not the same.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("Treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); assertTrue("Highest sensitive levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestSensitiveLevel(), resp2.getHighestSensitiveLevel())); assertTrue("Highest resistance levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestResistanceLevel(), resp2.getHighestResistanceLevel())); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, null, "MSI-H", null, null, "Colorectal Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The geneExist is not false, but it should be.", indicatorQueryResp.getGeneExist() == false); assertEquals("The oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level is not 1, but it should be.", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The gene summary is not empty, but it should be.", "", indicatorQueryResp.getGeneSummary()); assertEquals("The variant summary is not expected.", "Genetic or epigenetic alterations resulting in loss of function of mismatch repair (MMR) genes can lead to a microsatellite instability-high (MSI-H)/mismatch repair deficient (MMR-D) phenotype.", indicatorQueryResp.getVariantSummary()); assertEquals("The tumor type summary is not expected.", "The anti-PD-1 antibodies pembrolizumab or nivolumab, as single-agents, and the anti-CTLA4 antibody ipilimumab in combination with nivolumab are FDA-approved for the treatment of patients with MMR-D or MSI-H metastatic colorectal cancer.", indicatorQueryResp.getTumorTypeSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, null, "MSI-H", null, null, "Cervical Endometrioid Carcinoma", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The geneExist is not false, but it should be.", indicatorQueryResp.getGeneExist() == false); assertEquals("The oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level is not 1, but it should be.", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The gene summary is not empty, but it should be.", "", indicatorQueryResp.getGeneSummary()); assertEquals("The variant summary is not expected.", "Genetic or epigenetic alterations resulting in loss of function of mismatch repair (MMR) genes can lead to a microsatellite instability-high (MSI-H)/mismatch repair deficient (MMR-D) phenotype.", indicatorQueryResp.getVariantSummary()); assertEquals("The tumor type summary is not expected.", "The anti-PD-1 antibody pembrolizumab is an FDA-approved drug for therapy of adult and pediatric patients with unresectable or metastatic MSI-H/MMR-D solid cancers that have progressed following prior treatment.", indicatorQueryResp.getTumorTypeSummary()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, null, null, null, null, "Melanoma", null, null, null, "7:g.140453136A>T"); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The geneExist is not true, but it should be.", indicatorQueryResp.getGeneExist() == true); assertEquals("The oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level is not 1, but it should be.", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, null, null, null, null, "Melanoma", null, null, null, "7:g.140453136A>T"); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF", "V600E", null, null, "Melanoma", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); assertTrue("Genes are not the same, but they should.", resp1.getGeneSummary().equals(resp2.getGeneSummary())); assertTrue("Oncogenicities are not the same, but they should.", resp1.getOncogenic().equals(resp2.getOncogenic())); assertTrue("Treatments are not the same, but they should.", resp1.getTreatments().equals(resp2.getTreatments())); assertTrue("Highest sensitive levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestSensitiveLevel(), resp2.getHighestSensitiveLevel())); assertTrue("Highest resistance levels are not the same, but they should.", LevelUtils.areSameLevels(resp1.getHighestResistanceLevel(), resp2.getHighestResistanceLevel())); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ALK", "R401Q", null, null, "Melanoma", null, null, null, "7:g.140453136A>T"); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertTrue("The geneExist is not true, but it should be.", indicatorQueryResp.getGeneExist() == true); assertEquals("The oncogenicity is not Oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); assertEquals("The highest sensitive level is not 1, but it should be.", LevelOfEvidence.LEVEL_1, indicatorQueryResp.getHighestSensitiveLevel()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF-BRAF", null, "structural_variant", StructuralVariantType.INSERTION, "Ovarian Cancer", "fusion", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The highest sensitive level of BRAF insertion should be Level 3A", LevelOfEvidence.LEVEL_3A, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The oncogenicity of BRAF insertion functional fusion should be Likely Oncogenic", "Likely Oncogenic", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BRAF-BRAF", null, "structural_variant", StructuralVariantType.INSERTION, "Ovarian Cancer", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The highest sensitive level of BRAF insertion should be null", null, indicatorQueryResp.getHighestSensitiveLevel()); assertEquals("The oncogenicity of BRAF insertion non-functional fusion should be empty", "", indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KMT2A-MLLT3", null, "structural_variant", StructuralVariantType.TRANSLOCATION, "Acute Myeloid Leukemia", "fusion", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity of KMT2A translocation functional fusion should be likely oncogenic", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KMT2A-MLLT3", null, "structural_variant", StructuralVariantType.TRANSLOCATION, "Acute Myeloid Leukemia", "fusion", null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity of KMT2A translocation non-functional fusion should be likely oncogenic", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KLF5", "P301S", null, null, "Acute Myeloid Leukemia", null, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity is not likely oncogenic, but it should be.", Oncogenicity.LIKELY.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TERT", null, null, null, "Acute Myeloid Leukemia", UPSTREAM_GENE, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); query = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TERT", "", null, null, "Acute Myeloid Leukemia", UPSTREAM_GENE, null, null, null); indicatorQueryResp = IndicatorUtils.processQuery(query, null, true, null); assertEquals("The oncogenicity is not oncogenic, but it should be.", Oncogenicity.YES.getOncogenic(), indicatorQueryResp.getOncogenic()); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR-RAD51", null, "fusion", null, "Ovarian Cancer", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR-RAD51", null, "structural_variant", StructuralVariantType.INSERTION, "Ovarian Cancer", "fusion", null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KIF5B-MET", null, "structural_variant", StructuralVariantType.DELETION, "Lung Adenocarcinoma", "fusion", null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "KIF5B-MET", "FUSION", "structural_variant", StructuralVariantType.DELETION, "Lung Adenocarcinoma", "fusion", null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "BCR-ABL1", null, "structural_variant", StructuralVariantType.DELETION, "Lung Adenocarcinoma", "fusion", null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "ABL1-BCR", null, "structural_variant", StructuralVariantType.DELETION, "Lung Adenocarcinoma", "fusion", null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "KDD", "structural_variant", StructuralVariantType.DUPLICATION, "NSCLC", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "KDD", "structural_variant", StructuralVariantType.DUPLICATION, "NSCLC", "KDD", null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "KDD", null, null, "NSCLC", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "EGFR", "KDD", "structural_variant", StructuralVariantType.DUPLICATION, "NSCLC", "fusion", null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "MAP2K1", "C121S", null, null, "RDD", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "MAP2K1", "C121S", null, null, "Histiocytosis", null, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); query1 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TP53", "R248", null, null, "RDD", null, null, null, null); query2 = new Query(null, DEFAULT_REFERENCE_GENOME, null, null, "TP53", "R248", null, null, "RDD", MISSENSE_VARIANT, null, null, null); resp1 = IndicatorUtils.processQuery(query1, null, true, null); resp2 = IndicatorUtils.processQuery(query2, null, true, null); pairComparison(resp1, resp2); }