forked from bixBeta/TReX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrim2align.sh
85 lines (55 loc) · 1.58 KB
/
trim2align.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
# 1007.sh
# RSC-alpha
#
# Created by Faraz Ahmed on 3/29/19.
# sample workflow for secondary and tertiary QC
start=`date +%s`
source activate RSC
source ~/.bash_profile
PIN='1007' # example
BED12='/path/to/bed12'
mkdir fastQC
for i in *.gz
do
$TRIM --nextseq 20 --gzip --length 50 --fastqc --fastqc_args "--outdir ./fastQC" $i
done
mkdir trimmed-fastq TrimQC_Stats
mv *trimmed.fq.gz trimmed-fastq
mv *trimming_report.txt TrimQC_Stats
cd trimmed-fastq
for i in *_trimmed.fq.gz
do
DIR='/path/to/starIndex/'
iSUB=`echo $i | cut -d '.' -f1`
STAR \
--runThreadN 12 \
--genomeDir $DIR \
--readFilesIn $i \
--readFilesCommand gunzip -c \
--outSAMstrandField intronMotif \
--outFilterIntronMotifs RemoveNoncanonical \
--outSAMtype BAM SortedByCoordinate \
--outFileNamePrefix $iSUB. \
--limitBAMsortRAM 61675612266 \
--quantMode GeneCounts
done
multiqc -f -n ${PIN}.star.multiqc.report .
mkdir STAR.COUNTS STAR.BAMS STAR.LOGS
mv *.ReadsPerGene.out.tab STAR.COUNTS
mv *.bam STAR.BAMS
mv *.out *.tab *_STARtmp *.list STAR.multiqc.report_data STAR.LOGS
cd STAR.BAMS
for i in *.bam
do
samtools index -b $i
done
cd ..
geneBody_coverage.py -r $BED12 -i STAR.BAMS/ -o ${PIN}
mkdir geneBodyCov
mv *geneBodyCoverage.* log.txt geneBodyCov
cd ..
end=`date +%s`
runtime=$((end-start))
echo 'runtime seconds '"$runtime" > runtime.${PIN}.txt
# change PIN, DIR and BED12 for each run!