GNU parallel 将多个文件的输出合并为一个。为什么?
GNU parallel is merging the ouput for multiple files into one. Why?
我是运行 GNU并行。与我其他分析中的输出不同,此分析的输出很奇怪。
我的代码:
# set the path of the required program
samtools=/usr/local/apps/samtools/0.1.19-gcc412/samtools
TempDir=/gpfs_common/share03/uncg/bkgiri/apps/temp_files/
# run the process for 4 samples in 4 different cores
parallel --tmpdir ${TempDir} --jobs 4 ${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed > realigned_{}Filtered.bam ::: ms01e ms02g ms03g ms04h
- 我期望每个输入有 4 个不同的输出文件,每个文件命名为 realigned_ms01eFiltered.bam、realigned_ms02gFiltered.bam 等
- 但是,我得到一个名为
realigned_{}Filtered.bam
的大文件。我以前使用其他工具从未遇到过这个问题。
我也试过:
parallel --tmpdir ${TempDir} --jobs 4 '${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed > realigned_{}Filtered.bam' ::: ms01e ms02g ms03g ms04h
# which now gives me another type of error
有什么建议吗?
如@choroba 所述:> 甚至在 parallel 可以看到它之前就被 shell 解释为重定向。
所以,最后我找到了解决这个问题的两种方法。
方法A:我们可以在" "
内解释整个命令,我认为这在功能上更有效。
parallel --tmpdir ${TempDir} --jobs 4 "${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed > realigned_{}Filtered.bam" ::: ms01e ms02g ms03g ms04h
方法 B: 或者,我们可以解释 " "
内的输出。这允许 >
被解释为文本,当 pipedin 作为 stdin 作为输出而不是重定向时。
parallel --tmpdir ${TempDir} --jobs 4 ${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed ">" realigned_{}Filtered.bam ::: ms01e ms02g ms03g ms04h
我测试了这两种方法,两种方法都给出了完全相同的结果。所以,任何一个都可以安全调用。
谢谢,
我是运行 GNU并行。与我其他分析中的输出不同,此分析的输出很奇怪。
我的代码:
# set the path of the required program
samtools=/usr/local/apps/samtools/0.1.19-gcc412/samtools
TempDir=/gpfs_common/share03/uncg/bkgiri/apps/temp_files/
# run the process for 4 samples in 4 different cores
parallel --tmpdir ${TempDir} --jobs 4 ${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed > realigned_{}Filtered.bam ::: ms01e ms02g ms03g ms04h
- 我期望每个输入有 4 个不同的输出文件,每个文件命名为 realigned_ms01eFiltered.bam、realigned_ms02gFiltered.bam 等
- 但是,我得到一个名为
realigned_{}Filtered.bam
的大文件。我以前使用其他工具从未遇到过这个问题。
我也试过:
parallel --tmpdir ${TempDir} --jobs 4 '${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed > realigned_{}Filtered.bam' ::: ms01e ms02g ms03g ms04h
# which now gives me another type of error
有什么建议吗?
如@choroba 所述:> 甚至在 parallel 可以看到它之前就被 shell 解释为重定向。
所以,最后我找到了解决这个问题的两种方法。
方法A:我们可以在
" "
内解释整个命令,我认为这在功能上更有效。parallel --tmpdir ${TempDir} --jobs 4 "${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed > realigned_{}Filtered.bam" ::: ms01e ms02g ms03g ms04h
方法 B: 或者,我们可以解释
" "
内的输出。这允许>
被解释为文本,当 pipedin 作为 stdin 作为输出而不是重定向时。parallel --tmpdir ${TempDir} --jobs 4 ${samtools} view -b -q 40 realigned_{}.bam -L DNA_Samples.Passed_Variants.Final.bed ">" realigned_{}Filtered.bam ::: ms01e ms02g ms03g ms04h
我测试了这两种方法,两种方法都给出了完全相同的结果。所以,任何一个都可以安全调用。
谢谢,