SomaticVariants { @VisibleForTesting static int extractCodonField(@NotNull String hgvsCoding) { StringBuilder codonAppender = new StringBuilder(); boolean noDigitFound = true; int index = 2; while (noDigitFound && index < hgvsCoding.length()) { if ((Character.toString(hgvsCoding.charAt(index)).equals("-") && index == 2) || Character.isDigit(hgvsCoding.charAt(index))) { codonAppender.append(hgvsCoding.charAt(index)); } else { noDigitFound = false; } index++; } return Integer.parseInt(codonAppender.toString()); } private  SomaticVariants(); @NotNull static List<ReportableVariant> sort(@NotNull List<ReportableVariant> variants); static boolean hasNotifiableGermlineVariant(@NotNull List<ReportableVariant> variants); @NotNull static String geneDisplayString(@NotNull ReportableVariant variant); @NotNull static String copyNumberString(double copyNumber, boolean hasReliablePurity); @NotNull static String vafString(@NotNull ReportableVariant variant, boolean hasReliablePurity); @NotNull static String hotspotString(@NotNull Hotspot hotspot); @NotNull static String biallelicString(boolean biallelic, boolean hasReliablePurity); @NotNull static String clonalString(double clonalLikelihood); @NotNull static Set<String> driverGenesWithVariant(@NotNull List<ReportableVariant> variants); static int countReportableVariants(@NotNull List<ReportableVariant> variants);  }
@Test public void canExtractCodingFromHGVSCodingImpactField() { assertEquals(927, SomaticVariants.extractCodonField("c.927+1G>A")); assertEquals(1799, SomaticVariants.extractCodonField("c.1799T>A")); assertEquals(423, SomaticVariants.extractCodonField("c.423_427delCCCTG")); assertEquals(8390, SomaticVariants.extractCodonField("c.8390delA")); assertEquals(-124, SomaticVariants.extractCodonField("c.-124C>T")); }