Entering edit mode
5.1 years ago
Molinia
▴
10
Okay so here is my problem
I have multiple fastq file paired end, and I would like to perform an alignemnt with Hisat2 using job array, But there is an error that make it doesn't work It tells me that there is an error with this line "SHORTNAME1=$(basename "${R1_file[$SLURM_ARRAY_TASK_ID]}".fastq.gz )" variable without link
#!/bin/bash
##SBATCH --time=1:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --mem=32G
#SBATCH --cpus-per-task=16
#SBATCH -o log/slurmjob-%j
#SBATCH --job-name=hist2
#SBATCH --partition=short
#SBATCH --array=0-7
SCRATCHDIR=/storage/scratch/"$USER"/"$SLURM_JOB_ID"
DATABANK="$HOME/index/
OUTPUT="$HOME"/rnaseq/hisat2
mkdir -p "$OUTPUT"
mkdir -p "$SCRATCHDIR"
cd "$SCRATCHDIR"
R1_file=($(find "$HOME"/rnaseq/ -type f -name "*R1_trim.fastq.gz"))
R2_file=($(find "$HOME"/rnaseq/ -type f -name "*R2_trim.fastq.gz"))
SHORTNAME1=$(basename "${R1_file[$SLURM_ARRAY_TASK_ID]}".fastq.gz )
SHORTNAME2=$(basename "${R2_file[$SLURM_ARRAY_TASK_ID]}".fastq.gz)
hisat2 -p $SLURM_CPUS_PER_TASK -x "$DATABANK" -1 "$R1_file[$SLURM_ARRAY_TASK_ID]}" -2 "${R2_fiile[$SLURM_ARRAY_TASK_ID]}" -S "$SCRATCHDIR"/"$SHORTNAME1".sam "$SCRATCHDIR"/"$SHORTNAME2".sam | \
samtools view -b -S - | samtools sort - -o "$SCRATCHDIR"/"$SHORTNAME1".mapped.sorted.bam "$SCRATCHDIR"/"$SHORTNAME2".mapped.sorted.bam
Can somebody help ?
Try adding
echo
in front of the command and see how it looks like.When I echo the $SLURM_ARRAY_TASK_ID it's written '7' but when I echo "${R1_file[$SLURM_ARRAY_TASK_ID]}" it also say that ths variable has no link...
I don't have an answer to your exact question but I might recommend checking out this sankemake wrapper https://snakemake-wrappers.readthedocs.io/en/stable/wrappers/hisat2.html
Then making use of this snakemake profile https://github.com/Snakemake-Profiles/slurm
Which this might all "just work" out of the box for you without your own personal script.
Thank you very much for the answer ! But as I can seen , the wrapper of hisat2 doesn't handle SRA input accessions... and thats' a problem because I work on it... I'll probably use it with an other set of data If anyone see where is a problem I'll be gratefull !