This is a test version of Biostars. For the public version, visit https://www.biostars.org.
transfer parameter to reader group in bwa mem command

Dear all, When I was calling variant using bwa mem command, the reader group was added by "@RG\tID:${IND}\tPL:illumina\tSM:${IND}". If the parameter ${IND} was set inner this script, this would be running correctly. But when I try to transfer an outer parameter by using $1 into $IND, it can not run. Here attached my script.

#! /bin/sh

IND=$1 
REF=~/reference/ref.fa
FORWARD=~/data/${IND}_1.fq.gz
REVERSE=~/data/${IND}_2.fq.gz
BAM=~/data/${IND}.sort.bam

bwa mem -M -t 10 "@RG\tID:${IND}\tPL:illumina\tSM:${IND}" ${REF} ${FORWARD} ${REVERSE} | samtools view -b -@ 10 | samtools sort -@ 10 -T ${IND} > ${BAM}

Tip: If I removed this options "@RG\tID:${IND}\tPL:illumina\tSM:${IND}". This script could run correctly so that I'm sure there must be something incorrect in this sentence.

Anybody help?

Thank you

bwa

1 answer

the -R is missing.

   -R STR        read group header line such as '@RG\tID:foo\tSM:bar' [null]

Log in to answer this question.