forked from tallulandrews/scRNASeqPipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2-5_STAR-RSEM.sh
executable file
·61 lines (56 loc) · 1.99 KB
/
2-5_STAR-RSEM.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# Assume paired end
# Arguments:
# $1 = directory of fastq files to map/quantify
# $2 = output directory for final quantification file
# $3 = prefix
# $4 = number of threads to run on (optional)
RSEM=/nfs/users/nfs_t/ta6/RNASeqPipeline/software/RSEM-1.2.26/rsem-calculate-expression
STAR=/nfs/users/nfs_t/ta6/RNASeqPipeline/software/STAR-STAR_2.4.0j/bin/Linux_x86_64_static/
REFname=/lustre/scratch108/compgen/team218/TA/STRIPED_GENOMES/RSEM/GRCm38
FILESTOMAPDIR=$1
OUTDIR=$2
PREFIX="$3-$LSB_JOBINDEX-"
THREADS=$4
WORKINGDIR=/lustre/scratch108/compgen/team218/TA/TemporaryFileDir/$PREFIX
if [ -z "$THREADS" ] ; then
THREADS=1
fi
if [ ! -f "$RSEM" ] ; then
echo "Sorry RSEM not available "
exit 1
fi
if [ -z "$FILESTOMAPDIR" ] ; then
echo "Please include a directory of files to map (ARG 1/4)"
exit 1
fi
if [ -z "$OUTDIR" ] ; then
echo "Please include a directory for outputfile (ARG 2/4)"
exit 1
fi
if [ -z "$3" ] ; then
echo "Please include a prefix for output (ARG 3/4)"
exit 1
fi
# Get fastq files
FILEStoMAP=($FILESTOMAPDIR/*)
ARRAYINDEX=$((($LSB_JOBINDEX-1)*2))
FILE1TOMAP=${FILEStoMAP[$ARRAYINDEX]} #Note bash array indicies start at 0 but job array indices must start at 1!!!
FILE2TOMAP=${FILEStoMAP[$ARRAYINDEX+1]} #Note bash array indicies start at 0 but job array indices must start at 1!!!
if [ -z "$FILE1TOMAP" ] ; then
echo "$ARRAYINDEX-th file in the $FILESTOMAPDIR does not exist."
exit 1
fi
if [ -z "$FILE2TOMAP" ] ; then
echo "$ARRAYINDEX+1-th file in the $FILESTOMAPDIR does not exist."
exit 1
fi
# Make directory for output if necessary
if [ ! -d "$OUTDIR" ] ; then
mkdir -p $OUTDIR
fi
if [[ $FILE1TOMAP =~ \.gz$ ]] ; then
$RSEM --star --star-path $STAR --gzipped-read-file --no-bam-output --single-cell-prior --temporary-folder $WORKINGDIR --paired-end $FILE1TOMAP $FILE2TOMAP $REFname $OUTDIR/$PREFIX
else
$RSEM --star --star-path $STAR --no-bam-output --single-cell-prior --temporary-folder $WORKINGDIR --paired-end $FILE1TOMAP $FILE2TOMAP $REFname $OUTDIR/$PREFIX
fi