/** Clean up the list of splices */ private void cleanSplices() { final int targetQueueSize = splices.size() / 2; final Iterator<Splice> iter = splices.iterator(); for (int i = 0; i < targetQueueSize; i++) { iter.next(); iter.remove(); } }
/** * Add a new observed split to the list to use * * @param contig the contig * @param start the start of the split, inclusive * @param end the end of the split, inclusive */ public void addSplicePosition(final String contig, final int start, final int end) { if (doNotFixOverhangs) return; // is this a new splice? if not, we are done final Splice splice = new Splice(contig, start, end); if (splices.contains(splice)) return; // initialize it with the reference context // we don't want to do this until we know for sure that it's a new splice position splice.initialize(referenceReader); // clear the set of old split positions seen if we hit a new contig final boolean sameContig = splices.isEmpty() || splices.iterator().next().loc.getContig().equals(contig); if (!sameContig) splices.clear(); // run this position against the existing reads for (final SplitRead read : waitingReads) fixSplit(read, splice); splices.add(splice); if (splices.size() > MAX_SPLICES_TO_KEEP) cleanSplices(); }