bash ~/match.sh runs fine.
#!/bin/bash
printf "Enter ID : "; read id
printf "What panel: "; read panel
cd 'C:\Users\cmccabe\Desktop\annovar'
[ -z "$id" ] && break
[ "$id" = "end" ] && break
OMR=Output_Mutation_Report
perl -aF/\\t/ -lne 'BEGIN{%m=map{chomp;s/\cM|\cJ//g;$p=join("\t",(split/\t/)[4,5]);($p,$_)} <>;$m{"#CHROM\tINFO"}=$m{"Chr\tSegment Position"}};/SEGPOS=(\d+)/ || /\t(INFO)\t/ or next;$p=$F[0]."\t".$1;exists $m{$p} and print join("\t",$_,$m{$p})' ${id}_${panel}_${OMR}.txt < ${id}_${panel}_${OMR}_Filtered.vcf > ${id}_matched.vcf
I am trying to combine shells: bash ~/newbatch.sh
#!/bin/bash
printf "What is the id of the patient to be matched : "; read id
printf "What panel: "; read panel
case "$id" in
cd 'C:\Users\cmccabe\Desktop\annovar'
OMR=Output_Mutation_Report
$( perl -aF/\\t/ -lne 'BEGIN{%m=map{chomp;s/\cM|\cJ//g;$p=join("\t",(split/\t/)[4,5]);($p,$_)} <>;$m{"#CHROM\tINFO"}=$m{"Chr\tSegment Position"}};/SEGPOS=(\d+)/ || /\t(INFO)\t/ or next;$p=$F[0]."\t".$1;exists $m{$p} and print join("\t",$_,$m{$p})' ${id}_${panel}_${OMR}.txt < ${id}_${panel}_${OMR}_Filtered.vcf > ${id}_matched.vcf )
;;
show_menu=true
menu=( [yY] [nN] )
func_show() { # "MESSAGE STRING"
# Prints passed argument
# Returns nothing
printf '\n\t%s\n\n' "$1"
}
#
# Display & Action
#
clear
while $show_menu
do printf '#----------------------#\n%s\n' "Are there additonal patients to be matched"
select entry in "${menu[@]}" Back
do case "$entry" in
Back) show_menu=false
;;
[yY]) $( perl -aF/\\t/ -lne 'BEGIN{%m=map{chomp;s/\cM|\cJ//g;$p=join("\t",(split/\t/)[4,5]);($p,$_)} <>;$m{"#CHROM\tINFO"}=$m{"Chr\tSegment Position"}};/SEGPOS=(\d+)/ || /\t(INFO)\t/ or next;$p=$F[0]."\t".$1;exists $m{$p} and print join("\t",$_,$m{$p})' ${id}_${panel}_${OMR}.txt < ${id}_${panel}_${OMR}_Filtered.vcf > ${id}_matched.vcf ) (index id 0) :: $entry
;;
[nN]) func_show "printf "Does the file need to be converted : " ; read id :: ${menu[${#menu[@]}-1]}"
while true
do
printf "Enter ID : " ; read id
cd 'C:\Users\cmccabe\Desktop\annovar'
[ -z "$id" ] && break
[ "$id" = "end" ] && break
$( perl convert2annovar.pl -includeinfo -format vcf4old ${id}_matched.vcf > ${id}_matched.avinput )
done
;;
*)
esac
break
done
done
I am sure the code needs work, but why does it throw an error in the underlined part when it was fine before? Thanks :).
bash ~/newbatch.sh
What is the id of the patient to be matched : H62947
What panel: Epilepsy70
/home/cmccabe/newbatch.sh: line 5: syntax error near unexpected token `'C:\Users\cmccabe\Desktop\annovar''
/home/cmccabe/newbatch.sh: line 5: ` cd 'C:\Users\cmccabe\Desktop\annovar''