Hisat2 with SLURM
0
1
Entering edit mode
4.5 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 ?

RNA-Seq alignment • 2.3k views
ADD COMMENT
0
Entering edit mode

Try adding echo in front of the command and see how it looks like.

ADD REPLY
0
Entering edit mode

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...

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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 !

ADD REPLY

Login before adding your answer.

Traffic: 2873 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6