-
Notifications
You must be signed in to change notification settings - Fork 0
/
auto_finalmodel_CV.pl
executable file
·66 lines (53 loc) · 3.34 KB
/
auto_finalmodel_CV.pl
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
#!/usr/bin/perl -w
$sig_th = 0.001;
if (scalar(@ARGV) == 5) {
$CTmode = shift(@ARGV);
$sub = shift(@ARGV);
$path = shift(@ARGV);
$ratefiledir = shift(@ARGV);
$modelpath = shift(@ARGV);
} else {
print "usage: %> auto_finalmodel_CV.pl [0|1|2] [A-C|A-G|A-T|C-A|C-G|C-T] path ratefiledir modelpath\n";
exit();
}
#prep the model file list to generate CV stats for
open OUT, ">@{[$path]}/modellist_@{[$sub]}" or die;
#run the following models in sequence
if ($CTmode == 0) { #nCpG: AC, AG, AT
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/nonCpG_rates_@{[$sub]}_train_cov_vf.txt $modelpath/CVsel_1wayALL $modelpath/CVsel_2wayALL @{[$path]}/tryit_2way >@{[$path]}/2way_nCpG_@{[$sub]}.Rout";
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/nonCpG_rates_@{[$sub]}_train_cov_vf.txt @{[$path]}/tryit_2way $modelpath/CVsel_3wayALL @{[$path]}/tryit_3way >@{[$path]}/3way_nCpG_@{[$sub]}.Rout";
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/nonCpG_rates_@{[$sub]}_train_cov_vf.txt @{[$path]}/tryit_3way $modelpath/CVsel_4wayALL @{[$path]}/tryit_4way >@{[$path]}/4way_nCpG_@{[$sub]}.Rout";
# generate the generic model file
print OUT "CVsel_0way\n";
print OUT "CVsel_1wayALL\n";
print OUT "CVsel_1_2wayALL\n";
print OUT "CVsel_1_2_3wayALL\n";
print OUT "CVsel_1_2_3_4wayALL\n";
} elsif ($CTmode == 1) { #nCpG: CA, CG, CT
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/nonCpG_rates_@{[$sub]}_train_cov_vf.txt $modelpath/CVsel_1wayCT $modelpath/CVsel_2wayCT @{[$path]}/tryit_2way >@{[$path]}/2way_nCpG_@{[$sub]}.Rout";
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/nonCpG_rates_@{[$sub]}_train_cov_vf.txt @{[$path]}/tryit_2way $modelpath/CVsel_3wayCT @{[$path]}/tryit_3way >@{[$path]}/3way_nCpG_@{[$sub]}.Rout";
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/nonCpG_rates_@{[$sub]}_train_cov_vf.txt @{[$path]}/tryit_3way $modelpath/CVsel_4wayCT @{[$path]}/tryit_4way >@{[$path]}/4way_nCpG_@{[$sub]}.Rout";
# generate the generic model file
print OUT "CVsel_0way\n";
print OUT "CVsel_1wayCT\n";
print OUT "CVsel_1_2wayCT\n";
print OUT "CVsel_1_2_3wayCT\n";
print OUT "CVsel_1_2_3_4wayCT\n";
} elsif ($CTmode == 2) { #CpG: CA, CG, CT
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/CpG_rates_@{[$sub]}_train_cov_vf.txt $modelpath/CVsel_1wayCpG $modelpath/CVsel_2wayCpG @{[$path]}/tryit_2way >@{[$path]}/2way_CpG_@{[$sub]}.Rout";
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/CpG_rates_@{[$sub]}_train_cov_vf.txt @{[$path]}/tryit_2way $modelpath/CVsel_3wayCpG @{[$path]}/tryit_3way >@{[$path]}/3way_CpG_@{[$sub]}.Rout";
system "R --vanilla <model_picker.R --args $sig_th $ratefiledir/CpG_rates_@{[$sub]}_train_cov_vf.txt @{[$path]}/tryit_3way $modelpath/CVsel_4wayCpG @{[$path]}/tryit_4way >@{[$path]}/4way_CpG_@{[$sub]}.Rout";
# generate the generic model file
print OUT "CVsel_0way\n";
print OUT "CVsel_1wayCpG\n";
print OUT "CVsel_1_2wayCpG\n";
print OUT "CVsel_1_2_3wayCpG\n";
print OUT "CVsel_1_2_3_4wayCpG\n";
}
#add final models to run CV stats on
print OUT "tryit_2way\n";
print OUT "tryit_3way\n";
print OUT "tryit_4way\n";
close(OUT);
#run CV stats
system "./auto_CVsummary.pl $CTmode $sub @{[$path]}/modellist_@{[$sub]} $ratefiledir $path";