Question: How to pass multiple "argument value" pair using variable in GATK command?
0
gravatar for Hemant Gupta
15 months ago by
Macau
Hemant Gupta0 wrote:

Hii,

I have to call genotype for multiple samples using joint genotyping methedology of GATK best practices, So I made a shell script which take list of samples in a text file as an input, and script through all commands on each sample one by one up to GVCF step. After generating GVCF for each sample, I want to call joint genotype using following command:

java -jar GenomeAnalysisTK.jar -T GenotypeGVCFs -R hg19.fa -V sample1.g.vcf -V sample2.g.vcf [.. -V sampleN.g.vcf] -o rawVariants.vcf

So I pass "-V sample1.g.vcf -V sample2.g.vcf -V sampleN.g.vcf" as a variable like below:

V="-V sample1.g.vcf -V sample2.g.vcf .. -V sampleN.g.vcf"

java -jar GenomeAnalysisTK.jar -T GenotypeGVCFs -R hg19.fa `echo $V` -o rawVariants.vcf

OR

java -jar GenomeAnalysisTK.jar -T GenotypeGVCFs -R hg19.fa $V -o rawVariants.vcf

I got "ERROR MESSAGE: Invalid argument value '-V sample1.g.vcf -V sample2.g.vcf .. -V sampleN.g.vcf'. As the command is considering $V variable as a single argument.

Please provide me some way to pass '-V sample1.g.vcf -V sample2.g.vcf .. -V sampleN.g.vcf' to the GATK command in shell script.

Thanks in advance!

ADD COMMENTlink modified 15 months ago by Pierre Lindenbaum107k • written 15 months ago by Hemant Gupta0
2
gravatar for Pierre Lindenbaum
15 months ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum107k wrote:

Use a list with the '.list' suffix

echo "sample1.g.vcf" > my.list
echo "sample2.g.vcf" >> my.list
echo "sample3.g.vcf" >> my.list
echo "sampleN.g.vcf" >> my.list

and then

java -jar GenomeAnalysisTK.jar -T GenotypeGVCFs -R hg19.fa -V my.list -o rawVariants.vcf
ADD COMMENTlink written 15 months ago by Pierre Lindenbaum107k

Thank you so much Pierre Lindenbaum, It works! You saved my lots of time.

ADD REPLYlink written 15 months ago by Hemant Gupta0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 648 users visited in the last hour