# Class EdgeReadIterator

java.lang.Object
htsjdk.samtools.util.AbstractLocusIterator<EdgingRecordAndOffset, AbstractLocusInfo<EdgingRecordAndOffset>>
htsjdk.samtools.util.EdgeReadIterator

All Implemented Interfaces:
  `CloseableIterator<AbstractLocusInfo<EdgingRecordAndOffset>>, Closeable, AutoCloseable, Iterable<AbstractLocusInfo<EdgingRecordAndOffset>>, Iterator<AbstractLocusInfo<EdgingRecordAndOffset>>`

public class EdgeReadIterator extends AbstractLocusIterator<EdgingRecordAndOffset, AbstractLocusInfo<EdgingRecordAndOffset>>
Iterator that traverses a SAM File, accumulating information on a per-locus basis. Optionally takes a target interval list, in which case the loci returned are the ones covered by the interval list. If no target interval list, whatever loci are covered by the input reads are returned. By default duplicate reads and non-primary alignments are filtered out. Filtering may be changed via setSamFilters(). Difference from SamLocusIterator is that this implementation accumulates data only about start and end of alignment blocks from reads, not about each aligned base.

## Field Summary

### Fields inherited from class AbstractLocusIterator

`includeIndels`

## Constructor Summary

Constructors
Constructor
Description
`EdgeReadIterator(SamReader samReader)`
Prepare to iterate through the given SAM records, skipping non-primary alignments.
`EdgeReadIterator(SamReader samReader, IntervalList intervalList)`
Prepare to iterate through the given SAM records, skipping non-primary alignments.
`EdgeReadIterator(SamReader samReader, IntervalList intervalList, boolean useIndex)`
Prepare to iterate through the given SAM records, skipping non-primary alignments

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`advanceCurrentIntervalAndCheckIfIntervalContainsRead(SAMRecord rec)`
This function updates currentInterval according to the position of the record that it is presented and determines if the current read is fully contained in the currentInterval.
`void`
`setEmitUncoveredLoci(boolean emitUncoveredLoci)`
For correct work of `EdgeReadIterator` value `emitUncoveredLoci` must be true.
`void`
`setIncludeIndels(boolean includeIndels)`
`void`
`setMaxReadsToAccumulatePerLocus(int maxReadsToAccumulatePerLocus)`
This method isn't supported in current implementation.
`void`
`setQualityScoreCutoff(int qualityScoreCutoff)`
This method isn't supported in current implementation.

### Methods inherited from class AbstractLocusIterator

`close, getHeader, getIntervals, getMappingQualityScoreCutoff, getMaxReadsToAccumulatePerLocus, getQualityScoreCutoff, getReferenceSequence, hasNext, isEmitUncoveredLoci, isIncludeIndels, isIncludeNonPfReads, iterator, next, remove, setIncludeNonPfReads, setMappingQualityScoreCutoff, setSamFilters, startWithInsertion`

### Methods inherited from class Object

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

### Methods inherited from interface CloseableIterator

`stream, toList`

### Methods inherited from interface Iterable

`forEach, spliterator`

### Methods inherited from interface Iterator

`forEachRemaining`

## Constructor Details

### EdgeReadIterator

public EdgeReadIterator(SamReader samReader)
Prepare to iterate through the given SAM records, skipping non-primary alignments. Do not use BAM index even if available.

Parameters:
  `samReader` - must be coordinate sorted

### EdgeReadIterator

public EdgeReadIterator(SamReader samReader, IntervalList intervalList)
Prepare to iterate through the given SAM records, skipping non-primary alignments.

Parameters:
  `samReader` - must be coordinate sorted
  `intervalList` - Either the list of desired intervals, or null. Note that if an intervalList is passed in that is not coordinate sorted, it will be coordinated sorted by this class.

### EdgeReadIterator

public EdgeReadIterator(SamReader samReader, IntervalList intervalList, boolean useIndex)
Prepare to iterate through the given SAM records, skipping non-primary alignments

Parameters:
  `samReader` - must be coordinate sorted
  `intervalList` - Either the list of desired intervals, or null. Note that if an intervalList is passed in that is not coordinate sorted, it will be coordinated sorted here.
  `useIndex` - If true, do indexed lookup to improve performance. Not relevant if intervalList == null. It is no longer the case the useIndex==true can make performance worse. It should always perform at least as well as useIndex==false, and generally will be much faster.

## Method Details

### advanceCurrentIntervalAndCheckIfIntervalContainsRead

protected boolean advanceCurrentIntervalAndCheckIfIntervalContainsRead(SAMRecord rec)
This function updates currentInterval according to the position of the record that it is presented and determines if the current read is fully contained in the currentInterval.

Parameters:
  `rec` - The record we want to consider
Returns:
  True, if rec is fully contained in the current interval, otherwise false

### setMaxReadsToAccumulatePerLocus

public void setMaxReadsToAccumulatePerLocus(int maxReadsToAccumulatePerLocus)
This method isn't supported in current implementation.

Overrides:
  `setMaxReadsToAccumulatePerLocus` in class `AbstractLocusIterator<EdgingRecordAndOffset, AbstractLocusInfo<EdgingRecordAndOffset>>`
Parameters:
  `maxReadsToAccumulatePerLocus` - maximum number of `RecordAndOffset` objects to store for one loci in reference sequence.

### setQualityScoreCutoff

public void setQualityScoreCutoff(int qualityScoreCutoff)
This method isn't supported in current implementation.

Overrides:
  `setQualityScoreCutoff` in class `AbstractLocusIterator<EdgingRecordAndOffset, AbstractLocusInfo<EdgingRecordAndOffset>>`
Parameters:
  `qualityScoreCutoff` - the minimum base quality to include in `AbstractLocusInfo`.

### setEmitUncoveredLoci

public void setEmitUncoveredLoci(boolean emitUncoveredLoci)
For correct work of `EdgeReadIterator` value `emitUncoveredLoci` must be true.

Overrides:
  `setEmitUncoveredLoci` in class `AbstractLocusIterator<EdgingRecordAndOffset, AbstractLocusInfo<EdgingRecordAndOffset>>`
Parameters:
  `emitUncoveredLoci` - if false, iterator will skip uncovered loci in reference sequence, otherwise empty `AbstractLocusInfo` will be created for each loci.

### setIncludeIndels

public void setIncludeIndels(boolean includeIndels)

Overrides:
  `setIncludeIndels` in class `AbstractLocusIterator<EdgingRecordAndOffset, AbstractLocusInfo<EdgingRecordAndOffset>>`