<p>I don't believe that is an option.  Internally we created a <a href="https://github.com/lh3/bwa/pull/36" rel="noreferrer">patch</a> and submitted it to <a href="https://github.com/lh3/bwa" rel="noreferrer">BWA</a> however that was 4 years ago and it has not been accepted.</p>

CC BY-SA 4.0
2018-12-05T03:29:12.540Z
Thanks. Did @user172818 ever give a reason why this feature isn't included?
EB2127
CC BY-SA 4.0
2018-12-05T09:26:05.563Z
see also https://www.biostars.org/p/352930/
Pierre
CC BY-SA 4.0
2018-12-05T19:13:00.590Z
@Pierre This is a great tool Pierre! I think it runs successfully for me. The problem is, I get errors downstream when using `samtools view`, i.e.. `[E::sam_parse1] CIGAR and query sequence are of different length` Are there work arounds?
EB2127
CC BY-SA 4.0
2018-12-05T19:54:58.327Z
I didn't test it with all the possible cases. Can you please try to isolate a minimal sam file containing the faulty reads ( all the reads with the same name) and send a bug report ? https://github.com/lindenb/jvarkit/issues/
Pierre
CC BY-SA 4.0
2018-12-07T05:03:59.043Z
@Pierre I may send you an e-mail instead. Thanks Pierre!
EB2127
CC BY-SA 4.0
2018-12-07T08:29:53.477Z
plindenbaum reverse(oohay) fr but I'll need a minimal failing SAM file.
Pierre
CC BY-SA 4.0
2018-12-04T16:48:40.810Z
2018-12-04T16:48:40.810Z
Bioathlete
<p>I've been running <code>bwa mem -a</code> for alignment, using the <code>-a</code> flag---this will </p>

<blockquote>
  <p>output all alignments for SE or unpaired PE</p>
</blockquote>

<p>I've noticed in the SAM that there are several alignments with <code>*</code> in the <code>SEQ</code> and <code>QUAL</code> fields. Based on the documentation:</p>

<blockquote>
  <ol start="10">
  <li>SEQ: segment SEQuence. This field can be a ‘*’ when the sequence is not stored. If not a ‘*’, the length of the sequence must equal the
  sum of lengths of M/I/S/=/X operations in CIGAR. An ‘=’ denotes the
  base is identical to the reference base. No assumptions can be made on
  the letter cases.</li>
  <li>QUAL: ASCII of base QUALity plus 33 (same as the quality string in the Sanger FASTQ format). A base quality is the phred-scaled base
  error probability which equals −10 log10 Pr{base is wrong}. This field
  can be a ‘*’ when quality is not stored. If not a ‘*’, SEQ must not be
  a ‘*’ and the length of the quality string ought to equal the length
  of SEQ.</li>
  </ol>
</blockquote>

<p>it appears the sequence isn't stored. </p>

<p>I would strongly prefer to have the sequence in this case. Is there any to direct bwa to output these sequences? </p>

CC BY-SA 4.0
2018-12-05T15:23:16.457Z
Are you aware that many of these records are secondary/supplementary alignments? Does your workfow/model require/benefit from these alignments and handle them correctly?
Daniel Standage
CC BY-SA 4.0
2018-12-05T15:59:37.107Z
@DanielStandage "Are you aware that many of these records are secondary/supplementary alignments?" Yes. " Does your workfow/model require/benefit from these alignments and handle them correctly?". Benefit, yes.
EB2127
<phylogenetics><bwa>
How to output all sequences with bwa mem, not `*`?
# How to output all sequences with bwa mem, not `*`?

(Asked by: username_0 on 2018-12-04)

I've been running `bwa mem -a` for alignment, using the `-a` flag---this will

> output all alignments for SE or unpaired PE

I've noticed in the SAM that there are several alignments with `*` in the `SEQ` and `QUAL` fields. Based on the documentation:

> 10. SEQ: segment SEQuence. This field can be a ‘\*’ when the sequence is not stored. If not a ‘\*’, the length of the sequence must equal the
>     sum of lengths of M/I/S/=/X operations in CIGAR. An ‘=’ denotes the
>     base is identical to the reference base. No assumptions can be made on
>     the letter cases.
> 11. QUAL: ASCII of base QUALity plus 33 (same as the quality string in the Sanger FASTQ format). A base quality is the phred-scaled base
>     error probability which equals −10 log10 Pr{base is wrong}. This field
>     can be a ‘\*’ when quality is not stored. If not a ‘\*’, SEQ must not be
>     a ‘\*’ and the length of the quality string ought to equal the length
>     of SEQ.

it appears the sequence isn't stored.

I would strongly prefer to have the sequence in this case. Is there any to direct bwa to output these sequences?

**Tags:** phylogenetics, bwa
> **Comments:**
> **username_1**: Are you aware that many of these records are secondary/supplementary alignments? Does your workfow/model require/benefit from these alignments and handle them correctly?  
> **username_0**: @DanielStandage "Are you aware that many of these records are secondary/supplementary alignments?" Yes. " Does your workfow/model require/benefit from these alignments and handle them correctly?". Benefit, yes.  

---

## 1 answers

### Answer by username_2 on 2018-12-04. Score: 5

I don't believe that is an option. Internally we created a [patch](https://github.com/lh3/bwa/pull/36) and submitted it to [BWA](https://github.com/lh3/bwa) however that was 4 years ago and it has not been accepted.

> **Comments:**
> **username_0**: Thanks. Did @user172818 ever give a reason why this feature isn't included?  
> **username_3**: see also https://www.biostars.org/p/352930/  
> **username_0**: @Pierre This is a great tool Pierre! I think it runs successfully for me. The problem is, I get errors downstream when using `samtools view`, i.e.. `[E::sam_parse1] CIGAR and query sequence are of different length` Are there work arounds?  
> **username_3**: I didn't test it with all the possible cases. Can you please try to isolate a minimal sam file containing the faulty reads ( all the reads with the same name) and send a bug report ? https://github.com/lindenb/jvarkit/issues/  
> **username_0**: @Pierre I may send you an e-mail instead. Thanks Pierre!  
> **username_3**: plindenbaum reverse(oohay) fr but I'll need a minimal failing SAM file.  

---

