Answers.Body: <p>This is what I see in my samtools phase (v1.10)</p>
  
  <pre><code>Usage:   samtools phase [options] &lt;in.bam&gt;
  </code></pre>
  
  <p>samtools phase only takes a bam file as an input. But you are specifying a .fasta file as an input. If you want to specify the reference genome, you should be using the argument "--reference" as described here</p>
  
  <pre><code>      --reference FILE
             Reference sequence FASTA FILE [null]
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-23T13:34:03.290Z
Answers.Text: Oh, you're right! I also tried that but it didn't work. I managed to make it work and I'll add an answer shortly. But before that I want to ask a little question:  in my pipeline I also remove pcr duplicates with the fixmate/markdup steps. Is it better to phase the reads before or after removing the duplicates?
Answers.UserDisplayName: Wtwiki
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-23T18:05:23.627Z
Answers.Text: I would recommend removing duplicates first.
Answers.UserDisplayName: Geraldine_VdAuwera
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-04-22T23:31:54.473Z
Answers.LastActivityDate: 2020-04-22T23:31:54.473Z
Answers.UserDisplayName: KT8
Body: <p>so I'm having a problem using <a href="http://www.htslib.org/doc/samtools-phase.html" rel="nofollow noreferrer">samtools phase</a>. I'm trying to phase my .bam archives that where generated by aligning my samples with my reference genome. Following the documentation I tried the command: </p>
  
  <p><code>samtools phase -A  my_referenceGenome.fasta   my_sample_toBePhased.bam</code></p>
  
  <p>The -A flag stands for dropping reads with ambiguous phase. The <strong>error</strong> I get is: <code>[W::sam_read1] Parse error at line 1</code>. I generated .bam files with and without the SAM header but the error persists.</p>
  
  <p>I feel like I am missing something basic but that isn't clearly stated anywere. Does the <code>my_referenceGenome.fasta</code> archive needs to be previously phased? If so, how can I do it?</p>
  
  <p>Thank you so much!</p>
  
Tags: <sam><fasta><samtools><phase>
Title: Phasing problem using "samtools phase"
ThreadText: # Phasing problem using "samtools phase"
  
  (Asked by: username_0 on 2020-04-22)
  
  so I'm having a problem using [samtools phase](http://www.htslib.org/doc/samtools-phase.html). I'm trying to phase my .bam archives that where generated by aligning my samples with my reference genome. Following the documentation I tried the command:
  
  `samtools phase -A my_referenceGenome.fasta my_sample_toBePhased.bam`
  
  The -A flag stands for dropping reads with ambiguous phase. The **error** I get is: `[W::sam_read1] Parse error at line 1`. I generated .bam files with and without the SAM header but the error persists.
  
  I feel like I am missing something basic but that isn't clearly stated anywere. Does the `my_referenceGenome.fasta` archive needs to be previously phased? If so, how can I do it?
  
  Thank you so much!
  
  **Tags:** sam, fasta, samtools, phase
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-04-22. Score: 2
  
  This is what I see in my samtools phase (v1.10)
  
  ```
  Usage:   samtools phase [options] <in.bam>
  
  ```
  
  samtools phase only takes a bam file as an input. But you are specifying a .fasta file as an input. If you want to specify the reference genome, you should be using the argument "--reference" as described here
  
  ```
        --reference FILE
             Reference sequence FASTA FILE [null]
  
  ```
  
  > **Comments:**
  > **username_0**: Oh, you're right! I also tried that but it didn't work. I managed to make it work and I'll add an answer shortly. But before that I want to ask a little question:  in my pipeline I also remove pcr duplicates with the fixmate/markdup steps. Is it better to phase the reads before or after removing the duplicates?  
  > **username_2**: I would recommend removing duplicates first.  
  
  ---
  
  