annotate monorail.sh @ 0:a25fa2b5e379 draft

Uploaded
author chrisw
date Tue, 12 Feb 2019 11:07:30 -0500
parents
children ae546ad6f2f4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
1 set -o pipefail -o errexit
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
2 #get this script's path
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
3 #p=`perl -e '@f=split("/","'$0'"); pop(@f); print "".join("/",@f)."\n";'`
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
4
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
5 #/data7/miniconda2/envs/_galaxy_18.09/bin:/data7/miniconda2/condabin:/home/cwilks/.nimble/bin:/data/pypy3-v6.0.0-linux64/bin:/home/cwilks/zstd_dir:/data/bedtools2/bin:/usr/local/cuda-8.0/bin:/home/cwilks/Python3/bin:/data2/sqlite-autoconf-3110000.fts5:/data/java/bin:/data/ant/bin:/home/cwilks/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cwilks/samtools-1.2:/home/cwilks/samtools-1.2/htslib-1.2.1:/data/WiggleTools/bin:/data/kent_tools:/data2/liftover:/home/cwilks/bin
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
6
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
7 path2=$PATH
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
8 #starp=`/bin/which STAR`
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
9 #stp=`/bin/which samtools`
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
10
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
11 #e.g. /data7/references/ath10/star_idx
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
12 ref=$1
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
13 #e.g. 4
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
14 threads=$2
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
15 #e.g. 10
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
16 min_uniq_qual=$3
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
17 #e.g. ./ath10/gtf/exons.bed
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
18 annotation=$4
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
19 #e.g. ./tmp2
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
20 tmp=$5
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
21 #e.g. tmp/SRR8505407_SRP182756_ath10_sra_1.fastq.gz
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
22 reads1=$6
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
23 #e.g. tmp/SRR8505407_SRP182756_ath10_sra_2.fastq.gz, just leave off if not paired
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
24 reads2=$7
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
25
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
26
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
27 #racc=`perl -e '$r1="'${reads1}'"; @f=split(/\//,$r1); $r1=pop(@f); ($n1)=split(/[\._]/,$r1); print "$n1\n";'`
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
28
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
29 #cd ${tmp}
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
30 #align
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
31 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
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
32
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
33 sout="Aligned.out.bam"
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
34
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
35 #sort
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
36 sorted_bam="sorted.bam"
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
37 samtools sort -T ./samtools_temp -@ $threads -m 64M -o $sorted_bam $sout > stools.log 2>&1
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
38 #index
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
39 samtools index -@ $threads $sorted_bam >> stools.log 2>&1
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
40
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
41 #get coverage summaries
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
42 #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 --lats bc > bc.log 2>&1
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
43
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
44 #echo $PATH > ${sorted_bam}.bai
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
45 #echo $starp >> ${sorted_bam}.bai
a25fa2b5e379 Uploaded
chrisw
parents:
diff changeset
46 #echo $stp >> ${sorted_bam}.bai