How to adapt a for loop of `muscle` alignments using GNU Parallel?
2
0
Entering edit mode
2.6 years ago
O.rka ▴ 710

I'm trying to adapt the following lines of code for use with GNU parallel:

for ID in $(cut -f1 markers.tsv);
    do echo $ID;
    FAA=${ID}.faa.gz
    zcat ${FAA} | muscle -out ${ID}.msa
    done

However, the examples I'm seeing here do not show where I can use my ${ID} argument.

Can someone help me adapt this using --jobs 16?

This could be one a one liner:

for ID in $(cut -f1 markers.tsv);
    do echo $ID && FAA=${ID}.faa.gz && zcat ${FAA} | muscle -out ${ID}.msa
    done

Preferably without an intermediate script

alignment bash parallel • 1.2k views
ADD COMMENT
1
Entering edit mode
2.6 years ago
O.rka ▴ 710
cut -f1 markers.tsv | parallel --jobs 16 'zcat {}.faa.gz | muscle -out {}.msa'
ADD COMMENT
0
Entering edit mode
2.6 years ago
Sarah ▴ 60

How about something like this:

    cut -f1 markers.tsv | parallel --jobs 16 'zcat {1}.faa.gz | muscle -out {1}.msa'
ADD COMMENT
0
Entering edit mode

If you want to test how the parallel commands will look, add --dry-run for example:

    cut -f1 markers.tsv | parallel --dry-run --jobs 16 'zcat {1}.faa.gz | muscle -out {1}.msa'
ADD REPLY
0
Entering edit mode

@OP: Cut may not be necessary here. Try:

$ parallel --dry-run --colsep '\t'   'zcat {1}.faa.gz | muscle -out {1}.msa' :::: markers.tsv

you can also try:

$ parallel --dry-run --colsep '\t'  ' muscle < zcat {1}.faa.gz > {1}.msa' :::: markers.tsv
ADD REPLY

Login before adding your answer.

Traffic: 2006 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6