public class DownsamplingIterator extends java.lang.Object implements CloseableIterator<SAMRecord>, java.lang.Iterable<SAMRecord>
Constructor and Description |
---|
DownsamplingIterator(java.util.Iterator<SAMRecord> iterator,
java.util.Random random,
double probabilityOfKeeping)
Constructs a downsampling iterator upon the supplied iterator, using the Random as the source of randomness.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
getKeptReads()
Returns the number of reads/records kept post-downsampling up to the point when the method is called.
|
long |
getTotalReads()
Returns the total number of reads/records considered up to the point when the method is called.
|
boolean |
hasNext()
Returns true if there is another record available post-downsampling, false otherwise.
|
java.util.Iterator<SAMRecord> |
iterator()
Simple implementation of iterable that returns this iterator.
|
SAMRecord |
next()
Returns the next record from the iterator, or throws an exception if there is no next record.
|
void |
remove()
Unsupported operation.
|
DownsamplingIterator |
setAllowSecondaryAlignments(boolean allowSecondaryAlignments)
Sets whether or not secondary alignments are allowed (true) or all discarded (false).
|
DownsamplingIterator |
setAllowSupplementalAlignments(boolean allowSupplementalAlignments)
Sets whether or not supplemental alignments are allowed (true) or all discarded (false).
|
DownsamplingIterator |
setIncludeNoRefReads(boolean includeNoRefReads)
Sets whether the iterator will stop when no-ref reads are encountered, or keep downsampling through them.
|
public DownsamplingIterator(java.util.Iterator<SAMRecord> iterator, java.util.Random random, double probabilityOfKeeping)
public DownsamplingIterator setAllowSecondaryAlignments(boolean allowSecondaryAlignments)
public DownsamplingIterator setAllowSupplementalAlignments(boolean allowSupplementalAlignments)
public DownsamplingIterator setIncludeNoRefReads(boolean includeNoRefReads)
public long getTotalReads()
public long getKeptReads()
public java.util.Iterator<SAMRecord> iterator()
iterator
in interface java.lang.Iterable<SAMRecord>
public boolean hasNext()
hasNext
in interface java.util.Iterator<SAMRecord>
public SAMRecord next()
next
in interface java.util.Iterator<SAMRecord>
public void remove()
remove
in interface java.util.Iterator<SAMRecord>
public void close()
close
in interface CloseableIterator<SAMRecord>
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable