-
Notifications
You must be signed in to change notification settings - Fork 0
/
Annotations.sh
105 lines (94 loc) · 3.07 KB
/
Annotations.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
105
#!/usr/bin/env bash
### HELP
usageHelp="Usage: ${0##*/} [-c config file ]"
configHelp="* [-c config file]: provide config file"
stageHelp="* [-s stage]: if specified, it must be either \"CGI\", \"MethFrag\", \"cluster\" "
helpHelp="* -h: print this help and exit"
printHelpAndExit() {
echo -e "$usageHelp"
echo -e "$configHelp"
echo -e "$stageHep"
echo "$helpHelp"
exit $1
}
while getopts "c:s:" opt; do
case $opt in
c) config=$OPTARG ;;
s) stage=$OPTARG ;;
h) printHelpAndExit 0;;
?]) printHelpAndExit 1;;
esac
done
if [ ! -z "$config" ]
then
source ${config}
source ${condaActivate}
conda activate ${condEnv}
else
echo "ERROR: config file not provied"
echo "$usageHelp"
echo "$configHelp"
echo "$stageHelp"
exit 1
fi
if [ ! -z "$stage" ]
then
case $stage in
CGI) CGI=1 ;;
MethFrag) MethFrag=1 ;;
cluster) cluster=1 ;;
*) echo "$usageHelp"
echo "$stageHelp"
exit 1
esac
else
all=1
fi
############# VARIABLES ###################
mkdir -p ${OutDir}/Logs
rm -f ${OutDir}/Logs/*
dt=`date '+%H:%M:%S'`
script=`dirname $(realpath $0)`
################################
if [[ ! -z "$all" ]] || [[ ! -z "$CGI" ]]; then
mkdir -p ${OutDir}/CGI
for sp in ${species[@]}; do
bsub -J"${sp}_cgi_${dt}" -g /cpg -M 30000 -R "rusage[mem=30000]" -n 3 \
-oo ${OutDir}/Logs/${conv[${sp}]}_cgi.out -e ${OutDir}/Logs/${conv[${sp}]}_cgi.err \
"cpgplot -sequence ${Genomes}/${conv[${sp}]}/*filtered.fa \
-window ${window} \
-minlen ${minlen} \
-minoe ${minoe} \
-minpc ${minpc} \
-outfile ${OutDir}/CGI/${conv[${sp}]}.cpg \
-graph ${graph} \
-outfeat ${OutDir}/CGI/${conv[${sp}]}_feature.txt";
done
fi
if [[ ! -z "$all" ]] ; then
mkdir -p ${OutDir}/MethFragmentation
for sp in in ${species[@]}; do
for tiss in ${tissues[@]}; do
bsub -J"${sp}_${tiss}_MF_${dt}" -g /mf -M 20000 -R "rusage[mem=20000]" -n 2 \
-oo ${OutDir}/Logs/${conv[${sp}]}_${tiss}_MF.out -e ${OutDir}/Logs/${conv[${sp}]}_${tiss}_MF.err \
-w "done(${sp}_cgi_${dt})" \
"Rscript ${script}/Ann_methFragmentation.R \
${conv[${sp}]} \
${OutDir}/Meth/${conv[${sp}]}_${tiss}_meth.bed \
${OutDir}/CGI/${conv[${sp}]}_feature.txt"
done
done
elif [[ ! -z "${MethFrag}" ]]; then
mkdir -p ${OutDir}/MethFragmentation
for sp in ${species[@]}; do
for tiss in ${tissues[@]}; do
bsub -J"${sp}_${tiss}_MF_${dt}" -g /mf -M 20000 -R "rusage[mem=20000]" -n 2 \
-oo ${OutDir}/Logs/${conv[${sp}]}_${tiss}_MF.out -e ${OutDir}/Logs/${conv[${sp}]}_${tiss}_MF.err \
"Rscript ${script}/Ann_methFragmentation.R \
${conv[${sp}]} \
${OutDir}/Meth/${conv[${sp}]}_${tiss}_meth.bed \
${OutDir}/CGI/${conv[${sp}]}_feature.txt \
${OutDir}/MethFragmentation"
done
done
fi