Question: Hisat2 with SLURM
0
gravatar for Molinia
12 weeks ago by
Molinia0
Molinia0 wrote:

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 • 170 views
ADD COMMENTlink modified 12 weeks ago by edmund.a.miller0 • written 12 weeks ago by Molinia0

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

ADD REPLYlink written 12 weeks ago by WouterDeCoster42k

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 REPLYlink written 12 weeks ago by Molinia0

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 REPLYlink written 12 weeks ago by edmund.a.miller0

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 REPLYlink written 12 weeks ago by Molinia0
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1201 users visited in the last hour