# Class SamLocusAndReferenceIterator

java.lang.Object
htsjdk.samtools.util.IterableOnceIterator<SamLocusAndReferenceIterator.SAMLocusAndReference>
htsjdk.samtools.reference.SamLocusAndReferenceIterator

All Implemented Interfaces:
  `Closeable, AutoCloseable, Iterable<SamLocusAndReferenceIterator.SAMLocusAndReference>, Iterator<SamLocusAndReferenceIterator.SAMLocusAndReference>`

public class SamLocusAndReferenceIterator extends IterableOnceIterator<SamLocusAndReferenceIterator.SAMLocusAndReference>
Iterator that traverses a SAM File and a ReferenceFile, accumulating information on a per-locus basis. Only loci that are covered by the input reads are returned. Duplicate reads and non-primary alignments are filtered out. Iterator element holds both pileup (in the form of a LocusInfo object) and the reference base

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`SamLocusAndReferenceIterator.SAMLocusAndReference`
Small class to hold together a `SamLocusIterator.LocusInfo` and the reference base over that locus.

## Constructor Summary

Constructors
Constructor
Description
`SamLocusAndReferenceIterator(ReferenceSequenceFileWalker referenceFile, SamLocusIterator locusIterator)`
Constructor that takes a `ReferenceSequenceFile` and a `SamLocusIterator`.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`hasNext()`
`SamLocusAndReferenceIterator.SAMLocusAndReference`
`next()`

### Methods inherited from class IterableOnceIterator

`close, iterator, remove`

### Methods inherited from class Object

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

### Methods inherited from interface Iterable

`forEach, spliterator`

### Methods inherited from interface Iterator

`forEachRemaining`

## Constructor Details

### SamLocusAndReferenceIterator

public SamLocusAndReferenceIterator(ReferenceSequenceFileWalker referenceFile, SamLocusIterator locusIterator) throws IllegalArgumentException
Constructor that takes a `ReferenceSequenceFile` and a `SamLocusIterator`. The inputs must have equal `SAMSequenceDictionary`s and an `IllegalArgumentException` will be thrown otherwise.

Parameters:
  `referenceFile` -
  `locusIterator` -
Throws:
  `IllegalArgumentException` - if arguments have non-equal `SAMSequenceDictionary`s

## Method Details

### hasNext

public boolean hasNext()

### next

public SamLocusAndReferenceIterator.SAMLocusAndReference next()