Mercurial > repos > vipints > rdiff
comparison rDiff/galaxy/rdiff_run.sh @ 0:0f80a5141704
version 0.3 uploaded
author | vipints |
---|---|
date | Thu, 14 Feb 2013 23:38:36 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0f80a5141704 |
---|---|
1 #/bin/bash | |
2 # Galaxy wrapper script for rDiff version 0.3 | |
3 # Copyright (C) 2013 cBio Department Memorial Sloan-Kettering Cancer Center | |
4 | |
5 #Licence Information: GPL | |
6 #This program is free software; you can redistribute it and/or modify | |
7 #it under the terms of the GNU General Public License as published by | |
8 #the Free Software Foundation; either version 3 of the License, or | |
9 #(at your option) any later version | |
10 | |
11 set -e | |
12 | |
13 PROG=`basename $0` | |
14 DIR=`dirname $0` | |
15 . ${DIR}/../bin/rdiff_config.sh | |
16 | |
17 echo | |
18 echo ${PROG}: This program is part of the rDiff version $RDIFF_VERSION. | |
19 echo | |
20 echo rDiff performs differential expression testing from RNA-Seq measurements. | |
21 echo | |
22 | |
23 if [ -z "$1" -o "$1" == '--help' ]; | |
24 then | |
25 echo Usage: $0 poisson\|param\|nonparam in.gff readLength out.resultfile out_result_dir S1_in.bam?:S2_in.bam?: | |
26 echo " :" $0 poisson\|param\|nonparam in.gff readLength out.resultfile out_result_dir S1_R1_in.bam?S1_R2_in.bam?:S2_R1_in.bam?S2_R2_in.bam?: | |
27 echo " or:" $0 --help | |
28 echo | |
29 false | |
30 fi | |
31 | |
32 if [ "$1" != 'poisson' -a "$1" != 'param' -a "$1" != 'nonparam' ]; | |
33 then | |
34 echo invalid parameter: $1 | |
35 echo | |
36 echo "For usage:" $0 --help | |
37 false | |
38 fi | |
39 | |
40 TEST_METH=$1 ## Test method | |
41 shift | |
42 GFF_INPUT=$1 ## Genome annotation in GFF format | |
43 shift | |
44 readlength=$1 ## Sequencing read length | |
45 shift | |
46 RDIFF_OUT=$1 ## rDiff result file | |
47 shift | |
48 RDIFF_OUT_PATH=$1 ## temp session working directory | |
49 shift | |
50 | |
51 if [ -d $RDIFF_OUT_PATH ] | |
52 then | |
53 echo "Using the extra file path as : $RDIFF_OUT_PATH" | |
54 else | |
55 mkdir -p ${RDIFF_OUT_PATH} ## create the temp working directory | |
56 fi | |
57 | |
58 ## changing tool working directory to the session path | |
59 cd ${RDIFF_OUT_PATH} | |
60 | |
61 ## Seperating the files according to the sample and correspondinf replicates. | |
62 SAMPLE_LIST=() | |
63 for SAMPLES in $@ | |
64 do | |
65 IFS='?' | |
66 for BAM_FILE in ${SAMPLES} | |
67 do | |
68 if [ $BAM_FILE = ":" ]; ## samples are seperated with ':' | |
69 then | |
70 SAMPLE_LIST+=(${SAMPLE_FNAME%?}) ## samples are separating | |
71 SAMPLE_FNAME="" | |
72 continue | |
73 fi | |
74 if [ ! -f ${BAM_FILE}.bai ] | |
75 then | |
76 echo "Indexing $BAM_FILE" | |
77 ${RDIFF_SAMTOOLS_INCLUDE_DIR}/samtools index $BAM_FILE | |
78 else | |
79 echo "$BAM_FILE already indexed" | |
80 fi | |
81 La_fn=$BAM_FILE | |
82 SAMPLE_FNAME="$SAMPLE_FNAME$BAM_FILE," ## adding a ',' between each BAM files. | |
83 done | |
84 done | |
85 | |
86 ## rDiff execution call | |
87 ${DIR}/../bin/rdiff -o ${RDIFF_OUT_PATH} -d / -g ${GFF_INPUT} -a ${SAMPLE_LIST[0]} -b ${SAMPLE_LIST[1]} -m ${TEST_METH} -L ${readlength} | |
88 | |
89 ## rdiff out file | |
90 ln -fs ${RDIFF_OUT_PATH}/P_values_rDiff_"${TEST_METH/param/parametric}".tab ${RDIFF_OUT} |