I would like to add read group info (-R
) during the mapping/alignment stage as part of my variant calling gatk pipeline.
I am doing something like this:
bwa mem \
-M \
-t 8 \
-v 3 \
-R <(sh a-illumina-read-group.sh $1) \
"$path_dr_bwaindex_genome" \
$1 $2
where the read group string is generated automatically from the fastq file by the shell script a-illumina-read-group.sh
. It produces a string like:
'@RG\tID:ST-E00215_230_HJ3FMALXX_2\tSM:ST-E00215_230_HJ3FMALXX_2_ATCACG\tLB:ATCACG\tPL:ILLUMINA'
but, when I run bwa, it fails with this error:
[E::bwa_set_rg] the read group line is not started with @RG
I have tried excluding the single quotes (''
) around read group info, but that didn't change anything. I also tried variations in how the variable is passed.
-R=$(sh a-illumina-read-group.sh $1) \
-R=$(echo $(sh a-illumina-read-group.sh $1)) \
Just as a test, I tried:
rg='@RG\tID:ST-E00215_230_HJ3FMALXX_2\tSM:ST-E00215_230_HJ3FMALXX_2_ATCACG\tLB:ATCACG\tPL:ILLUMINA'
-R <(echo $rg) \
But, they all produce the same error. I would appreciate any solutions to this issue.
I understand that I can add read groups later on using PicardTools AddOrReplaceReadGroup
, but I thought it might be convenient doing it here in one step.
Thanks.
rmf, I had a similar idea and met with the same result. Did you ever find a solution?
I have added an answer.