FilterConsensus implements Callable<Integer> { static List<Edit> cigarToEditList(final SAMRecord record) throws IllegalSymbolException { int position = 0; List<Edit> edits = new ArrayList<Edit>(); for (CigarElement element : record.getCigar().getCigarElements()) { position += element.getLength(); String operator = element.getOperator().toString(); if ("I".equals(operator) || "S".equals(operator)) { edits.add(new Edit(position - element.getLength() + 1, element.getLength(), SymbolList.EMPTY_LIST)); position -= element.getLength(); } else if ("D".equals(operator)) { SymbolList replace = DNATools.createDNA(Joiner.on("").join(Collections.nCopies(element.getLength(), "-"))); edits.add(new Edit(position + element.getLength() - 1, 0, replace)); } } return edits; } FilterConsensus(final File bamFile,
                           final File bedFile,
                           final File outputFile,
                           final String gene,
                           final boolean cdna,
                           final boolean removeGaps,
                           final double minimumBreadth,
                           final int expectedPloidy); @Override Integer call(); static void main(final String[] args);  }
@Test public void testEmptyCigarToEditList() throws Exception { List<Edit> edits = cigarToEditList(new SAMRecord(new SAMFileHeader())); assertTrue(edits.isEmpty()); }