-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07_PMET_promoters_distance_to_tss.sh
165 lines (145 loc) · 4.87 KB
/
07_PMET_promoters_distance_to_tss.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
#!/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
################################ 1. Downloading data #######################################
download 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 ..
################################ 2. input parameters ###################################
# tool
toolDir=scripts
HOMOTYPIC=$toolDir/PMETindex_promoters_with_distance_tss_fimo_intergrated.sh
HETEROTYPIC=$toolDir/pmetParallel
chmod a+x $HOMOTYPIC
chmod a+x $HETEROTYPIC
threads=4
res_dir=results/07_distance_to_tss
gff3id="gene_id="
# overlap="NoOverlap"
overlap="Yes"
utr="Yes"
topn=5000
maxk=5
length=300
fimothresh=0.05
gap=100
promlengthlimit=300
gff3id="gene_id="
delete_temp=no
# 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_file=data/genes/$task.txt
fimothresh=005
icthresh=4
heterotypic_output=$res_dir/02_heterotypic
logDir=results/logs
plot_output=$res_dir/heatmap
mkdir -p $homotypic_output
mkdir -p $heterotypic_output
mkdir -p $logDir
mkdir -p $plot_output
start_time=$SECONDS
#################################### 3. Running PMET ########################################
for promlengthlimit in 20; do
for length in 50 ; do
for gap in 200; do
################################ Running homotypic ###################################
homo_temp=$homotypic_output/plen${length}_gap${gap}_plenmin${promlengthlimit}
mkdir -p $homo_temp
print_green "Running fimo...\n"
$HOMOTYPIC \
-r $toolDir \
-o $homo_temp \
-i $gff3id \
-k $maxk \
-n $topn \
-p $length \
-g $gap \
-l $promlengthlimit \
-v $overlap \
-u $utr \
-f $fimothresh \
-t $threads \
-d $delete_temp \
$genome \
$anno \
$meme
for task in "genes_cell_type_treatment" "gene_cortex_epidermis_pericycle"; do
gene_input_file=data/genes/$task.txt
heterotypic_output=$res_dir/02_heterotypic_${task}
hetero_temp=$heterotypic_output/plen${length}_gap${gap}_plenmin${promlengthlimit}
plot_output=$res_dir/plot_${task}/heatmap
mkdir -p $hetero_temp
mkdir -p $plot_output
# ########################## Running heterotypic ##################################
# print_green "\n\nSearching for heterotypic motif hits..."
# # remove genes not present in pre-computed pmet index
# grep -Ff $homo_temp/universe.txt $gene_input_file > $gene_input_file"temp"
# $HETEROTYPIC \
# -d . \
# -g $gene_input_file"temp" \
# -i $icthresh \
# -p $homo_temp/promoter_lengths.txt \
# -b $homo_temp/binomial_thresholds.txt \
# -c $homo_temp/IC.txt \
# -f $homo_temp/fimohits \
# -o $hetero_temp \
# -t $threads > $hetero_temp/pmet.log
# cat $hetero_temp/*.txt > $hetero_temp/motif_output.txt
# rm $hetero_temp/temp*.txt
# rm $gene_input_file"temp"
done
done
done
done
end_time=$SECONDS
elapsed_time=$((end_time - start_time))
days=$((elapsed_time/86400))
hours=$(( (elapsed_time%86400)/3600 ))
minutes=$(( (elapsed_time%3600)/60 ))
seconds=$((elapsed_time%60))
print_orange " Time taken: $days day $hours hour $minutes minute $seconds second\n"