Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-05T03:29:12.540Z
Answers.Text: Thanks. Did @user172818 ever give a reason why this feature isn't included?
Answers.UserDisplayName: EB2127
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-05T09:26:05.563Z
Answers.Text: see also https://www.biostars.org/p/352930/
Answers.UserDisplayName: Pierre
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-05T19:13:00.590Z
Answers.Text: @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?
Answers.UserDisplayName: EB2127
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-05T19:54:58.327Z
Answers.Text: 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/
Answers.UserDisplayName: Pierre
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-07T05:03:59.043Z
Answers.Text: @Pierre I may send you an e-mail instead. Thanks Pierre!
Answers.UserDisplayName: EB2127
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-07T08:29:53.477Z
Answers.Text: plindenbaum reverse(oohay) fr but I'll need a minimal failing SAM file.
Answers.UserDisplayName: Pierre
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-12-04T16:48:40.810Z
Answers.LastActivityDate: 2018-12-04T16:48:40.810Z
Answers.UserDisplayName: Bioathlete
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-05T15:23:16.457Z
Comments.Text: 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?
Comments.UserDisplayName: Daniel Standage
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-12-05T15:59:37.107Z
Comments.Text: @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.
Comments.UserDisplayName: EB2127
Tags: <phylogenetics><bwa>
Title: How to output all sequences with bwa mem, not `*`?
ThreadText: # 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**: @username_1 "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**: @username_3 This is a great tool username_3! 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**: @username_3 I may send you an e-mail instead. Thanks username_3!  
  > **username_3**: plindenbaum reverse(oohay) fr but I'll need a minimal failing SAM file.  
  
  ---
  
  