How to pass multiple "argument value" pair using variable in GATK command?
1
1
Entering edit mode
7.8 years ago
Hemant Gupta ▴ 10

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!

software error snp next-gen variant calling gatk • 2.9k views
ADD COMMENT
3
Entering edit mode
7.8 years ago

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 COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

I am using list as well, but this is not workin for me... /usr/bin/bash: -c: line 0: syntax error near unexpected token `newline'

ADD REPLY

Login before adding your answer.

Traffic: 1721 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6