This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Issue of using freebayes to do the variant calling

Hi, this is my first time to use freebayes. I met a problem when I tried to use it to do the variant calling for 2 samples together.

I just use the command

freebayes -f ref.fasta a.bam b.bam > c.vcf.

Then, I got the error msg as : mismatched sort order in b.bam, expected unsorted, but found coordinate. Does this mean it expected b.bam to be unsorted?

I followed the manual , all the bam files have been sorted, marked duplicates, added read groups, reordered and indexed.

The way I used to get the bam files for freebayes are:

  1. use TMAP to get the .sam file
  2. use samtools to convert sam file to bam file
  3. use samtools to sort the bam file
  4. use samtools to remove duplicates
  5. use bamaddrg to add read group
  6. use picard to reorder the bam file
  7. use samtools to sort the reordered bam file
  8. use samtools to index the sorted reordered bam file

Then, I use the freebayes to do the calling for two files and got the above error.

Can anyone give me some suggestions?

Thank you

freebayes

Try 1, 2 3, 5, 4, 8 and freebayes.

But in the manual of freebayes, they suggested to remove the duplicates. Why skip this step? Thank you.

Sorry, I shouldn't have omitted it, typo. I corrected answer.

I have followed your suggested steps, got the same error:

ERROR(freebayes): Could not open input BAM files
BamMultiReader::Open: unable to open inconsistent files:
BamMultiReader::ValidateReaders: mismatched sort order in b.bam, expected unsorted, but found coordinate.

Is freebayes able to analysis bam files of different samples together?

0 answers

No answers yet.

Log in to answer this question.