brentp / bwa-meth

fast and accurate alignment of BS-Seq reads using bwa-mem and a 3-letter genome
https://arxiv.org/abs/1401.1129
MIT License
144 stars 54 forks source link

Output of bwa-meth in BAM format #72

Closed paulinehermans closed 1 year ago

paulinehermans commented 3 years ago

Hi,

I would like to have the output alignment file of bwa-meth in BAM format instead of SAM format. I think the easiest way is to convert SAM files in BAM files directly at the output of the bwameth.py command with samtools. I tried with the following command: bwameth.py --threads 16 --reference ref.fa sample_R1.fq.gz sample_R2.fq.gz | samtools view -b -o align.bam But I always get an error: [W::sam_read1] Parse error at line 1 [main_samview] truncated file. If I do not convert the output of bwameth.py in BAM, I obtained a normal SAM file so I don't understand what this error means.

Thanks in advance!

brentp commented 3 years ago

can you show the output of:

bwameth.py --threads 16 --reference ref.fa sample_R1.fq.gz sample_R2.fq.gz | head

?