Help with shell script - not finding files

Hello,

I have a shell script like the one below but cannot get it working:

#!/bin/bash
#$ -cwd

CHR=$2
 
# directories
ROOT_DIR=./
RESULTS_DIR=${ROOT_DIR}results/
 
# executable
SHAPEIT_EXEC=${ROOT_DIR}shapeit.v2.r727.linux.x64/shapeit.v2.r727.linux.x64
 
# parameters
THREAT=5
EFFECTIVESIZE=11418
 
# reference data files
GENMAP_FILE=/home/whme1016/Imputation/genetic_map_b37/genetic_map_chr${CHR}_combined_b37.txt
 
# GWAS data files in PLINK BED format
GWASDATA_BED=${ROOT_DIR}chr${CHR}.unphased.bed
GWASDATA_BIM=${ROOT_DIR}chr${CHR}.unphased.bim
GWASDATA_FAM=${ROOT_DIR}chr${CHR}.unphased.fam

# problem SNP file
EXCLUDE_SNP=${ROOT_DIR}chr${CHR}.alignments.snp.strand.exclude
 
# main output file
OUTPUT_HAPS=${RESULTS_DIR}chr${CHR}.phased.haps
OUTPUT_SAMPLE=${RESULTS_DIR}chr${CHR}.phased.sample
OUTPUT_LOG=${RESULTS_DIR}chr${CHR}.phased.log
 
## phase GWAS genotypes
$SHAPEIT_EXEC \
--input-bed $GWASDATA_BED $GWASDATA_BIM $GWASDATA_FAM \
--input-map $GENMAP_FILE \
--exclude-snp $EXCLUDE_SNP \
--thread $THREAT \
--effective-size $EFFECTIVESIZE \
--output-max $OUTPUT_HAPS $OUTPUT_SAMPLE \
--output-log $OUTPUT_LOG

done

I am trying to run a program called SHAPEIT. When I run the shell script, I get the following error:

Segmented HAPlotype Estimation & Imputation Tool
  * Authors : Joe BLOGGS
  * Contact : someone@somewhere.com
  * Webpage : http:://www.example.fr
  * Version : v2.r727
ERROR: [./chr.alignments.snp.strand.exclude] is impossible to open, check file existence or reading permissions

I have the following files in my root directory for chromosome 2 with full permissions:

chr2.alignments.log                 
chr2.alignments.snp.strand        
chr2.alignments.snp.strand.exclude 
chr2.unphased.bed                   
chr2.unphased.bim                   
chr2.unphased.fam                   
chr2.unphased.log 

My shell script is clearly reading the chr2.unphased.fam/bed/bim files, but not my chr2.alignments.snp.strand.exclude. Any ideas why this is? Thanks for any help.

CHR=$2 represent the 2nd argument given at the command line.
Are you invoking the command as:

command <arg1> <arg2> ?

It looks like you expect a directory to be called chr2. For your script to work it has to be invoked as:

script_name <arg1> 2