Takes the alignment of the read sequence
readSeq
to the reference sequence
refSeq
starting at 0-based position
refIndex
on the
refSeq
and specified by its
cigar
.
The last argument
readIndex
specifies 0-based position on the read where the alignment described by the
cigar
starts. Usually cigars specify alignments of the whole read to the ref, so that readIndex is normally 0.
Use non-zero readIndex only when the alignment cigar represents alignment of a part of the read. The refIndex in this case
should be the position where the alignment of that part of the read starts at. In other words, both refIndex and readIndex are
always the positions where the cigar starts on the ref and on the read, respectively.
If the alignment has one or more indels, this method attempts to move them left across a stretch of repetitive bases.
For instance, if the original cigar specifies that (any) one AT is deleted from a repeat sequence TATATATA, the output
cigar will always mark the leftmost AT as deleted. If there is no indel in the original cigar or if the indel position
is determined unambiguously (i.e. inserted/deleted sequence is not repeated), the original cigar is returned.
Note that currently we do not actually support the case where there is more than one indel in the alignment. We will throw
an exception if there is -- unless the