Adding parallel capabilities to a FOR task -
i want execute following command:
for in {0-months,3-months,6-months,9-months,12-months,ec1,ec2_cz,ec2,ec3}; freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/${i}.vcf ${i}.sort.grp.bam; done
but these task independent of each other, , can run in parallel. wondering if there way gnu parallel.
usually when using parallel, have file listing commands needed run, in case this:
freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/0-months.vcf 0-months.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/3-months.vcf 3-months.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/6-months.vcf 6-months.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/9-months.vcf 9-months.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/12-months.vcf 12-months.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/ec1.vcf ec1.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/ec2_cz.vcf ec2_cz.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/ec2.vcf ec2.sort.grp.bam freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/ec3.vcf ec3.sort.grp.bam
so when file ready, run:
parallel -j 4 -a file freebayes
but requires writing commands out file, invoking parallel, there must simpler way.
this seems work:
parallel -j 4 -a \ <(for in {0-months,3-months,6-months,9-months,12-months,ec1,ec2_cz,ec2,ec3}; echo "freebayes --fasta-reference ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous --min-coverage 10 -f 0.01 -c 2 --vcf vcf/${i}.vcf ${i}.sort.grp.bam"; done) freebayes
but looks silly... easier way this? thanks!
i puzzled how came extremely convoluted (but working) way this:
parallel -j 4 freebayes --fasta-reference \ ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous \ --min-coverage 10 -f 0.01 -c 2 --vcf vcf/{}.vcf {}.sort.grp.bam \ ::: 0-months 3-months 6-months 9-months 12-months ec1 ec2_cz ec2 ec3
if these vcf files in vcf-dir , 4-core machine, can do:
parallel freebayes --fasta-reference \ ../genome/eciii_lemming_assembly_masked.fasta --pooled-continuous \ --min-coverage 10 -f 0.01 -c 2 --vcf {} {/.}.sort.grp.bam \ ::: vcf/*.vcf
have walked through tutorial? man parallel_tutorial
have watched intro videos: https://www.youtube.com/playlist?list=pl284c9ff2488bc6d1
have looked @ examples: less=+/example: man parallel
Comments
Post a Comment