#!/bin/bash

#$ -N Hisat
#$ -cwd
#$ -o ../logs/$JOB_NAME.$JOB_ID.log
#$ -e ../logs/$JOB_NAME.$JOB_ID.err
#$ -pe smp 56
#$ -l h_vmem=4.4G
#$ -t 1-78
#$ -tc 78


######################################
READ=/mnt/data/arslan/TEA_GENOMES/RNA_Seq/Illumina
ZJ=/mnt/data/arslan/Teas/01_Assembly/scaffolding/ZJ-scaffold/ZJ_rename.scaffold.fasta
INPUT=/mnt/data/arslan/Teas/03_Annotation/Gene_finding/Mapping/output/Hisat_ZJ

export PATH="/mnt/bin/hisat2/hisat2-2.1.0/:$PATH"
export PATH="/mnt/data/arslan/tool/samtools/samtools-1.17/bin/:$PATH"

# mkdir -p ${OUT}

# hisat2-build -p ${NSLOTS} ${REF} ${OUT}/ZJ_Index


SEEDFILE="RNA_seq.txt"
SEED=$(awk "NR==$SGE_TASK_ID" $SEEDFILE)


hisat2 -p ${NSLOTS} --dta -x ${OUT}/ZJ_Index -1 ${READ}/${SEED}_f1.fq.gz -2 ${READ}/${SEED}_r2.fq.gz  | samtools sort -@ ${NSLOTS} -o $OUT/${SEED}_IL.bam
