Using GNU Parallel to read arguments into a bash script
1
0
Entering edit mode
4.2 years ago
SaltedPork ▴ 170

Hi,

Here's my command:

 parallel -j 1 -a parameters.txt --colsep '\s+' ./pipeline.bioinformatics.sh {}

parameters.txt is a tsv file with 21 lines. Each line has 4 entries.

sample   Reads1   Reads2   ID

I am passing these commands into the sh file and assigning them to variables like

#!/bin/bash
sample=$1
Reads1=$2
Reads2=$3
ID=$4

My pipeline file uses a bunch of commands to assemble genomes, like Trimmomatic, samtools etc... When I run the command it skips through all of the java/python/perl my bash script is calling, any ideas why this is and what I should change?

gnu parallel bash • 1.7k views
ADD COMMENT
0
Entering edit mode
4.2 years ago
h.mon 35k

It would help if you paste the error messages / script output.

The shebang line is incorrect: you are missing #!, and the path to bash most likely is "/bin/bash" (check with which bash). So the shebang should be:

#!/bin/bash

edit: questions original shebang was /usr/bin/bash.

ADD COMMENT
0
Entering edit mode

Sorry my shebang is correct in the script. There is no error message. It prints everything to stnd out that it would normally do when running it as ./pipeline.sh Except it doesnt actually do any calculation, all the echo commands print, but python and perl stuff doesn't run.

ADD REPLY
0
Entering edit mode

If you run the script directly, does it work? Does:

 ./pipeline.bioinformatics.sh Sample read_1.fq read_2.fq ID

produce the desired output?

Without seeing your script, we can only shoot in the dark.

ADD REPLY

Login before adding your answer.

Traffic: 1663 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