-
Notifications
You must be signed in to change notification settings - Fork 3
/
rjBitSeq
executable file
·135 lines (125 loc) · 3.63 KB
/
rjBitSeq
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
echo "Display usage info: rjBitSeq --help"
exit 0
fi
if [ $1 == C ]
then
echo "ERROR: Two sets of files should be provided, separated by C"
echo "Display usage info: rjBitSeq --help"
echo "exiting."
exit 0
fi
if [ $1 == --help ]
then
echo ""
echo ".............................................................................................."
echo ". Usage: rjBitSeq <outputDir> <.prob files condition A> C <.prob files condition B> ."
echo ". ."
echo ". Reversible Jump algorithm for Differential Expression analysis ."
echo ". ."
echo ". Arguments: ."
echo ". <outputDir>: Name of the output directory. ."
echo ". ."
echo ". <.prob files condition A>: Space-separated list of '.prob' files for the first sample. ."
echo ". ."
echo ". <.prob files condition B>: Space-separated list of '.prob' files for the second sample. ."
echo ". ."
echo ". Note: '.prob' files contain alignment probabilities for each read ."
echo ". and they are computed using the 'parseAlignment' command of Bitseq. ."
echo ". ."
echo ". Detailed documentation and examples: https://github.com/mqbssppe/rjBitSeq-1.0/wiki ."
echo ".............................................................................................."
echo ""
exit 0
fi
if test -d $1; then echo "Directory exists! Please provide different name."; exit 0; fi
mkdir $1
CWD=$(pwd)
echo "output written to $CWD/$1"
a=`expr 1`
b=`expr 0`
c=`expr 2`
echo "First condition files:"
for i in $*
do
if [ $i == $1 ]
then
a=`expr 2`
fi
if [ $a -eq 1 ]
then
if [ $i == C ]
then
a=`expr 2`
c=`expr 1`
else
b=$((b+1))
echo " : $i, $b"
if [ ! -f $i ]; then
echo "ERROR: File not found!"
echo "exiting."
echo "Display usage info: rjBitSeq --help"
exit 0
fi
cd $1
ln -s ../$i conditionA_$b.prob
sed '3d' conditionA_$b.prob > tmpfile
mv tmpfile conditionA_$b.prob
cd ..
fi
fi
if [ $i == $1 ]
then
a=`expr 1`
fi
done
a=`expr 1`
b=`expr 0`
echo "Second condition files:"
for i in $*
do
if [ $i == C ]
then
a=`expr 2`
c=`expr 1`
fi
if [ $a -eq 2 ]
then
if [ $i != C ]
then
b=$((b+1))
echo " : $i, $b"
if [ ! -f $i ]; then
echo "ERROR: File not found!"
echo "Display usage info: rjBitSeq --help"
echo "exiting."
exit 0
fi
cd $1
ln -s ../$i conditionB_$b.prob
sed '3d' conditionB_$b.prob > tmpfile
mv tmpfile conditionB_$b.prob
cd ..
fi
fi
done
if [ $c -eq 2 ]
then
echo "ERROR: Two sets of files should be provided, separated by C"
echo "Display usage info: rjBitSeq --help"
echo "exiting."
exit 0
fi
cd $1
cpThis.bash
echo "computing clusters (output written to $CWD/$1/partitionMerge2.Rout)"
time R CMD BATCH partitionMerge2.R
echo "done!"
echo "Running Reversible Jump using parallel GNU"
time ./parallelGNU.bash
echo "Done!"
echo "Estimates written to $CWD/$1/estimates.txt"
exit 0