What is a samtools mpileup reference skip?

The samtools documentation for mpileup states:

At this column, a dot stands for a match to the reference base on the forward strand, a comma for a match on the reverse strand, a '>' or '<' for a reference skip ... Similarly, a pattern -[0-9]+[ACGTNacgtn]+' represents a deletion from the reference.

What is a reference skip?

That documentation has been expanded recently (see PR #1055) and now describes the characters seen in this column in more detail:

Forward   Reverse                    Meaning
---------------------------------------------------------------
. dot    , comma   Base matches the reference base
ACGTN     acgtn    Base is a mismatch to the reference base
>         <      Reference skip (due to CIGAR "N")
*         *      Deletion of the reference base (CIGAR "D")


(And so on — see the pull request or doc/samtools-mpileup.1 on the develop branch for the complete pileup format description. The documentation on that web page will be updated when this is released in a new samtools release.)

As noted in https://bioinformatics.stackexchange.com/a/421/134, SAM has always had separate D (deletion from the reference) and N (skipped region from the reference) operators. These are treated similarly computationally but emitted intentionally by aligners to distinguish introns and the like from other deletions.

Skipped references are similar to deletions, but the different symbols used are indicating that it's an expected deletion. The most common use for a skipped reference is when excluding intronic sequence from cDNA reads that are being matched to a genome reference.

Note that the skipped reference bases are added by the mapping program, which generates the SAM/BAM/CRAM format and decides on whether to call a deletion or a skipped base.

• How would samtools recognize that? Surely it doesn't mode splice sites! Does this mean we only see a reference skip if using a particular samtools flag to tell it we're feeding it cDNA? Otherwise, won't it just see a deletion? Nov 9 '19 at 11:37
• Samtools is a set of tools to operate on SAM/BAM/CRAM files; it doesn't generate them in the first place. I've added clarification to my answer.
– gringer
Nov 9 '19 at 18:11
• thanks, I know what they are. What I'm wondering is how samtools will differentiate between a deletion and a skipped reference. Both will appear as a gapped alignment, presumably, so what's the difference between one and the other in the bam/sam file? Nov 9 '19 at 23:03
• The person who asked the question already mentioned that: "a '>' or '<' for a reference skip... a pattern -[0-9]+[ACGTNacgtn]+' represents a deletion from the reference"
– gringer
Nov 10 '19 at 11:03
• I know. I guess I must be missing something really obvious, but what I'm asking is how samtools differentiates between a normal deletion and a reference skip. Since a reference skip is just a deletion, I don't see how samtools would know to mark it specially. Presumably, the necessary information is somehow encoded in the bam, but what is that? How can samtools know whether this deletion is an expected one, as you put it? Nov 10 '19 at 13:38