@Override public CloseableIterator<SAMRecord> getIterator(final SAMFileSpan chunks) { if (mStream == null) { throw new IllegalStateException("File reader is closed"); } if (mCurrentIterator != null) { throw new IllegalStateException("Iteration in progress"); } if (!(chunks instanceof BAMFileSpan)) { throw new IllegalStateException("BAMFileReader cannot handle this type of file span."); } // Create an iterator over the given chunk boundaries. mCurrentIterator = new BAMFileIndexIterator(((BAMFileSpan)chunks).toCoordinateArray()); return mCurrentIterator; }
@Override public CloseableIterator<SAMRecord> getIterator(final SAMFileSpan chunks) { if (mStream == null) { throw new IllegalStateException("File reader is closed"); } if (mCurrentIterator != null) { throw new IllegalStateException("Iteration in progress"); } if (!(chunks instanceof BAMFileSpan)) { throw new IllegalStateException("BAMFileReader cannot handle this type of file span."); } // Create an iterator over the given chunk boundaries. mCurrentIterator = new BAMFileIndexIterator(((BAMFileSpan)chunks).toCoordinateArray()); return mCurrentIterator; }
@Override public CloseableIterator<SAMRecord> getIterator(final SAMFileSpan chunks) { if (mStream == null) { throw new IllegalStateException("File reader is closed"); } if (mCurrentIterator != null) { throw new IllegalStateException("Iteration in progress"); } if (!(chunks instanceof BAMFileSpan)) { throw new IllegalStateException("BAMFileReader cannot handle this type of file span."); } // Create an iterator over the given chunk boundaries. mCurrentIterator = new BAMFileIndexIterator(((BAMFileSpan)chunks).toCoordinateArray()); return mCurrentIterator; }
private CloseableIterator<SAMRecord> createIndexIterator(final QueryInterval[] intervals, final boolean contained) { assertIntervalsOptimized(intervals); // Hit the index to determine the chunk boundaries for the required data. final BAMFileSpan[] inputSpans = new BAMFileSpan[intervals.length]; final BAMIndex fileIndex = getIndex(); for (int i = 0; i < intervals.length; ++i) { final QueryInterval interval = intervals[i]; final BAMFileSpan span = fileIndex.getSpanOverlapping(interval.referenceIndex, interval.start, interval.end); inputSpans[i] = span; } final long[] filePointers; if (inputSpans.length > 0) { filePointers = BAMFileSpan.merge(inputSpans).toCoordinateArray(); } else { filePointers = null; } // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }
/** * Prepare to iterate through SAMRecords that match the given intervals. * @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) { assertIntervalsOptimized(intervals); // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }
/** * Prepare to iterate through SAMRecords that match the given intervals. * @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) { assertIntervalsOptimized(intervals); // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }
/** * Prepare to iterate through SAMRecords in the given reference that start exactly at the given start coordinate. * @param referenceIndex Desired reference sequence. * @param start 1-based alignment start. */ private CloseableIterator<SAMRecord> createStartingAtIndexIterator(final int referenceIndex, final int start) { // Hit the index to determine the chunk boundaries for the required data. final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping(referenceIndex, start, 0); final long[] filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator,new BAMStartingAtIteratorFilter(referenceIndex,start)); }
/** * Prepare to iterate through SAMRecords in the given reference that start exactly at the given start coordinate. * @param referenceIndex Desired reference sequence. * @param start 1-based alignment start. */ private CloseableIterator<SAMRecord> createStartingAtIndexIterator(final int referenceIndex, final int start) { // Hit the index to determine the chunk boundaries for the required data. final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping(referenceIndex, start, 0); final long[] filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator,new BAMStartingAtIteratorFilter(referenceIndex,start)); }
/** * Prepare to iterate through SAMRecords in the given reference that start exactly at the given start coordinate. * @param referenceIndex Desired reference sequence. * @param start 1-based alignment start. */ private CloseableIterator<SAMRecord> createStartingAtIndexIterator(final int referenceIndex, final int start) { // Hit the index to determine the chunk boundaries for the required data. final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping(referenceIndex, start, 0); final long[] filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator,new BAMStartingAtIteratorFilter(referenceIndex,start)); }
/** * Prepare to iterate through SAMRecords that match the given intervals. * @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) { assertIntervalsOptimized(intervals); // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }
@Override public CloseableIterator<SAMRecord> getIterator(final SAMFileSpan chunks) { if (mStream == null) { throw new IllegalStateException("File reader is closed"); } if (mCurrentIterator != null) { throw new IllegalStateException("Iteration in progress"); } if (!(chunks instanceof BAMFileSpan)) { throw new IllegalStateException("BAMFileReader cannot handle this type of file span."); } // Create an iterator over the given chunk boundaries. mCurrentIterator = new BAMFileIndexIterator(((BAMFileSpan)chunks).toCoordinateArray()); return mCurrentIterator; }
/** * Prepare to iterate through SAMRecords in the given reference that start exactly at the given start coordinate. * @param referenceIndex Desired reference sequence. * @param start 1-based alignment start. */ private CloseableIterator<SAMRecord> createStartingAtIndexIterator(final int referenceIndex, final int start) { // Hit the index to determine the chunk boundaries for the required data. final BAMIndex fileIndex = getIndex(); final BAMFileSpan fileSpan = fileIndex.getSpanOverlapping(referenceIndex, start, 0); final long[] filePointers = fileSpan != null ? fileSpan.toCoordinateArray() : null; // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(filePointers); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator,new BAMStartingAtIteratorFilter(referenceIndex,start)); }
private CloseableIterator<SAMRecord> createIndexIterator(final QueryInterval[] intervals, final boolean contained) { assertIntervalsOptimized(intervals); BAMFileSpan span = getFileSpan(intervals, getIndex()); // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(span == null ? null : span.toCoordinateArray()); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }
private CloseableIterator<SAMRecord> createIndexIterator(final QueryInterval[] intervals, final boolean contained) { assertIntervalsOptimized(intervals); BAMFileSpan span = getFileSpan(intervals, getIndex()); // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(span == null ? null : span.toCoordinateArray()); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }
private CloseableIterator<SAMRecord> createIndexIterator(final QueryInterval[] intervals, final boolean contained) { assertIntervalsOptimized(intervals); BAMFileSpan span = getFileSpan(intervals, getIndex()); // Create an iterator over the above chunk boundaries. final BAMFileIndexIterator iterator = new BAMFileIndexIterator(span == null ? null : span.toCoordinateArray()); // Add some preprocessing filters for edge-case reads that don't fit into this // query type. return new BAMQueryFilteringIterator(iterator, new BAMQueryMultipleIntervalsIteratorFilter(intervals, contained)); }