-
Notifications
You must be signed in to change notification settings - Fork 0
/
star_align.sh
executable file
·41 lines (32 loc) · 1.1 KB
/
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
35
36
37
38
39
40
#!/bin/bash
## can be used for both single and paired-end
## archived FASTQ is assumed
TAG=$1
SPECIES=$2
RL=$3
R1=$4
R2=$5
READS=""
WDIR=`pwd`
if [[ $TAG == "" || $SPECIES == "" || $RL == "" || $R1 == "" ]]
then
echo "Please provide 1) output name (tag) 2) species 3)read length 4) R1 (or R1/R2 for paired-end) read file name"
exit 1
fi
if [[ $R2 == "" ]]
then
echo "Processing alignment as single-end, using STAR index /media/DISK1/reference/STAR/${SPECIES}_${RL}bp."
READS=$WDIR/$R1
else
echo "Processing alignment as paired-end, using STAR index /media/DISK1/reference/STAR/${SPECIES}_${RL}bp."
READS="$WDIR/$R1 $WDIR/$R2"
fi
GENDIR="/media/DISK1/reference/STAR/${SPECIES}_${RL}bp"
mkdir ${TAG}_STAR
cd ${TAG}_STAR
echo $TAG
STAR --genomeDir $GENDIR --readFilesIn $READS --runThreadN 4 --readFilesCommand zcat --outFilterMultimapNmax 15 --outFilterMismatchNmax 6 --outSAMstrandField All --outSAMtype BAM Unsorted --quantMode TranscriptomeSAM > /dev/null
mv Aligned.out.bam $TAG.bam
mv Aligned.toTranscriptome.out.bam $TAG.tr.bam
mv Log.out $TAG.star_run.log
mv Log.final.out $TAG.star_final.log