使用 GNU 并行的管道命令 (samtools)

问题描述

我正在尝试在管道时并行运行命令。原因是中间文件太大了,放不下

我有以下代码,它们可以单独工作:

#fixmate and convert to bam
parallel --verbose --link -j 4  'samtools fixmate -O bam,level=1 {1} /home/Teste1/samtools/unsorted/{/.}.bam -@ 8' ::: /home/Teste1/star/twopassoverhang/*.fqAligned.out.sam 

#sort according to coordinate
parallel --verbose --link -j 4  'samtools sort {1} -o /home/Teste1/samtools/sorted/{/.}-sorted.bam -@ 8' ::: /home/Teste1/samtools/unsorted/*.bam

#index bam files
parallel --verbose --link -j 4  'samtools index {1} -@ 8' ::: /home/Teste1/samtools/sorted/*-sorted.bam

我试过了:

parallel --verbose --link -j 4  'samtools fixmate -O bam,level=1 {1} - -@ 4 | / #fixmate and output bam to nextcommand
samtools sort - - -@ 4 | / #sort bams
tee /home/Teste1/samtools/sorted/{/.}-sorted.bam | / #save sorted bam file to disk
samtools index - -@ 4' ::: /home/Teste1/star/twopassoverhang/*.fqAligned.out.sam  #creates index

但我通过 --dry-run 得到以下结果:

 samtools fixmate -O bam,level=1 '/homeTeste1/star/twopassoverhang/101_FRAS202421991-1a_1.fqAligned.out.sam' - -@ 4 |
 samtools sort - - -@ 4 |
 tee /home/Teste1/samtools/sorted/101_FRAS202421991-1a_1.fqAligned.out-sorted.bam |
 samtools index - -@ 4

跑步给了我:

samtools index: "-" is in a format that cannot be usefully indexed
samtools fixmate -O bam,level=1 '/home/Teste1/star/twopassoverhang/12_FRAS202372578-2r_1.fqAligned.out.sam' - -@ 4 | samtools sort - - -@ 4 | tee /home/Teste1/samtools/sorted/12_FRAS202372578-2r_1.fqAligned.out-sorted.bam | samtools index - -@ 4
[bam_sort] Use -T PREFIX / -o FILE to specify temporary and final output files
Usage: samtools sort [options...] [in.bam]

我尝试了其他一些变体,但没有成功。有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)