so I'm having a problem using samtools phase. 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!


1 Answer 1


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]
  • $\begingroup$ 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? $\endgroup$
    – Wtwiki
    Apr 23, 2020 at 13:34
  • $\begingroup$ I would recommend removing duplicates first. $\endgroup$ Apr 23, 2020 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.