# Class DownsamplingIteratorFactory

java.lang.Object
htsjdk.samtools.DownsamplingIteratorFactory

public class DownsamplingIteratorFactory extends Object
A factory for creating DownsamplingIterators that uses a number of different strategies to achieve downsampling while meeting various criteria.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`DownsamplingIteratorFactory.Strategy`
Describes the available downsampling strategies.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CHAINED_DESCRIPTION`
`static final String`
`CONSTANT_MEMORY_DESCRPTION`
`static final String`
`HIGH_ACCURACY_DESCRIPTION`

## Constructor Summary

Constructors
Constructor
Description
`DownsamplingIteratorFactory()`

## Method Summary

Modifier and Type
Method
Description
`static DownsamplingIterator`
`make(SamReader reader, DownsamplingIteratorFactory.Strategy strategy, double proportion, double accuracy, int seed)`
Convenience method that constructs a downsampling iterator for all the reads available from a SamReader.
`static DownsamplingIterator`
`make(File samFile, DownsamplingIteratorFactory.Strategy strategy, double proportion, double accuracy, int seed)`
Convenience method that constructs a downsampling iterator for all the reads in a SAM file.
`static DownsamplingIterator`
`make(Iterator<SAMRecord> iterator, DownsamplingIteratorFactory.Strategy strategy, double proportion, double accuracy, int seed)`
Creates a new DownsamplingIterator using the supplied Strategy that attempts to read from the provided iterator and return approximately proportion of the records read.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### HIGH_ACCURACY_DESCRIPTION

public static final String HIGH_ACCURACY_DESCRIPTION

See Also:
  - Constant Field Values

### CONSTANT_MEMORY_DESCRPTION

public static final String CONSTANT_MEMORY_DESCRPTION

See Also:
  - Constant Field Values

### CHAINED_DESCRIPTION

public static final String CHAINED_DESCRIPTION

See Also:
  - Constant Field Values

## Constructor Details

### DownsamplingIteratorFactory

public DownsamplingIteratorFactory()

## Method Details

### make

public static DownsamplingIterator make(Iterator<SAMRecord> iterator, DownsamplingIteratorFactory.Strategy strategy, double proportion, double accuracy, int seed)
Creates a new DownsamplingIterator using the supplied Strategy that attempts to read from the provided iterator and return approximately proportion of the records read.

Parameters:
  `iterator` - The iterator from which to consume SAMRecords
  `strategy` - The downsampling strategy to use
  `proportion` - The proportion of records the downsampling strategy should attempt to emit
  `accuracy` - If supported by the downsampling strategy, the accuracy goal for the downsampler. Higher accuracy will generally require higher memory usage. An accuracy value of 0.0001 tells the strategy to try and ensure the emitted proportion is within proportion +/0 0.0001.
  `seed` - The seed value to use for any random process used in down-sampling.

### make

public static DownsamplingIterator make(File samFile, DownsamplingIteratorFactory.Strategy strategy, double proportion, double accuracy, int seed)
Convenience method that constructs a downsampling iterator for all the reads in a SAM file. See `make(Iterator, Strategy, double, double, int)` for detailed parameter information.

### make

public static DownsamplingIterator make(SamReader reader, DownsamplingIteratorFactory.Strategy strategy, double proportion, double accuracy, int seed)
Convenience method that constructs a downsampling iterator for all the reads available from a SamReader. See `make(Iterator, Strategy, double, double, int)` for detailed parameter information.