2017-02-27 79 views
1

我對信息學比較陌生,剛剛發現parallel命令的優點。但是,我在使用管道和輸出時遇到了問題。並行gnu命令與管道配合使用

我使用這個命令:

parallel -j 2 echo ./hisat2 --dta -p 32 -x path/to/index -U {} | ./samtools view -b - > /path/to/storage/folder/{/.}.bam :::: fs1 > executable.sh 

fs1包含了所有我想要運行的文件列表。 executable.sh是可執行的命令列表。我希望fs1中列出的每個文件都可以通過程序(稱爲hisat2)單獨處理,輸出sam文件可以使用samtools轉換爲bam格式。然而,它似乎不喜歡管道 - 它抱怨以下幾點:

bash: /path/to/storage/folder/{/.}.bam: No such file or directory 
parallel: Warning: Input is read from the terminal. Only experts do this on purpose. Press CTRL-D to exit. 

我該如何克服這一點?唯一的解決辦法是先將所有文件處理爲SAM,然後進行並行BAM轉換?

回答

0

你需要引用的管道和重定向:

parallel -j 2 "./hisat2 --dta -p 32 -x path/to/index -U {} | ./samtools view -b - > /path/to/storage/folder/{/.}.bam" :::: fs1 

使用--dry-run,看看有什麼會運行:

parallel --dry-run -j 2 "./hisat2 --dta -p 32 -x path/to/index -U {} | ./samtools view -b - > /path/to/storage/folder/{/.}.bam" :::: fs1 

(你肯定samtools在當前目錄通常是安裝)

我可以建議你在man parallel_tutorial處走一小時嗎?你的命令行會愛你。

+0

這仍然不適合我,對不起...應該>有一個'>'?我會看看教程,歡呼 –

+0

不,但試試 - 幹運行。 –