In the below code I am trying to combine two shell into one, but not sure if Im doing it right. Basically, there are 3 steps:
Step 1: the file conversion (which is underlined and asks the user if the file needs to be converted, if "y", then it runs the perl script if "n" then it skips to line 14
printf "Is this a batch or sanger analysis :" ; read id
)
Steps 2 and 3 already seem to work, but are asking the user if it is a batch or individual analysis, and if "y" one perl script is run, if "n" then another user prompt and perl command is run. Thanks :).
#!/bin/bash
while true
do
printf "Does the file need to be converted : " ; read id
cd 'C:\Users\cmccabe\Desktop\annovar'
case "$id" in
[yY]) perl convert2annovar.pl -includeinfo -format vcf4old ${id}_matched.vcf > ${id}_matched.avinput
;;
[nN]) # code for X
Goto line 14
done
while true
do
printf "Is this a batch or sanger analysis :" ; read id
cd 'C:\Users\cmccabe\Desktop\annovar'
case "$id" in
[yY]) perl -ne 'chomp; system ("perl table_annovar.pl $_ humandb/ -buildver hg19 -protocol refGene,popfreq_all,common,clinvar,clinvarsubmit,clinvarreference -operation g,f,f,f,f,f -otherinfo")' < file.txt
;;
[nN]) # code for X
printf "Enter ID : " ; read id
cd 'C:\Users\cmccabe\Desktop\annovar'
[ -z "$id" ] && break
[ "$id" = "end" ] && break
perl table_annovar.pl ${id}_matched.avinput humandb/ -buildver hg19 -protocol refGene,popfreq_all,common,clinvar,clinvarsubmit,clinvarreference -operation g,f,f,f,f,f -otherinfo
;;
end) break ;;
*) ;; # Unknown option, do nothing
esac
Goto line 4
done