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

bwa-mem2 cannot recognize the input from the pipe #77

Closed yewero closed 2 years ago

yewero commented 2 years ago

https://github.com/brentp/bwa-meth/blob/94e2b9beb03f88878172cdccb50b8f483a824035/bwameth.py#L366 In the example folder:

#bwameth.py index-mem2 ref.fa  # worked well
bwameth.py --reference ref.fa t_R1.fastq.gz t_R2.fastq.gz -t 12 | samtools view -b - > bwa-meth.bam

The cmd was:

bwameth.py c2t t_R1.fastq.gz t_R2.fastq.gz | \
bwa-mem2 mem -T 40 -B 2 -L 10 -CM -U 100 -p -R '@RG\tID:t_R\tSM:t_R' -t 12  ref.fa.bwameth.c2t -

An error will occur in the first strategy:

[E::main_mem] fail to open file `-'

Package version: bwa-meth.py 0.2.3 bwa-mem2 2.0pre2

brentp commented 2 years ago

does it work with /dev/stdin instead of - ?

yewero commented 2 years ago

It works well with /dev/stdin:

bwameth.py c2t t_R1.fastq.gz t_R2.fastq.gz | \
bwa-mem2 mem -T 40 -B 2 -L 10 -CM -U 100 -p -R '@RG\tID:t_R\tSM:t_R' -t 12  ref.fa.bwameth.c2t /dev/stdin
brentp commented 2 years ago

@PoisonAlien , should we make the change to /dev/stdin ?

PoisonAlien commented 2 years ago

Yes, I am ok with the change. I have been using this tool for a while now and, it's weird that I have never encountered it earlier. Regardless, this is probably the robust way than a dash since it is universally available.

brentp commented 2 years ago

Thanks. I have pushed that change and tagged v0.2.4