I want to give a numerical value as input argument for a bash script which is as below
#!/bin/bash
while getopts ":hl:q:s:e:k:g:v" opt; do
case $opt in
l)
lincRNAfasta=$OPTARG
;;
q)
query_species=$OPTARG
;;
s)
subject_species=$OPTARG
;;
e)
subject_gff=$OPTARG
;;
g)
subject_genome=$OPTARG
;;
k)
known_lincRNAs=$OPTARG
;;
v)
evalue=$OPTARG
;;
h)
usage
exit 1
;;
\?)
echo "Invalid option: -$OPTARG" >&2
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
echo "Starting on $subject_species"
# Formatting the genome
makeblastdb -logfile stderr.out -in $subject_genome -dbtype nucl -out BLAST_DB/$subject_genome.blast.out
# Blasting the lincRNA transcripts against the genome to find out the location on the genome And identify if there are any paralogs in the query genome.
blastn -logfile stderr.out -query $lincRNAfasta -db BLAST_DB/$subject_genome.blast.out -num_threads 4 -penalty -2 -reward 1 -gapopen 5 -gapextend 2 -dust no -word_size 8 -evalue $evalue -outfmt "6 qseqid sseqid pident length qlen qstart qend sstart send evalue bitscore" -out Homology_Search/$subject_species.out
When i run the above script like this:
sh test.sh -l sample.data/Hsap_lincRNAs.fasta -q Hsap -s Hsap -e sample.data/Hsap_genes.gff -g sample.data/Hsap_genome.fasta -k sample.data/Hsap_lincRNAs -v 1e-20
I get this following error.
Error: Cannot convert string '=' to double (m_Pos = 0)
Error: Argument "evalue". Argument cannot be converted: `='
Error: (CArgException::eConvert) Argument "evalue". Argument cannot be converted: `='
I have never run a numeric value as argument with the getopts module in bash and so i am not sure what am i doing wrong here. Any help is much appreciated.
Thanks Upendra