The lines in bold check the value of a user input, if it is not one of the expected genes (GJB2, MECP2, PHOX2B), the user is shown a list of formats to use and the variant is entered. It is then supposed to printf that entered variant? Thank you :).
name() {
printf "\n\n"
printf "Please enter the gene name : "; read gene
[ -z "$gene" ] &&
printf "\n No ID supplied. Leaving match function." &&
sleep 2 &&
return
[ "$gene" = "end" ] &&
printf "\n Leaving match function." &&
sleep 2 &&
exit
[ "$gene" != "GJB2 or MECP2 or PHOX2B" ] &&
printf "\n That is not a target gene please use one of the formats listed." &&
echo "
NM_003002.3:c.274G>T (reference transcript:coding change w/ nucleotide change)
chr11:g.111959693G>T (chromosome:genomic position w/ nucleotide change)
NC_000011.9:g.111959693G>T (Genebank accession #:genomic position w/ nucleotide change)"
printf "Enter variant(s): "; IFS="," read -a variants
code=""
if [ "$gene" = "GJB2" ]
then code="NM_004004.5"
elif [ "$gene" = "MECP2" ]
then code="NM_004992.3"
elif [ "$gene" = "Phox2B" ]
then code="NM_003924.3"
else return
fi
for ((i = 0; i < ${#variants[@]}; i++))
do printf "%s:%s\n" "$code" "${variants[$i]}"
done | tee -a c:/Users/cmccabe/Desktop/Python27/$gene.txt \
>> c:/Users/cmccabe/Desktop/Python27/out.txt
}
added code here
Will a 3rd elif added to print this input be ok (at the end) ?
code=""
if [ "$gene" != "GJB2 or MECP2 or PHOX2B" ]
then code=printif ((i = 0; i < ${#variants[@]}; i++))
tee -a c:/Users/cmccabe/Desktop/Python27/$gene.txt \
>> c:/Users/cmccabe/Desktop/Python27/out.txt
