Reputation: 3022
I am trying to process multiple bam
files in a loop using the standard and having an issue where each file overwrites the other. The --bam xxx \
is the only line that will change and the xxx
depends on the bam
files in the directory. In this example there are three, but that is not always the case. Thank you :).
files in directory --- won't always be three ---
xxx_00.bam
yyy_01.bam
zzz_02.bam
standard
for bam in *.bam ; do
${path_to_strelka}/bin/configureStrelkaGermlineWorkflow.py \
--bam ${bam} \
--referenceFasta $fasta \
--callRegions $bed \
--exome
--runDir $dir
$dir/runWorkflow.py -m local -j 20
done
desired
for bam in *.bam ; do
${path_to_strelka}/bin/configureStrelkaGermlineWorkflow.py \
--bam ${bam} \ --- xxx_00.bam ---
--bam ${bam} \ --- yyy_01.bam ---
--bam ${bam} \ --- zzz_02.bam ---
--referenceFasta $fasta \
--calRegions $bed \
--exome \
--runDir $dir
$dir/runWorkflow.py -m local -j 20
done
Tried --- prints the desired but does not execute it ---
printf -- "${path_to_strelka}/bin/configureStrelkaGermlineWorkflow.py \\\\\n%s\n\t\t--referenceFasta $fasta \\\\\n\t\t--callRegions $bed \\\\\n\t\t--exome \\\\\n\t\t--runDir ${dir}\n" \
"$(for f in *.bam; do printf -- "\t\t--bam %s \\\\\n" "${f}"; done)"
${dir}/runWorkflow.py -m local -j 20
Upvotes: 0
Views: 78
Reputation: 15293
Doesn't look to me like you need the loop at all.
${path_to_strelka}/bin/configureStrelkaGermlineWorkflow.py \
$( printf " --bam %s " *bam ) \
--referenceFasta $fasta \
--calRegions $bed \
--exome \
--runDir $dir \
$dir/runWorkflow.py -m local -j 20
Upvotes: 2