annotate expression_calculator/expression.sh @ 0:27ebc30a2024 draft default tip

Uploaded
author daumsoft
date Wed, 18 Apr 2018 03:35:12 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
1 #!/bin/bash
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
2
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
3 if [ "$#" -ne 1 ]; then
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
4 echo "[usage:] expression.sh bam.file"
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
5 exit 1;
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
6 fi
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
7
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
8 INPUT_BAM=$1
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
9 SAMPLE_ID="sample"
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
10 SAMTOOLS=$GALAXY_HOME/package/DAUMSOFT/RNA-seq/Normalization/samtools
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
11 HTSEQ_COUNT=$GALAXY_HOME/package/DAUMSOFT/RNA-seq/Normalization/htseq-count
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
12 GTF=$GALAXY_HOME/package/DAUMSOFT/RNA-seq/Normalization/gencode.v22.annotation.gtf
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
13 EXPRESSION_R=$GALAXY_HOME/package/DAUMSOFT/RNA-seq/Normalization/expression.r
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
14
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
15 HTSEQ_COUNT_OUT=./$SAMPLE_ID".htseq-count.out"
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
16 EXPRESSION_OUT=./out
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
17 EXPRESSION_OUT_TMP=./out_tmp
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
18
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
19 rm -rf $EXPRESSION_OUT
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
20 rm -rf $EXPRESSION_OUT_TMP
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
21
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
22 mkdir $EXPRESSION_OUT
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
23 mkdir $EXPRESSION_OUT_TMP
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
24
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
25
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
26 $SAMTOOLS view -F 4 $INPUT_BAM |
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
27 $HTSEQ_COUNT \
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
28 -m intersection-nonempty \
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
29 -i gene_id \
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
30 -r pos \
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
31 -s no \
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
32 - $GTF > $HTSEQ_COUNT_OUT
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
33
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
34 Rscript $EXPRESSION_R $HTSEQ_COUNT_OUT
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
35
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
36 mv $EXPRESSION_OUT_TMP/$SAMPLE_ID".txt" $EXPRESSION_OUT/
27ebc30a2024 Uploaded
daumsoft
parents:
diff changeset
37