This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Parsing arguments in BWA tool

How can I introduce arguments in an script containing third parties

I want to be able to run the script ./ sam2bam.sh argument1 argument 2 `

# Load pipeline settings
. *.config

FASTAQ1=$1
FASTAQ2=$2

bwa mem \
    -R '@RG\tID:'"$RunID"'_'"$Sample_ID"'\tSM:'"$Sample_ID"'\tPL:'"$Platform"'\tLB:'"$ExperimentName" \
    "$refgenome4bwa" \
    "${FASTAQ1}"  "${FASTAQ2}"  \
    > output.sam

The argument taken from .config work but the argument parsing from the command line do not work. I have tried "${FASTAQ1}" and "$FASTAQ1"

bwa

I think first and foremost everyone should know bash, if someone cannot make a thing work in bash, the other tools only add another layer of complexity,

this is a valid bioinformatics question, how come snakemake is bioinformatics but a bioinformatics script in bash is not?

I agree that bash is basic knowledge one should have. In contrast, I disagree with the statement that these tools are necessarily an extra layer of complexity. Sure, there is an initial learning curve and you can type a simple bash script in 5' but the fact alone on how much lines you have to write to get optparse working in bash (while this comes out of the box for both SM and NF) shows that this is a good investment of time.

the $1 and $2 in your script already does that,

it makes your script take parameters from command line exactly in the way you want it. Take this script:

cat test.sh 

it contains:

echo Hello $1

use it:

bash test.sh Jane

prints:

Hello Jane

what else do you need?

0 answers

No answers yet.

Log in to answer this question.