-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrsem_quant.sh
executable file
·54 lines (45 loc) · 1.15 KB
/
rsem_quant.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
#!/bin/bash
## PIPELINE VERSION
TAG=$1
REFDIR=$2
SPECIES=$3
STRAND=$4
CPUS=$5
PARROT=""
TEST=""
REF=$REFDIR/RSEM/${SPECIES}_rsem
WDIR=`pwd`
if [[ $TAG == "" || $SPECIES == "" || $STRAND == "" ]]
then
echo "ERROR: Please provide 1) output name (tag) assuming <tag>.fastq.gz or <tag>.R1.fastq.gz/<tag>.R2.fastq.gz input; 2) species/assembly alias, e.g. genprime_v23; 3) strandedness as NONE/FR/RF"
exit 1
fi
if [[ $STRAND == "NONE" ]]
then
FLAG="--forward-prob 0.5"
echo "Proceeding using stranded setting $STRAND"
elif [[ $STRAND == "FR" ]]
then
FLAG="--forward-prob 1.0"
echo "Proceeding using stranded setting $STRAND"
elif [[ $STRAND == "RF" ]]
then
FLAG="--forward-prob 0.0"
echo "Proceeding using stranded setting $STRAND"
else
echo "ERROR: you must set strand variable to either NONE, FR, or RF"
exit
fi
TEST=`samtools view -f 0x1 $TAG.tr.bam | head`
if [[ $TEST == "" ]]
then
PARROT=""
else
PARROT="--paired-end"
fi
if [[ ! -e $REF.grp ]]
then
echo "ERROR: rsem index $REF does not exist!"
exit 1
fi
rsem-calculate-expression -p $CPUS --bam --no-bam-output $FLAG --estimate-rspd $PARROT $TAG.tr.bam $REF $TAG > $TAG.rsem.log