I'm trying to make a bash script to use a program called bamql. The execution of bamql from the terminal would be something like this:
bamql -f <file_in> 'chr(<name>) & nt_exact(<number>,<letter>)' -o <file_out>
<file_in> is the input file to the program <name> is the name of the chromosome of the organism that I am studying <number> It is an integer indicating the position that I want to study <letter> is a letter (A, C, G or T) indicating the mutation that I want to study <file_out> is the output file of the program
An example of BAMQL execution would be the following
bamql -f BC02.sorted.bam 'chr(PB2) & nt_exact(482,T)' -o PB2_482_T.bam
So what I want is to make a bash script to be able to execute BAMQL with variables, like this:
bamql -f ${FILE_IN} 'chr(${CHRN}) & nt_exact(${SNV})' -o ${FILE_OUT}
The problem is that the previous code does not work, it gives me the error "Unexpected character", and the variables ${CHRN} and ${SNV} do not take their value. I have also tried to enclose the whole 'chr(${CHRN}) & nt_exact(${SNV})' part in an array and run the code:
args=('chr(${CHRN}) & nt_exact(${SNV})')
bamql -f ${FILE_IN} "${args[@]}" -o ${FILE_OUT}
but again the variables ${CHRN} and ${SNV} do not take their value.
I would be grateful if someone gives me some suggestion.