0
|
1 #/bin/bash
|
|
2 #
|
|
3 # This program is free software; you can redistribute it and/or modify
|
|
4 # it under the terms of the GNU General Public License as published by
|
|
5 # the Free Software Foundation; either version 3 of the License, or
|
|
6 # (at your option) any later version.
|
|
7 #
|
9
|
8 # Copyright (C) 2009-2013 Max Planck Society & Memorial Sloan-Kettering Cancer Center
|
0
|
9 #
|
|
10
|
|
11 set -e
|
|
12
|
|
13 PROG=`basename $0`
|
|
14 DIR=`dirname $0`
|
|
15
|
|
16 . ${DIR}/../bin/deseq_config.sh
|
|
17
|
|
18 echo
|
9
|
19 echo ${PROG}: Oqtans http://galaxy.cbio.mskcc.org Galaxy wrapper for the DESeq version $DESEQ_VERSION.
|
0
|
20 echo
|
|
21 echo DESeq performs differential expression testing from RNA-Seq measurements.
|
|
22 echo
|
|
23
|
|
24 ANNO_INPUT=${1}
|
|
25 shift
|
|
26 DESEQ_RES_FILE=${1}
|
|
27 shift
|
|
28 GENES_FN=${1}
|
|
29 shift
|
|
30
|
|
31 mkdir -p `dirname $GENES_FN`
|
|
32
|
|
33 echo %%%%%%%%%%%%%%%%%%%%%%%
|
|
34 echo % 1. Data preparation %
|
|
35 echo %%%%%%%%%%%%%%%%%%%%%%%
|
|
36 echo
|
|
37 echo load the genome annotation in GFF3 format and create an annotation object
|
|
38 export PYTHONPATH=$PYTHONPATH:${SCIPY_PATH}
|
|
39 ${PYTHON_PATH} ${DIR}/../tools/ParseGFF.py ${ANNO_INPUT} ${GENES_FN}
|
9
|
40 ${DIR}/../bin/genes_cell2struct ${GENES_FN}
|
0
|
41 echo
|
|
42 echo genome annotation stored in $GENES_FN
|
|
43
|
|
44 echo %%%%%%%%%%%%%%%%%%%%
|
|
45 echo % 2. Read counting %
|
|
46 echo %%%%%%%%%%%%%%%%%%%%
|
|
47 echo
|
|
48
|
|
49 echo counting reads overlapping exons using given alignments
|
|
50 for REPLICATE_GROUP in $@
|
|
51 do
|
|
52 IFS=':'
|
|
53 for BAM_FILE in ${REPLICATE_GROUP}
|
|
54 do
|
|
55 echo
|
|
56 if [ ! -f ${BAM_FILE}.bai ]
|
|
57 then
|
|
58 echo "Indexing $BAM_FILE"
|
|
59 ${SAMTOOLS_DIR}/samtools index $BAM_FILE
|
|
60 else
|
|
61 echo "$BAM_FILE already indexed"
|
|
62 fi
|
|
63 echo
|
|
64 done
|
|
65 done
|
|
66 tmpfile=`mktemp --tmpdir=/tmp`
|
|
67
|
|
68 echo "${DIR}/../bin/get_read_counts ${GENES_FN} $tmpfile $@"
|
9
|
69 ${DIR}/../bin/get_read_counts ${GENES_FN} $tmpfile "$@"
|
0
|
70
|
|
71 echo %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
72 echo % 3. Differential testing %
|
|
73 echo %%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
74 echo
|
|
75 echo testing genes for differential expression using given alignments
|
|
76
|
|
77 echo "cat ${DIR}/../src/difftest_deseq.R | $R_PATH --slave --args $tmpfile ${DESEQ_RES_FILE} $#"
|
9
|
78 cat ${DIR}/../src/difftest_deseq.R | $R_PATH --slave --args $tmpfile ${DESEQ_RES_FILE} $#
|
0
|
79
|
|
80 rm $tmpfile ${tmpfile}_COUNTS.tab ${tmpfile}_CONDITIONS.tab
|
|
81 echo %%%%%%%%
|
|
82 echo % Done %
|
|
83 echo %%%%%%%%
|