# HISAT2 - are all multi mapped reads reported by default?

While going through the HISAT2 manual, one can see this:

Two alignments for the same individual read are "distinct" if they map the same read to different places. Specifically, we say that two alignments are distinct if there are no alignment positions where a particular read offset is aligned opposite a particular reference offset in both alignments with the same orientation. E.g. if the first alignment is in the forward orientation and aligns the read character at read offset 10 to the reference character at chromosome 3, offset 3,445,245, and the second alignment is also in the forward orientation and also aligns the read character at read offset 10 to the reference character at chromosome 3, offset 3,445,245, they are not distinct alignments.

Two alignments for the same pair are distinct if either the mate 1s in the two paired-end alignments are distinct or the mate 2s in the two alignments are distinct or both.

Default mode: search for one or more alignments, report each

and then there is -k parameter (analogous to bowtie2 -K parameter)

which defines:

HISAT2 searches for up to N distinct, primary alignments for each read, where N equals the integer specified with the -k parameter. Primary alignments mean alignments whose alignment score is equal or higher than any other alignments. It is possible that multiple distinct alignments have the same score. That is, if -k 2 is specified, HISAT2 will search for at most 2 distinct alignments. The alignment score for a paired-end alignment equals the sum of the alignment scores of the individual mates. Each reported read or pair alignment beyond the first has the SAM 'secondary' bit (which equals 256) set in its FLAGS field. See the SAM specification for details.

This is a bit confusing, as the first quote means that HISAT2 finds all distinct valid alignment and reports them by default, and the second quote says that when -k option is used, it will only report a subset of alignments which it would have reported by default. Am I correct in this inference or does one needs to use -k option to enable "multi-mapping"?

You said:

...the first quote means that HISAT2 finds all distinct valid alignment and reports them by default.

Not exactly. The first section you quoted doesn't say it will find and report all distinct alignments, but rather that it would find and report one or more distinct alignments. It's a subtle difference, but an important one.

That section describes how distinct mappings are defined, not how many are reported. The second section you quoted, as well as the documentation for the -k parameter, are all consistent with this interpretation.

-k <int>        It searches for at most <int> distinct, primary alignments for
each read. Primary alignments mean alignments whose alignment
score is equal or higher than any other alignments. The search
terminates when it can't find more distinct valid alignments, or
when it finds <int>, whichever happens first. The alignment
score for a paired-end alignment equals the sum of the alignment
scores of the individual mates. Each reported read or pair
alignment beyond the first has the SAM 'secondary' bit (which
equals 256) set in its FLAGS field. For reads that have more
than <int> distinct, valid alignments, hisat2 does not guarantee
that the <int> alignments reported are the best possible in
terms of alignment score. Default: 5 (HFM) or 10 (HGFM)

Note: HISAT2 is not designed with large values for -k in mind,
and when aligning reads to long, repetitive genomes large -k can
be very, very slow.


By default, 5 or 10 distinct mappings are reported (depending on the mode), but you can control this with the -k parameter.

• Aha, thanks for clearing it up! Although I'm still a bit confused to why HISAT2 still has --secondary if setting up -k instructs it to search for multiple alignments n alignments regardless. Mar 8 '19 at 9:13
• The -k parameter corresponds only to primary alignments: cases where distinct alignments have an identical high score. If an alignment has a less-than-optimal score, it is a secondary alignment. Mar 8 '19 at 12:49