Source:
public List<Variant> create(String fileId, String studyId, String line) throws IllegalArgumentException, NotAVariantException { String[] fields = line.split("\t"); if (fields.length < 8) { throw new IllegalArgumentException("Not enough fields provided (min 8)"); } String chromosome = removeChrPrefix(fields[0]); int position = Integer.parseInt(fields[1]); Set<String> ids = getIds(fields); String reference = getReference(fields); String[] alternateAlleles = getAlternateAlleles(fields, chromosome, position, reference); float quality = getQuality(fields); String filter = getFilter(fields); String info = getInfo(fields); String format = getFormat(fields); List<VariantKeyFields> generatedKeyFields = buildVariantKeyFields(chromosome, position, reference, alternateAlleles); List<Variant> variants = new LinkedList<>(); for (int altAlleleIdx = 0; altAlleleIdx < alternateAlleles.length; altAlleleIdx++) { VariantKeyFields keyFields = generatedKeyFields.get(altAlleleIdx); Variant variant = new Variant(chromosome, keyFields.start, keyFields.end, keyFields.reference, keyFields.alternate); String[] secondaryAlternates = getSecondaryAlternates(keyFields.getNumAllele(), alternateAlleles); VariantSourceEntry file = new VariantSourceEntry(fileId, studyId, secondaryAlternates, format); variant.addSourceEntry(file); try { parseSplitSampleData(variant, fileId, studyId, fields, alternateAlleles, secondaryAlternates, altAlleleIdx); setOtherFields(variant, fileId, studyId, ids, quality, filter, info, format, keyFields.getNumAllele(), alternateAlleles, line); variants.add(variant); } catch (NonStandardCompliantSampleField ex) { Logger.getLogger(VariantFactory.class.getName()) .log(Level.SEVERE, String.format("Variant %s:%d:%s>%s will not be saved\n%s", chromosome, position, reference, alternateAlleles[altAlleleIdx], ex.getMessage())); } } return variants; }

Target:
public List<Variant> create(String fileId, String studyId, String line) throws IllegalArgumentException, NotAVariantException { String[] fields = line.split("\t"); if (fields.length < 8) { throw new IllegalArgumentException("Not enough fields provided (min 8)"); } String chromosome = getChromosomeWithoutPrefix(fields); int position = getPosition(fields); Set<String> ids = getIds(fields); String reference = getReference(fields); String[] alternateAlleles = getAlternateAlleles(fields, chromosome, position, reference); float quality = getQuality(fields); String filter = getFilter(fields); String info = getInfo(fields); String format = getFormat(fields); List<VariantKeyFields> generatedKeyFields = buildVariantKeyFields(chromosome, position, reference, alternateAlleles); List<Variant> variants = new LinkedList<>(); for (int altAlleleIdx = 0; altAlleleIdx < alternateAlleles.length; altAlleleIdx++) { VariantKeyFields keyFields = generatedKeyFields.get(altAlleleIdx); Variant variant = new Variant(chromosome, keyFields.start, keyFields.end, keyFields.reference, keyFields.alternate); String[] secondaryAlternates = getSecondaryAlternates(keyFields.getNumAllele(), alternateAlleles); VariantSourceEntry file = new VariantSourceEntry(fileId, studyId, secondaryAlternates, format); variant.addSourceEntry(file); try { parseSplitSampleData(variant, fileId, studyId, fields, alternateAlleles, secondaryAlternates, altAlleleIdx); setOtherFields(variant, fileId, studyId, ids, quality, filter, info, format, keyFields.getNumAllele(), alternateAlleles, line); variants.add(variant); } catch (NonStandardCompliantSampleField ex) { Logger.getLogger(VariantFactory.class.getName()) .log(Level.SEVERE, String.format("Variant %s:%d:%s>%s will not be saved\n%s", chromosome, position, reference, alternateAlleles[altAlleleIdx], ex.getMessage())); } } return variants; }