Parallel是一个shell工具,可以在一台或者多台计算机上并行执行任务。和xargs有相似的使用方法,能代替shell中的大部分循环操作并且使任务变得更快,更多详细内容请自己慢慢看~
GNU parallel is a shell tool for executing jobs in parallel using one or more computers. A job can be a single command or a small script that has to be run for each of the lines in the input. The typical input is a list of files, a list of hosts, a list of users, a list of URLs, or a list of tables. A job can also be a command that reads from a pipe. GNU parallel can then split the input and pipe it into commands in parallel.
安装
- 可以使用一行简单的命令进行安装
(wget -O - pi.dk/3 || curl pi.dk/3/ || fetch -o - [http://pi.dk/3)](http://pi.dk/3)) | bash
- 也可以这样安装
wget http://ftpmirror.gnu.org/parallel/parallel-20160422.tar.bz2
tar -jxvf parallel-20160422.tar.bz2
cd parallel-20160422
./configure && make && sudo make install
简单的使用
- 在这之前我们都这么用:
for i in `ls *fq`; do
fastqc $i
done
- 现在我们可以这么用:
parallel 'fastqc {}' ::: *fq
parallel 'zcat {} > {.}.unpacked' ::: *.gz
find *bam | parallel 'bedtools coverage -hist -abam {} -b target_regions.bed | grep ^all > {}.hist.all.txt'
更多详细使用方法请“找男人”,或者请见开源中国的这一篇详细介绍:请戳这里
man parallel
网友评论