-
Notifications
You must be signed in to change notification settings - Fork 38
/
STAR_counts.sh
56 lines (48 loc) · 1.21 KB
/
STAR_counts.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
#!/bin/bash
set -e
set -u
set -o pipefail
# Usage
# Load STAR
#STAR=/opt/biosoft/STAR-2.6.1c/bin/Linux_x86_64/STAR
module load STAR/2.6.1.d
STAR=`which STAR`
reference=$1
sample=$2
GTF=$3
ulimit -n 10240
# building index for alignment
index=STAR
mkdir -p ${index}
if [ ! -f ${index}/SA ]
then
${STAR} \
--runThreadN 50 \
--runMode genomeGenerate \
--genomeDir $index \
--genomeFastaFiles ${reference}
fi
# create outdir
mkdir -p 01-clean-data
mkdir -p 02-read-align
# align RNA-seq to reference
exec 0< $2
while read prefix
do
fq1=00-raw-data/${prefix}_1.fq.gz
fq2=00-raw-data/${prefix}_2.fq.gz
fastp -w 8 -i $fq1 -I $fq2 -o 01-clean-data/${prefix}_1.fq.gz -O 01-clean-data/${prefix}_2.fq.gz \
-j 01-clean-data/${prefix}.json -h 01-clean-data/${prefix}.html
STAR \
--genomeDir $index \
--runThreadN 50 \
--readFilesIn 01-clean-data/${prefix}_1.fq.gz 01-clean-data/${prefix}_2.fq.gz \
--readFilesCommand zcat \
--outFileNamePrefix 02-read-align/${prefix}_ \
--outSAMtype BAM SortedByCoordinate \
--outBAMsortingThreadN 20 \
--quantMode GeneCounts --sjdbGTFfile $GTF
done
#if [ ! -f merged.bam ] ;then
# samtools merge merged.bam *sortedByCoord.out.bam
#fi