-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_results_scans.sh
executable file
·195 lines (164 loc) · 7.05 KB
/
get_results_scans.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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/bin/sh
#======================================#
# get results for complete genome scan #
#======================================#
# source R modules
# source module_load_r.sh
# start program for reformatting results
if [ ! -d results_genome_scan ]; then
mkdir results_genome_scan
fi
cd data_parameters/
nb_chromosomes=$(cat "nb_chromosomes.txt")
nb_snp_hap=$(cat "nb_snp_hap.txt")
kernel_index=$(cat "kernel_index.txt")
modify_signif_level=true # true or false (note lower case)
new_signif_level=0.01
if [ "$modify_signif_level"=true ] ; then
echo "$new_signif_level" > signif_level.txt
if [ -d results_genome_scan ]; then
rm -rf results_genome_scan/*
fi
fi
cp trait_name.txt ../results_genome_scan
cp nb_snp_hap.txt ../results_genome_scan
cp nb_chromosomes.txt ../results_genome_scan
cp physical_map.txt ../results_genome_scan
cp phased_genotypes.txt ../results_genome_scan
cp genotypes.txt ../results_genome_scan
cp kernel_index.txt ../results_genome_scan
cp signif_level.txt ../results_genome_scan
cd ../programs/
cp mult_test_correction.R ../results_genome_scan
cp get_results_scans.R ../results_genome_scan
cp plot_nb_hap_scans.R ../results_genome_scan
cp plot_manhattan_scan.R ../results_genome_scan
cd ../
#--------------------------------#
# moving through all directories #
#--------------------------------#
for chromo_num_k in $(seq 1 1 $nb_chromosomes)
do
cd genome_scan_chromo_num_$chromo_num_k
cp vect_rlrt_value_chromo_num_$chromo_num_k.txt ../results_genome_scan
cp vect_nb_hap_window_chromo_num_$chromo_num_k.txt ../results_genome_scan
cd ../
done
cd results_genome_scan
R -q --vanilla < mult_test_correction.R
R -q --vanilla < get_results_scans.R
R -q --vanilla < plot_nb_hap_scans.R
R -q --vanilla < plot_manhattan_scan.R
if [ "$kernel_index" -gt 1 ] ; then
if [ "$nb_snp_hap" -gt 1 ] ; then
for chromo_num_k in $(seq $nb_chromosomes -1 1)
do
if [ -d results_chromo_num_$chromo_num_k ]; then
rm -rf results_chromo_num_$chromo_num_k/*
else
mkdir results_chromo_num_$chromo_num_k
fi
mv flanking_markers_of_tested_positions_in_kb_with_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
mv flanking_markers_of_tested_positions_in_kb_with_significant_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
if ls significant_haplotypes_chromo_num_$chromo_num_k* 1> /dev/null 2>&1; then
mv significant_haplotypes_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
fi
mv vect_rlrt_value_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
mv vect_nb_hap_window_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
mv number_of_haplotypes_per_window_for_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
mv kernelized_haplotype_based_genome_scan_of_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
done
if [ -d results_all_chromosomes ]; then
rm -rf results_all_chromosomes/*
else
mkdir results_all_chromosomes
fi
mv number_of_haplotypes_per_window_for_complete_genome_scan* results_all_chromosomes
mv kernelized_haplotype_based_genome_scan_for_* results_all_chromosomes
mv qq_plot_kernelized_haplotype_* results_all_chromosomes
mv flanking_markers_of_tested_positions_with_statistics* results_all_chromosomes
else
for chromo_num_k in $(seq $nb_chromosomes -1 1)
do
if [ -d results_chromo_num_$chromo_num_k ]; then
rm -rf results_chromo_num_$chromo_num_k/*
else
mkdir results_chromo_num_$chromo_num_k
fi
mv markers_in_kb_with_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
mv markers_in_kb_with_significant_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
if ls significant_snps_chromo_num_$chromo_num_k* 1> /dev/null 2>&1; then
mv significant_snps_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
fi
mv vect_rlrt_value_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
mv kernelized_gwas_of_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
done
if [ -d results_all_chromosomes ]; then
rm -rf results_all_chromosomes/*
else
mkdir results_all_chromosomes
fi
mv kernelized_gwas_for_* results_all_chromosomes
mv qq_plot_kernelized_gwas_* results_all_chromosomes
mv markers_of_tested_positions_with_statistics.txt* results_all_chromosomes
rm vect_nb_hap_window_chromo_num_*
fi
else
if [ "$nb_snp_hap" -gt 1 ] ; then
for chromo_num_k in $(seq $nb_chromosomes -1 1)
do
if [ -d results_chromo_num_$chromo_num_k ]; then
rm -rf results_chromo_num_$chromo_num_k/*
else
mkdir results_chromo_num_$chromo_num_k
fi
mv flanking_markers_of_tested_positions_in_kb_with_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
mv flanking_markers_of_tested_positions_in_kb_with_significant_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
if ls significant_haplotypes_chromo_num_$chromo_num_k* 1> /dev/null 2>&1; then
mv significant_haplotypes_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
fi
mv vect_rlrt_value_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
mv vect_nb_hap_window_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
mv number_of_haplotypes_per_window_for_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
mv haplotype_based_genome_scan_of_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
done
if [ -d results_all_chromosomes ]; then
rm -rf results_all_chromosomes/*
else
mkdir results_all_chromosomes
fi
mv number_of_haplotypes_per_window_for_complete_genome_scan* results_all_chromosomes
mv haplotype_based_genome_scan_for_* results_all_chromosomes
mv qq_plot_haplotype_* results_all_chromosomes
mv flanking_markers_of_tested_positions_with_statistics* results_all_chromosomes
else
for chromo_num_k in $(seq $nb_chromosomes -1 1)
do
if [ -d results_chromo_num_$chromo_num_k ]; then
rm -rf results_chromo_num_$chromo_num_k/*
else
mkdir results_chromo_num_$chromo_num_k
fi
mv markers_in_kb_with_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
mv markers_in_kb_with_significant_rlrt_value_on_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
if ls significant_snps_chromo_num_$chromo_num_k* 1> /dev/null 2>&1; then
mv significant_snps_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
fi
mv vect_rlrt_value_chromo_num_$chromo_num_k* results_chromo_num_$chromo_num_k
mv gwas_of_chromosome_$chromo_num_k* results_chromo_num_$chromo_num_k
done
if [ -d results_all_chromosomes ]; then
rm -rf results_all_chromosomes/*
else
mkdir results_all_chromosomes
fi
mv gwas_for_* results_all_chromosomes
mv qq_plot_gwas_* results_all_chromosomes
mv markers_of_tested_positions_with_statistics.txt* results_all_chromosomes
rm vect_nb_hap_window_chromo_num_*
fi
fi
clear
rm *.R
rm *.txt
# End of program for reformatting results