-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_PMET_promoter.sh
180 lines (164 loc) · 5.11 KB
/
01_PMET_promoter.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
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/bin/bash
function error_exit() {
echo "ERROR: $1" >&2
usage
exit 1
}
print_red(){
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "${RED}$1${NC}\n"
}
print_green(){
GREEN='\033[0;32m'
NC='\033[0m' # No Color
printf "${GREEN}$1${NC}\n"
}
print_orange(){
ORANGE='\033[0;33m'
NC='\033[0m' # No Color
printf "${ORANGE}$1${NC}\n"
}
print_fluorescent_yellow(){
FLUORESCENT_YELLOW='\033[1;33m'
NC='\033[0m' # No Color
printf "${FLUORESCENT_YELLOW}$1${NC}\n"
}
print_white(){
WHITE='\033[1;37m'
NC='\033[0m' # No Color
printf "${WHITE}$1${NC}"
}
# Give execute permission to all users for the file.
chmod a+x scripts/cpp_debug_needed/homotypic_promoters.sh
chmod a+x scripts/gff3sort/gff3sort.pl
########################## Downloading data #######################################
# cd data
# if [ -f "TAIR10.gff3" ]; then
# echo ""
# else
# print_green "Downloading genome and annotation...\n"
# chmod a+x ./fetch_data.sh
# bash ./fetch_data.sh
# fi
# cd ..
########################## Parameters #######################################
# tool
toolDir=scripts
HOMOTYPIC=$toolDir/PMETindex_promoters_fimo_integrated.sh
HETEROTYPIC=$toolDir/pmetParallel
chmod a+x $HOMOTYPIC
chmod a+x $HETEROTYPIC
threads=8
res_dir=results/01_PMET_promoter
# homotypic
gff3id="gene_id="
overlap="NoOverlap"
# overlap="Yes"
utr="Yes"
topn=5000
maxk=5
length=1000
fimothresh=0.05
distance=1000
gff3id="gene_id="
delete_temp=no
isPoisson=false
# data
genome=data/TAIR10.fasta
anno=data/TAIR10.gff3
meme=data/Franco-Zorrilla_et_al_2014.meme
# output
homotypic_output=$res_dir/01_homotypic
# heterotypic
task=genes_cell_type_treatment
gene_input_file=data/genes/$task.txt
heterotypic_output=$res_dir/02_heterotypic
icthresh=4
# plot output
plot_output=$res_dir/plot
mkdir -p $homotypic_output
mkdir -p $heterotypic_output
mkdir -p $plot_output
################################ Running homotypic ###################################
print_green "Searching for homotypic motif hits..."
$HOMOTYPIC \
-r $toolDir \
-o $homotypic_output \
-i $gff3id \
-k $maxk \
-n $topn \
-p $length \
-v $overlap \
-u $utr \
-f $fimothresh \
-t $threads \
-d $delete_temp \
-x $isPoisson \
$genome \
$anno \
$meme
rm -rf $homotypic_output/fimo
##################################### Heterotypic ##################################
print_green "\n\nSearching for heterotypic motif hits..."
# remove genes not present in pre-computed pmet index
grep -Ff $homotypic_output/universe.txt $gene_input_file > $gene_input_file"temp"
$HETEROTYPIC \
-d . \
-g $gene_input_file"temp" \
-i $icthresh \
-p $homotypic_output/promoter_lengths.txt \
-b $homotypic_output/binomial_thresholds.txt \
-c $homotypic_output/IC.txt \
-f $homotypic_output/fimohits \
-o $heterotypic_output \
-t $threads > $heterotypic_output/pmet.log
cat $heterotypic_output/*.txt > $heterotypic_output/motif_output.txt
rm $heterotypic_output/temp*.txt
rm $gene_input_file"temp"
print_green "\n\nSearching for heterotypic motif hits..."
# remove genes not present in pre-computed pmet index
grep -Ff $homotypic_output/universe.txt $gene_input_file > $gene_input_file"temp"
$toolDir/pmet \
-d . \
-g $gene_input_file"temp" \
-i $icthresh \
-p $homotypic_output/promoter_lengths.txt \
-b $homotypic_output/binomial_thresholds.txt \
-c $homotypic_output/IC.txt \
-f $homotypic_output/fimohits \
-o $heterotypic_output
rm $gene_input_file"temp"
##################################### Heatmap ##################################
print_green "\n\nCreating heatmap...\n"
Rscript 05_heatmap.R \
All \
$plot_output/heatmap.png \
$heterotypic_output/motif_output.txt \
5 \
3 \
6 \
FALSE
Rscript 05_heatmap.R \
Overlap \
$plot_output/heatmap_overlap_unique.png \
$heterotypic_output/motif_output.txt \
5 \
3 \
6 \
TRUE
Rscript 05_heatmap.R \
Overlap \
$plot_output/heatmap_overlap.png \
$heterotypic_output/motif_output.txt \
5 \
3 \
6 \
FALSE
# method
# filename
# pmet.out
# topn
# histgram_ncol
# histgram_width
# unique_cmbination