0
|
1 set -o pipefail -o errexit
|
|
2
|
|
3 path2=$PATH
|
|
4
|
|
5 #e.g. /data7/references/ath10/star_idx
|
|
6 ref=$1
|
|
7 #e.g. 4
|
|
8 threads=$2
|
|
9 #e.g. 10
|
|
10 min_uniq_qual=$3
|
|
11 #e.g. ./ath10/gtf/exons.bed
|
|
12 annotation=$4
|
|
13 #e.g. ./tmp2
|
|
14 tmp=$5
|
|
15 #e.g. tmp/SRR8505407_SRP182756_ath10_sra_1.fastq.gz
|
|
16 reads1=$6
|
|
17 #e.g. tmp/SRR8505407_SRP182756_ath10_sra_2.fastq.gz, just leave off if not paired
|
|
18 reads2=$7
|
|
19
|
|
20 #align
|
|
21 STAR --runMode alignReads --runThreadN $threads --genomeDir ${ref} --readFilesIn $reads1 $reads2 --readFilesCommand zcat --twopassMode None --outReadsUnmapped Fastx --outMultimapperOrder Random --outSAMreadID Number --readFilesType Fastx --outTmpDir ./star_tmp --outSAMtype BAM Unsorted --outSAMmode NoQS --outSAMattributes NH MD --chimOutType Junctions --chimOutJunctionFormat 1 --chimSegmentReadGapMax 3 --chimJunctionOverhangMin 12 --chimSegmentMin 12 > star.log 2>&1
|
|
22
|
|
23 sout="Aligned.out.bam"
|
|
24
|
|
25 #sort
|
|
26 sorted_bam="sorted.bam"
|
|
27 samtools sort -T ./samtools_temp -@ $threads -m 64M -o $sorted_bam $sout > stools.log 2>&1
|
|
28 #index
|
|
29 samtools index -@ $threads $sorted_bam >> stools.log 2>&1
|
|
30
|
|
31 #get coverage summaries
|
5
|
32 bamcount $sorted_bam --threads $threads --coverage --no-head --require-mdz --min-unique-qual $min_uniq_qual --frag-dist bc --bigwig bc --annotation $annotation bc --auc bc --alts bc > bc.log 2>&1
|