@Test public void testRegionDeletionToGenomicVariant() { GenomicVariant variant = GenomicVariantUtil.fromRegion("2:946507-946511:1/-"); assertEquals("2", variant.getChromosome()); assertEquals(null, variant.getRefType()); assertEquals((Integer) 946507, variant.getStart()); assertEquals((Integer) 946511, variant.getEnd()); assertEquals(null, variant.getRef()); assertEquals(null, variant.getType()); assertEquals("-", variant.getAlt()); }
public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } GenomicVariant.RefType refType = null; String chr = getPattern("^\\d{1,2}(?=:)", region); Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); GenomicVariant.Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, refType, start, end, type, ref, alt); }
GenomicVariantUtil { public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } GenomicVariant.RefType refType = null; String chr = getPattern("^\\d{1,2}(?=:)", region); Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); GenomicVariant.Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, refType, start, end, type, ref, alt); } }
GenomicVariantUtil { public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } GenomicVariant.RefType refType = null; String chr = getPattern("^\\d{1,2}(?=:)", region); Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); GenomicVariant.Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, refType, start, end, type, ref, alt); }  }
GenomicVariantUtil { public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } GenomicVariant.RefType refType = null; String chr = getPattern("^\\d{1,2}(?=:)", region); Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); GenomicVariant.Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, refType, start, end, type, ref, alt); }  static GenomicVariant fromHgvs(String hgvs); static GenomicVariant fromRegion(String region); static String toRegion(GenomicVariant variant); static ArrayList<String> getMafs(String maf_file); static GenomicVariant fromMaf(String maf, String[] key); static boolean isRegion(String variant); static boolean isMafFile(String file); }
GenomicVariantUtil { public static GenomicVariant fromRegion(String region) { if (!isRegion(region)) { throw new IllegalArgumentException("region is invalid"); } GenomicVariant.RefType refType = null; String chr = getPattern("^\\d{1,2}(?=:)", region); Integer start = Integer.parseInt(getPattern("(?<=:)\\d+(?=-)", region)); Integer end = Integer.parseInt(getPattern("(?<=-)\\d+(?=:)", region)); GenomicVariant.Type type = null; String ref = null; String alt = getPattern("(?<=:-?1/)[ATCG]+|-$", region); return new GenomicVariant(chr, refType, start, end, type, ref, alt); }  static GenomicVariant fromHgvs(String hgvs); static GenomicVariant fromRegion(String region); static String toRegion(GenomicVariant variant); static ArrayList<String> getMafs(String maf_file); static GenomicVariant fromMaf(String maf, String[] key); static boolean isRegion(String variant); static boolean isMafFile(String file);  }