SummaryUtils { public static String getGeneMutationNameInTumorTypeSummary(Gene gene, ReferenceGenome referenceGenome, String queryAlteration) { StringBuilder sb = new StringBuilder(); if (queryAlteration == null) { return ""; } else { queryAlteration = queryAlteration.trim(); } Alteration alteration = AlterationUtils.findAlteration(gene, referenceGenome, queryAlteration); if (alteration == null) { alteration = AlterationUtils.getAlteration(gene.getHugoSymbol(), queryAlteration, null, null, null, null); AlterationUtils.annotateAlteration(alteration, queryAlteration); } if (StringUtils.containsIgnoreCase(queryAlteration, "fusion")) { if (queryAlteration.toLowerCase().equals("fusions")) { queryAlteration = gene.getHugoSymbol() + " fusion"; } queryAlteration = queryAlteration.replace("Fusion", "fusion"); sb.append(queryAlteration + " positive"); } else if (StringUtils.equalsIgnoreCase(queryAlteration, "gain") || StringUtils.equalsIgnoreCase(queryAlteration, "amplification")) { queryAlteration = gene.getHugoSymbol() + "-amplified"; sb.append(queryAlteration); } else { if (!queryAlteration.contains(gene.getHugoSymbol())) { sb.append(gene.getHugoSymbol() + " "); } if (AlterationUtils.isGeneralAlterations(queryAlteration, true)) { sb.append(queryAlteration.toLowerCase()); } else if (StringUtils.equalsIgnoreCase(queryAlteration, "loss")) { queryAlteration = "deletion"; sb.append(queryAlteration); } else if (AlterationUtils.isGeneralAlterations(queryAlteration, false) || (alteration.getConsequence() != null && (alteration.getConsequence().getTerm().equals("inframe_deletion") || alteration.getConsequence().getTerm().equals("inframe_insertion"))) || StringUtils.containsIgnoreCase(queryAlteration, "indel") || StringUtils.containsIgnoreCase(queryAlteration, "dup") || StringUtils.containsIgnoreCase(queryAlteration, "del") || StringUtils.containsIgnoreCase(queryAlteration, "ins") || StringUtils.containsIgnoreCase(queryAlteration, "splice") || NamingUtils.hasAbbreviation(queryAlteration) || MainUtils.isEGFRTruncatingVariants(queryAlteration) ) { sb.append(queryAlteration + " altered"); } else if (!queryAlteration.endsWith("mutation")) { sb.append(queryAlteration + " mutant"); } } return sb.toString(); }  static Map<String, Object> tumorTypeSummary(EvidenceType evidenceType, Gene gene, Query query, Alteration exactMatchedAlt, List<Alteration> alterations, List<TumorType> relevantTumorTypes); static String unknownOncogenicSummary(Gene gene, ReferenceGenome referenceGenome, String queryAlteration); static String synonymousSummary(); static String variantSummary(Gene gene, Alteration exactMatchAlteration, List<Alteration> alterations, Query query); static String geneSummary(Gene gene); static String alleleSummary(ReferenceGenome referenceGenome, Alteration alteration); static String inconclusiveSummary(Gene gene, ReferenceGenome referenceGenome, String queryAlteration); static String inconclusiveHotSpotSummary(Alteration alteration, Query query); static String hotspotSummary(Alteration alteration, Query query, Boolean usePronoun, Oncogenicity oncogenicity); static String getGeneMutationNameInVariantSummary(Gene gene, ReferenceGenome referenceGenome, String queryAlteration); static String getGeneMutationNameInTumorTypeSummary(Gene gene, ReferenceGenome referenceGenome, String queryAlteration); static final String TERT_PROMOTER_MUTATION_SUMMARY; static final String TERT_PROMOTER_NO_THERAPY_TUMOR_TYPE_SUMMARY; static final String ONCOGENIC_MUTATIONS_DEFAULT_SUMMARY; }
@Test public void testGetGeneMutationNameInTumorTypeSummary() throws Exception { Gene gene = GeneUtils.getGene("ERBB2"); assertEquals("ERBB2-amplified", SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Amplification")); assertEquals(SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Amplification"), SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "amplification")); assertEquals(SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Amplification"), SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, " amplification")); assertEquals(SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Amplification"), SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "gain")); assertEquals("ERBB2 deletion", SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Deletion")); assertEquals(SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Deletion"), SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "loss")); assertEquals(SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Deletion"), SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, " loss")); assertEquals(SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "Deletion"), SummaryUtils.getGeneMutationNameInTumorTypeSummary(gene, DEFAULT_REFERENCE_GENOME, "deLetion")); }