Package htsjdk.samtools

# Class SamPairUtil.SetMateInfoIterator

java.lang.Object
htsjdk.samtools.util.PeekableIterator<SAMRecord>
htsjdk.samtools.SamPairUtil.SetMateInfoIterator

All Implemented Interfaces:
  `CloseableIterator<SAMRecord>`, `Closeable`, `AutoCloseable`, `Iterator<SAMRecord>`

Enclosing class:
  `SamPairUtil`

public static class SamPairUtil.SetMateInfoIterator extends PeekableIterator<SAMRecord>
A class to iterate through SAMRecords and set mate information on the given records, and optionally set the mate cigar tag (true by default).

## Constructor Summary

Constructors
Constructor
Description
`SetMateInfoIterator(Iterator<SAMRecord> iterator)`
By default, the mate cigar tag is set
`SetMateInfoIterator(Iterator<SAMRecord> iterator, boolean setMateCigar)`
`SetMateInfoIterator(Iterator<SAMRecord> iterator, boolean setMateCigar, boolean ignoreMissingMates)`

## Method Summary

Modifier and Type
Method
Description
`long`
`getNumMateCigarsAdded()`
`boolean`
`hasNext()`
True if there are more items, in which case both next() and peek() will return a value.
`SAMRecord`
`next()`
Returns the next object and advances the iterator.
`SAMRecord`
`peek()`
Returns the next object but does not advance the iterator.

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

`close, remove`

### 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.util.Iterator

`forEachRemaining`

## Constructor Details

### SetMateInfoIterator

public SetMateInfoIterator(Iterator<SAMRecord> iterator)
By default, the mate cigar tag is set

Parameters:
  `iterator` - the iterator to wrap

### SetMateInfoIterator

public SetMateInfoIterator(Iterator<SAMRecord> iterator, boolean setMateCigar)

Parameters:
  `iterator` - the iterator to wrap
  `setMateCigar` - true if we are to update/create the Mate CIGAR (MC) optional tag, false if we are to clear any mate cigar tag that is present.

### SetMateInfoIterator

public SetMateInfoIterator(Iterator<SAMRecord> iterator, boolean setMateCigar, boolean ignoreMissingMates)

Parameters:
  `iterator` - the iterator to wrap
  `setMateCigar` - true if we are to update/create the Mate CIGAR (MC) optional tag, false if we are to clear any mate cigar tag that is present.
  `ignoreMissingMates` - set this to true if we are to ignore missing mates, otherwise an exception will be thrown when a missing mate is encountered

## Method Details

### getNumMateCigarsAdded

public long getNumMateCigarsAdded()

Returns:
  the current number of mate cigars added. This could be more than the number of records returned.

### hasNext

public boolean hasNext()
Description copied from class: `PeekableIterator`
True if there are more items, in which case both next() and peek() will return a value.

Specified by:
  `hasNext` in interface `Iterator<SAMRecord>`
Overrides:
  `hasNext` in class `PeekableIterator<SAMRecord>`

### next

public SAMRecord next()
Description copied from class: `PeekableIterator`
Returns the next object and advances the iterator.

Specified by:
  `next` in interface `Iterator<SAMRecord>`
Overrides:
  `next` in class `PeekableIterator<SAMRecord>`

### peek

public SAMRecord peek()
Description copied from class: `PeekableIterator`
Returns the next object but does not advance the iterator. Subsequent calls to peek() and next() will return the same object.

Overrides:
  `peek` in class `PeekableIterator<SAMRecord>`