/
Pairwise_edgeR.sh
executable file
·104 lines (93 loc) · 3.08 KB
/
Pairwise_edgeR.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
usage () {
echo "usage: $0 [-o <output>] [-c <name>] [-x <#>] [-t <name>] [-y <#>] [-f <file1>] [-r <path>] "
echo "Required parameters:"
echo "-o The name for the output file"
echo "-c The name for the control condition"
echo "-x The number of replicates for the control condition"
echo "-t The name for the test condition"
echo "-y The number of replicates for the test condition"
echo "-f The tab-delimited total count file"
echo "-r The path to Pairwise_edgeR.R"
echo ""
echo "The required parameters must precede the files to be joined, listed with the"
echo " control conditions followed by the test conditions. See example below."
echo ""
echo "Example:"
echo "$0 -o Example -c healthy -x 3 -t disease -y 3 all.counts.txt"
}
# Read in the important options
while getopts ":o:h:c:x:t:y:f:" option; do
case "$option" in
o) OUT_PFX="$OPTARG" ;;
c) CONTROL_PFX="$OPTARG" ;;
x) CONTROL_REPS="$OPTARG" ;;
t) TEST_PFX="$OPTARG" ;;
y) TEST_REPS="$OPTARG" ;;
f) FILE="$OPTARG" ;;
r) PATHTO="$OPTARG" ;;
h) # it's always useful to provide some help
usage
exit 0
;;
:) echo "Error: -$option requires an argument"
usage
exit 1
;;
?) echo "Error: unknown option -$option"
usage
exit 1
;;
esac
done
shift $(( OPTIND - 1 ))
# Do some error checking to make sure parameters are defined
if [ -z "$OUT_PFX" ]; then
echo "Error: you must specify an output prefix for your file using -o"
usage
exit 1
fi
if [ -z "$CONTROL_PFX" ]; then
echo "Error: you must specify the name for your control"
echo "using -c"
usage
exit 1
fi
if [ -z "$CONTROL_REPS" ]; then
echo "Error: you must specify the number of replicates for your control"
echo "condition using -x"
usage
exit 1
fi
if [ -z "$TEST_REPS" ]; then
echo "Error: you must specify the number of replicates for your test"
echo "condition using -y"
usage
exit 1
fi
if [ -z "$TEST_PFX" ]; then
echo "Error: you must specify the number of replicates for your test"
echo "condition using -t"
usage
exit 1
fi
if [ -z "$FILE" ]; then
echo "Error: you must specify the path to the count file"
echo "using -f"
usage
exit 1
fi
# Print the different prefixes, conditions, and number of replicates
date > $OUT_PFX.log.txt
echo "" >> $OUT_PFX.log.txt 2>&1
echo "Output file prefix: $OUT_PFX" >> $OUT_PFX.log.txt 2>&1
echo "Control condition name: $CONTROL_PFX" >> $OUT_PFX.log.txt 2>&1
echo "Replicates for control: $CONTROL_REPS" >> $OUT_PFX.log.txt 2>&1
echo "Test condition name: $TEST_PFX" >> $OUT_PFX.log.txt 2>&1
echo "Replicates for test condition: $TEST_REPS" >> $OUT_PFX.log.txt 2>&1
echo "" >> $OUT_PFX.log.txt 2>&1
# Running DESeq through my DESeq R script using established variables and
# the newly joined raw count file
echo "Running DESeq on $FILE" >> $OUT_PFX.log.txt 2>&1
Rscript $METARNASEQDIR/Pairwise_edgeR.R $FILE $OUT_PFX $CONTROL_PFX $CONTROL_REPS $TEST_PFX $TEST_REPS >> $OUT_PFX.log.txt 2>&1
exit