<p>You said:</p>

<blockquote>
  <p>...the first quote means that HISAT2 finds all distinct valid alignment and reports them by default.</p>
</blockquote>

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

<p>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 <code>-k</code> parameter, are all consistent with this interpretation.</p>

<blockquote>
<pre><code>-k &lt;int&gt;        It searches for at most &lt;int&gt; 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 &lt;int&gt;, 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 &lt;int&gt; distinct, valid alignments, hisat2 does not guarantee
                that the &lt;int&gt; 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.
</code></pre>
</blockquote>

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

CC BY-SA 4.0
2019-03-08T09:13:02.470Z
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.
Siddharth
CC BY-SA 4.0
2019-03-08T12:49:40.577Z
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.
Daniel Standage
CC BY-SA 4.0
2019-03-07T18:00:30.253Z
2019-03-07T18:00:30.253Z
Daniel Standage
<p>While going through the <a href="https://ccb.jhu.edu/software/hisat2/manual.shtml" rel="nofollow noreferrer">HISAT2 manual</a>, one can see this: </p>

<blockquote>
  <p>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.</p>
  
  <p>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.</p>
  
  <p>Default mode: search for one or more alignments, report each</p>
</blockquote>

<p>and then there is -k parameter (analogous to bowtie2 -K parameter)</p>

<p>which defines: </p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>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"?</p>

<read-mapping>
HISAT2 - are all multi mapped reads reported by default?
# HISAT2 - are all multi mapped reads reported by default?

(Asked by: username_0 on 2019-03-07)

While going through the [HISAT2 manual](https://ccb.jhu.edu/software/hisat2/manual.shtml), 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"?

**Tags:** read-mapping

---

## 1 answers

### Answer by username_1 on 2019-03-07. Score: 3 | Accepted answer

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         It searches for at most  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 , 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  distinct, valid alignments, hisat2 does not guarantee
                that the  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.

> **Comments:**
> **username_0**: 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.  
> **username_1**: 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.  

---

