comparison dexseq-hts_1.0/src/DEXseq-hts.sh @ 11:cec4b4fb30be draft default tip

DEXSeq version 1.6 added
author vipints <vipin@cbio.mskcc.org>
date Tue, 08 Oct 2013 08:22:45 -0400
parents
children
comparison
equal deleted inserted replaced
10:2fe512c7bfdf 11:cec4b4fb30be
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 #
8 # Copyright (C) 2013 Memorial Sloan-Kettering Cancer Center
9 ##
10
11 set -e
12
13 PROG=`basename $0`
14 DIR=`dirname $0`
15
16 . ${DIR}/../bin/dexseq_config.sh
17
18 echo
19 echo ${PROG}: Oqtans http://galaxy.cbio.mskcc.org Galaxy wrapper for the DEXSeq version ${DEXSEQ_VERSION}.
20 echo
21 echo DEXSeq: Detecting differential usage of exons from RNA-seq data.
22 echo
23
24 ## input arguments from the interface
25 GFF_IN=${1}
26 shift
27 MATE_PAIR=${1}
28 shift
29 LIBTP=${1}
30 shift
31 minQL=${1}
32 shift
33 RES_FILE=${1}
34 shift
35 RES_WD=${1}
36 shift
37
38 ## associated array with sequencing type.
39 declare -A SEQ_TYPE=( [no]=SE [yes]=PE )
40
41 echo %%%%%%%%%%%%%%%%%%%%%%%
42 echo % 1. Data preparation %
43 echo %%%%%%%%%%%%%%%%%%%%%%%
44 echo
45
46 mkdir -p ${RES_WD}
47 echo extra file path $RES_WD
48 tmpGTF=`mktemp --tmpdir=/tmp`
49
50 echo load the genome annotation in GFF file
51
52 ${PYTHON_PATH} ${DIR}/dexseq_prepare_annotation.py ${GFF_IN} ${tmpGTF}
53 echo genome annotation stored in ${tmpGTF}
54 echo
55
56 echo %%%%%%%%%%%%%%%%%%%%
57 echo % 2. Read counting %
58 echo %%%%%%%%%%%%%%%%%%%%
59 echo
60
61 tmpFILE=`mktemp --tmpdir=/tmp`
62 echo $tmpFILE
63 echo -e '\t'condition'\t'libType > ${tmpFILE}_CONDITIONS.tab
64
65 COND=0
66 for REPLICATE_GROUP in $@
67 do
68 IFS=':'
69 COND=$((COND+1))
70 for BAM_FILE in ${REPLICATE_GROUP}
71 do
72 ## different group information
73 REPNAME=$(basename ${BAM_FILE%.dat})
74 echo -e ${REPNAME}"\t"$COND"\t"${SEQ_TYPE[$MATE_PAIR]} >> ${tmpFILE}_CONDITIONS.tab
75
76 ## counting the reads
77 ${SAMTOOLS_DIR}/samtools view -h $BAM_FILE | ${PYTHON_PATH} ${DIR}/dexseq_count.py -p ${MATE_PAIR} -s ${LIBTP} -a ${minQL} ${tmpGTF} - ${RES_WD}/${REPNAME}
78
79 echo
80 done
81 echo conuted condition ${COND}
82 done
83 echo counted reads map to each exon.
84 echo
85
86 echo %%%%%%%%%%%%%%%%%%%%%%%%%%%
87 echo % 3. Differential testing %
88 echo %%%%%%%%%%%%%%%%%%%%%%%%%%%
89 echo
90
91 echo "cat ${DIR}/run_DEXseq.R | $R_PATH --slave --args $tmpFILE $RES_WD $tmpGTF ${RES_FILE} $#"
92 cat ${DIR}/run_DEXseq.R | $R_PATH --slave --args $tmpFILE $RES_WD $tmpGTF ${RES_FILE}
93
94 ## clean up
95 rm -fr ${RES_WD} ${tmpGTF} ${tmpFILE}
96 echo %%%%%%%%
97 echo % Done %
98 echo %%%%%%%%