@Override public SAMRecord next() { if (!hasNext()) { throw new NoSuchElementException("Next called on empty CRAMIntervalIterator"); } return getNextRecord(); }
private SAMRecord getNextRecord() { final SAMRecord result = nextRec; nextRec = null; while(nextRec == null && unfilteredIterator.hasNext()) { SAMRecord nextRecord = unfilteredIterator.next(); switch(compareToFilter(nextRecord)) { case MATCHES_FILTER: nextRec = nextRecord; break; case CONTINUE_ITERATION: continue; case STOP_ITERATION: break; default: throw new SAMException("Unexpected return from compareToFilter"); } } return result; }
private SAMRecord getNextRecord() { final SAMRecord result = nextRec; nextRec = null; while(nextRec == null && unfilteredIterator.hasNext()) { SAMRecord nextRecord = unfilteredIterator.next(); switch(compareToFilter(nextRecord)) { case MATCHES_FILTER: nextRec = nextRecord; break; case CONTINUE_ITERATION: continue; case STOP_ITERATION: break; default: throw new SAMException("Unexpected return from compareToFilter"); } } return result; }
public CRAMIntervalIterator(final QueryInterval[] queries, final boolean contained, final long[] coordinates) { super(queries, contained); if (coordinates != null && coordinates.length != 0) { try { unfilteredIterator = new CRAMIterator( getSeekableStreamOrFailWithRTE(), referenceSource, coordinates, validationStringency ); } catch (final IOException e) { throw new RuntimeEOFException(e); } getNextRecord(); // advance to the first record that matches the filter criteria } }
/** * Prepare to iterate through SAMRecords that match the intersection of the given intervals and chunk boundaries. * @param intervals the intervals to restrict reads to * @param contained if <code>true</code>, return records that are strictly * contained in the intervals, otherwise return records that overlap * @param filePointers file pointer pairs corresponding to chunk boundaries for the * intervals */ public CloseableIterator<SAMRecord> createIndexIterator(final QueryInterval[] intervals, final boolean contained, final long[] filePointers) { return new CRAMIntervalIterator(intervals, contained, filePointers); }
/** * Prepare to iterate through SAMRecords that match the intersection of the given intervals and chunk boundaries. * @param intervals the intervals to restrict reads to * @param contained if <code>true</code>, return records that are strictly * contained in the intervals, otherwise return records that overlap * @param filePointers file pointer pairs corresponding to chunk boundaries for the * intervals */ public CloseableIterator<SAMRecord> createIndexIterator(final QueryInterval[] intervals, final boolean contained, final long[] filePointers) { return new CRAMIntervalIterator(intervals, contained, filePointers); }
@Override public CloseableIterator<SAMRecord> queryAlignmentStart(final String sequence, final int start) { final SAMFileHeader fileHeader = getFileHeader(); final int referenceIndex = fileHeader.getSequenceIndex(sequence); return new CRAMIntervalIterator(new QueryInterval[]{new QueryInterval(referenceIndex, start, -1)}, true); }
@Override public CloseableIterator<SAMRecord> query(final QueryInterval[] intervals, final boolean contained) { return new CRAMIntervalIterator(intervals, contained); }
public CRAMIntervalIterator(final QueryInterval[] queries, final boolean contained, final long[] coordinates) { super(queries, contained); if (coordinates != null && coordinates.length != 0) { unfilteredIterator = new CRAMIterator( getSeekableStreamOrFailWithRTE(), referenceSource, coordinates, validationStringency ); getNextRecord(); // advance to the first record that matches the filter criteria } }
@Override public CloseableIterator<SAMRecord> queryAlignmentStart(final String sequence, final int start) { final SAMFileHeader fileHeader = getFileHeader(); final int referenceIndex = fileHeader.getSequenceIndex(sequence); return new CRAMIntervalIterator(new QueryInterval[]{new QueryInterval(referenceIndex, start, -1)}, true); }
@Override public CloseableIterator<SAMRecord> query(final QueryInterval[] intervals, final boolean contained) { return new CRAMIntervalIterator(intervals, contained); }
@Override public SAMRecord next() { if (!hasNext()) { throw new NoSuchElementException("Next called on empty CRAMIntervalIterator"); } return getNextRecord(); }