public final class ReservoirDownsampler extends ReadsDownsampler
Constructor and Description |
---|
ReservoirDownsampler(int targetSampleSize)
Construct a ReservoirDownsampler
|
ReservoirDownsampler(int targetSampleSize,
boolean expectFewOverflows)
Construct a ReservoirDownsampler
|
Modifier and Type | Method and Description |
---|---|
void |
clearItems()
Clear the data structures used to hold information
|
java.util.List<GATKRead> |
consumeFinalizedItems()
Return (and *remove*) all items that have survived downsampling and are waiting to be retrieved.
|
boolean |
hasFinalizedItems()
Are there items that have survived the downsampling process waiting to be retrieved?
|
boolean |
hasPendingItems()
Are there items stored in this downsampler that it doesn't yet know whether they will
ultimately survive the downsampling process?
|
GATKRead |
peekFinalized()
Peek at the first finalized item stored in this downsampler (or null if there are no finalized items)
|
GATKRead |
peekPending()
Peek at the first pending item stored in this downsampler (or null if there are no pending items)
|
boolean |
requiresCoordinateSortOrder()
Does this downsampler require that reads be fed to it in coordinate order?
|
void |
signalEndOfInput()
Used to tell the downsampler that no more items will be submitted to it, and that it should
finalize any pending items.
|
void |
signalNoMoreReadsBefore(GATKRead read)
Tell this downsampler that no more reads located before the provided read (according to
the sort order of the read stream) will be fed to it.
|
int |
size()
Get the current number of items in this downsampler
This should be the best estimate of the total number of elements that will come out of the downsampler
were consumeFinalizedItems() to be called immediately after this call.
|
void |
submit(GATKRead newRead)
Submit one item to the downsampler for consideration.
|
getNumberOfDiscardedItems, incrementNumberOfDiscardedItems, resetStats, submit
public ReservoirDownsampler(int targetSampleSize, boolean expectFewOverflows)
targetSampleSize
- Size of the reservoir used by this downsampler.expectFewOverflows
- if true, this downsampler will be optimized for the case
where most of the time we won't fill up anything like the
targetSampleSize elements. If this is false, we will allocate
internal buffers to targetSampleSize initially, which minimizes
the cost of allocation if we often use targetSampleSize or more
elements.public ReservoirDownsampler(int targetSampleSize)
targetSampleSize
- Size of the reservoir used by this downsampler. Number of items retained
after downsampling will be min(totalReads, targetSampleSize)public void submit(GATKRead newRead)
Downsampler
submit
in class Downsampler<GATKRead>
newRead
- the individual item to submit to the downsampler for considerationpublic boolean hasFinalizedItems()
Downsampler
hasFinalizedItems
in class Downsampler<GATKRead>
public java.util.List<GATKRead> consumeFinalizedItems()
Downsampler
consumeFinalizedItems
in class Downsampler<GATKRead>
public boolean hasPendingItems()
Downsampler
hasPendingItems
in class Downsampler<GATKRead>
public GATKRead peekFinalized()
Downsampler
peekFinalized
in class Downsampler<GATKRead>
public GATKRead peekPending()
Downsampler
peekPending
in class Downsampler<GATKRead>
public int size()
Downsampler
size
in class Downsampler<GATKRead>
public void signalEndOfInput()
Downsampler
signalEndOfInput
in class Downsampler<GATKRead>
public void clearItems()
clearItems
in class Downsampler<GATKRead>
public boolean requiresCoordinateSortOrder()
ReadsDownsampler
requiresCoordinateSortOrder
in class ReadsDownsampler
public void signalNoMoreReadsBefore(GATKRead read)
ReadsDownsampler
signalNoMoreReadsBefore
in class ReadsDownsampler
read
- the downsampler will assume that no reads located before this read will ever
be submitted to it in the future