-
Notifications
You must be signed in to change notification settings - Fork 0
/
4-STAR_Align.sh
34 lines (29 loc) · 891 Bytes
/
4-STAR_Align.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
#!/bin/bash
path=$(pwd)'/'
index='ref_index/'
GTFname='Mycobacterium_tuberculosis_H37Rv_gff_v4'
inputreasdspath='trimmed_reads/Paired'
indexDir=$path$index
readsDir=$path$inputreasdspath
GTFdir=$path"ref/"
outDir=$path'STAR-Aligned'
mkdir -p $outDir
for sample in $(ls $readsDir | grep "fastq" | cut -d "_" -f1 | sort | uniq)
do
#get sample name
fsample=$(basename $sample "_1_paired.fastq")
rsample=$(basename $sample "_2_paired.fastq")
STAR --runThreadN 2\
--genomeDir $indexDir\
--sjdbGTFfile $GTFdir$GTFname".gtf"\
--readFilesIn $readsDir'/'$fsample'_1_paired.fastq' $readsDir'/'$rsample'_2_paired.fastq'\
#if your reads are in gz format
#--readFilesCommand zcat\
--outSAMtype BAM SortedByCoordinate\
--limitBAMsortRAM 3000000000\
--quantMode GeneCounts
mv "Aligned.out.sam" $fsample'.out.sam'
done
mv *.sam $outDir
mv *.out $outDir
mv *.tab $outDir