I am trying to align my samples to a reference genome using bwa mem.
I have over 300 samples which I created an index from a metadata file
but something isn't really working!
The loop i'm using is this (in SLURM)
#SBATCH --export=ALL # export all environment variables to the batch job
#SBATCH -D . # set working directory to .
(...)
# Commands
module load BWA/0.7.17-foss-2018a
module load SAMtools/1.3.1-foss-2018a
module load BCFtools/1.6-intel-2017b
reference=/gpfs/ts0/home/jn378/mussels/snp/genomes/gallo_v6.snail.svg
input_reads=/gpfs/ts0/home/jn378/mussels/snp/3.fastp
align=/gpfs/ts0/home/jn378/mussels/snp/5.bam-files
metadata=/gpfs/ts0/home/jn378/mussels/snp/SNP-array-metadata.txt
metadata=/gpfs/ts0/home/jn378/mussels/snp/SNP-array-metadata.txt
read1=( `cat $metadata | cut -f 4` )
read1_array=$input_reads/${read1[(($SLURM_ARRAY_TASKID))]}
read2=( `cat $metadata | cut -f 5` )
read2_array=$input_reads/${read2[(($SLURM_ARRAY_TASKID))]}
outbam=( `cat $metadata | cut -f 1` )
out=${outbam[(($SLURM_ARRAY_TASKID))]}
echo "reference" $reference
echo "read1" $read1_array
echo "read2" $read2_array
echo "alignment" $align/${out}_unsorted.raw.sam
#### Align with bwa mem ###
####bwa mem -t 4 $reference $read1_array $read2_array > ${align}/${out}_unsorted.raw.sam
but I keep getting this error:
bwa.sh: line 34: (()): syntax error: operand expected (error token is "))")
Could someone help me with this issue?
Many thanks!