Package htsjdk.samtools.util

# Class SamLocusIterator

java.lang.Object
htsjdk.samtools.util.AbstractLocusIterator<SamLocusIterator.RecordAndOffset,SamLocusIterator.LocusInfo>
htsjdk.samtools.util.SamLocusIterator

All Implemented Interfaces:
  `CloseableIterator<SamLocusIterator.LocusInfo>`, `Closeable`, `AutoCloseable`, `Iterable<SamLocusIterator.LocusInfo>`, `Iterator<SamLocusIterator.LocusInfo>`

public class SamLocusIterator extends AbstractLocusIterator<SamLocusIterator.RecordAndOffset,SamLocusIterator.LocusInfo>
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().

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final class`
`SamLocusIterator.LocusInfo`
The unit of iteration.
`static class`
`SamLocusIterator.RecordAndOffset`
Implementation of `AbstractRecordAndOffset` class for `SamLocusIterator`.

## Field Summary

### Fields inherited from class htsjdk.samtools.util.AbstractLocusIterator

`includeIndels`

## Constructor Summary

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

## Method Summary

### Methods inherited from class htsjdk.samtools.util.AbstractLocusIterator

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

### Methods inherited from class java.lang.Object

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

### Methods inherited from interface htsjdk.samtools.util.CloseableIterator

`stream, toList`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Methods inherited from interface java.util.Iterator

`forEachRemaining`

## Constructor Details

### SamLocusIterator

public SamLocusIterator(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

### SamLocusIterator

public SamLocusIterator(SamReader samReader, IntervalList intervalList)
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
  `intervalList` - Either the list of desired intervals, or null. Note that if an intervalList is passed in that is not coordinate sorted, it will eventually be coordinated sorted by this class.

### SamLocusIterator

public SamLocusIterator(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 eventually be coordinated sorted by this class.
  `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.