annotate carpet-src-1/tools/CARPET/PeakPeaker2.pl @ 1:78770028dcf1 default tip

Migrated tool version 1.0.1 from old tool shed archive to new tool shed repository
author matces
date Tue, 07 Jun 2011 16:59:33 -0400
parents cdd489d98766
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
1 #! /usr/bin/perl
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
2
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
3 # Copyright 2009 Matteo Cesaroni, Lucilla Luzi
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
4 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
5 # This program is free software; ; you can redistribute it and/or modify
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
6 # it under the terms of the GNU Lesser General Public License as published by
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
7 # the Free Software Foundation; either version 3 of the License, or (at your
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
8 # option) any later version.
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
9 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
10 # This program is distributed in the hope that it will be useful,
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
13 # GNU General Public License for more details.
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
14
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
15
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
16 use Getopt::Long;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
17
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
18 GetOptions (
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
19 "help" => \$OPT{help},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
20 "in=s" => \$OPT{fname},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
21 "perc=s" => \$OPT{value},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
22 "fc=s" => \$OPT{fc_value},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
23 "log=s" => \$OPT{valore_log},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
24 "t=s" => \$OPT{type_peak},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
25 "num=s" => \$OPT{num_probe},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
26 "dist=s" => \$OPT{dist_max},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
27 "dist_peaks=s" => \$OPT{dist_max_peaks},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
28 "w=s"=> \$OPT{s_windows},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
29 "col3=s" => \$OPT{col3},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
30 "f_pv=s" => \$OPT{file_pv},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
31 "out=s"=> \$OPT{out}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
32
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
33 )|| printusage();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
34
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
35 # opzioni da linea di comando
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
36 my $value=$OPT{value};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
37 my $fc_value=$OPT{fc_value};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
38 my $valore_log=$OPT{valore_log};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
39 my $type_peak=$OPT{type_peak};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
40 my $num_probe=$OPT{num_probe};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
41 my $dist_max=$OPT{dist_max};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
42 my $dist_max_peaks=$OPT{dist_max_peaks};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
43 my $fname=$OPT{fname};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
44 my $help=$OPT{help};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
45 my $s_windows=$OPT{s_windows};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
46 my $col3=$OPT{col3};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
47 my $outfile=$OPT{out};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
48 my $outfile_pv=$OPT{file_pv},
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
49
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
50 # "usage" se c'e' un help
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
51 $help and printusage();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
52
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
53 # "usage" se non ci sono opzioni
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
54 if (!$s_windows || !$fname || (!$value && !$fc_value) || !$type_peak || !$num_probe || !$dist_max || (($type_peak eq "p") && !$valore_log)){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
55 &printusage()
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
56 };
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
57
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
58
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
59 qx {sort -k 1,1 -k 4,4n $fname >$fname.sortato};
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
60
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
61
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
62 open(FILE, "<$fname.sortato") or die "Cannot find file $fname.sortato\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
63 open(pvalue, ">$outfile_pv") or die "Cannot open file $outfile_pv: $!\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
64 #open(buonitutti, "> buoni_$fname") or die "Cannot find file $fname: $!\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
65 #loop th rought line-by-line until the end of the file and then push each line into an empty array, called @array#
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
66 print pvalue "#p-value track ($value) \n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
67
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
68
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
69 @array= ();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
70 $conto_tutti_sopra=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
71 $conto_tutti=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
72 while ($line = <FILE>){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
73 chomp ($line);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
74 if ($line=~/track/g){next;}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
75 if ($line=~/#/g){next;}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
76 if ($line=~/^\s+$/g){next;}
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
77 push (@array,$line);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
78 @value_perc=split("\t",$line);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
79 push (@percentile,$value_perc[5]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
80 if ($value_perc[5]>=$fc_value){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
81 $conto_tutti_sopra++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
82 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
83 elsif ($value_perc[5]<$fc_value){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
84 $conto_tutti++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
85 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
86 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
87
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
88 close (FILE);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
89
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
90 if (!$fc_value){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
91 @perc_ordine=sort(@percentile);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
92 $position=(($value*($#perc_ordine+1))-1);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
93 $valore_percentile=$perc_ordine[$position];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
94 #print "il percentile è $valore_percentile\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
95 #print "il max è $perc_ordine[$#perc_ordine]\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
96 #print "il min è $perc_ordine[1]\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
97 $probabilita=1-$value;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
98 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
99 else {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
100 $valore_percentile=$fc_value;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
101 $tuttitutti=($conto_tutti+$conto_tutti_sopra);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
102 #print"il numero totaledi probe è $tuttitutti\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
103 #print"il numero totale di probe sopra è $conto_tutti_sopra\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
104 $probabilita=$conto_tutti_sopra/($conto_tutti+$conto_tutti_sopra);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
105 #print "la proba= $probabilita\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
106 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
107
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
108 #print buonitutti"il percentile e $valore_percentile\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
109
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
110
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
111
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
112 ($one_ref,$two_ref)=&probe_cutoff(@array);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
113
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
114 if ($type_peak eq "p"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
115 @forse_niente=&peak(@$one_ref);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
116 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
117 elsif ($type_peak eq "s"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
118 @forse_niente=&peak(@$two_ref);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
119 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
120
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
121 &double_peak(@forse_niente);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
122
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
123 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
124 # End process
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
125 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
126 close OUTFILE;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
127 unlink "$fname.sortato";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
128 exit 0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
129
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
130 ################################################################################################
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
131 ######################## SUBROUTINE ###############################
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
132 ################################################################################################
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
133
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
134 sub probe_cutoff
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
135 {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
136
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
137 $c=-6;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
138
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
139 foreach $linea(@array){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
140 @subarray1 = split("\t",$linea);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
141 $inizio=(((($subarray1[4]-$subarray1[3])/2)+$subarray1[3])-($s_windows/2)); #per modificare la windows cambia il 500 e il 1000
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
142 $fine=$inizio+$s_windows; #windows 500 -->250 e 500 windows 1000 --> 500 e 1000
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
143 $counter=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
144 $counter_value=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
145
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
146 if($subarray1[5]>=$valore_percentile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
147 push (@array_probe,[@subarray1]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
148 print buonitutti "$linea\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
149 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
150
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
151 for($i=$c;$i<=$#array;$i++) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
152 if ($i<0){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
153 next;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
154 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
155 @subarray = split("\t",$array[$i]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
156 if (($subarray[3]>=$inizio)&&($subarray[3]<$fine)&&("$subarray[0]" eq "$subarray1[0]")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
157 $counter++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
158 if ($subarray[5]>= $valore_percentile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
159 $counter_value++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
160 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
161 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
162 if (($subarray[3]>$fine)||("$subarray[0]" ne "$subarray1[0]")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
163 $cazzo=$subarray[3];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
164 last;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
165 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
166
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
167 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
168 $c++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
169 if ($counter !=0){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
170 $chi_sq = (((($counter_value - ($probabilita*$counter))**2)/($probabilita*$counter))+(((($counter-$counter_value)-((1-$probabilita)*$counter))**2)/((1-$probabilita)*$counter)));
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
171 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
172 else{
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
173 $chi_sq = NA;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
174 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
175
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
176 use Statistics::Distributions;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
177 $chisprob=Statistics::Distributions::chisqrprob (1,$chi_sq);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
178 if ($chisprob == 0){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
179 $log_10=100;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
180 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
181 else {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
182 $log_10 = -log($chisprob)/log(10);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
183 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
184
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
185 print pvalue "$subarray1[0]\t$subarray1[1]\tpv_$subarray1[2]\t$subarray1[3]\t$subarray1[4]\t$log_10\t$subarray1[6]\t$subarray1[7]\t$subarray1[5]\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
186
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
187 if ($log_10>=$valore_log){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
188 #print"$subarray1[3],$inizio,$fine,$counter,$counter_value,$chi_sq,$chisprob,$log_10\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
189 @proviamo=($subarray1[0],$subarray1[1],$subarray1[2],$inizio,$fine,$log_10,$subarray1[6],$subarray1[7],$subarray1[5]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
190 push (@matrix_pvalue,[@proviamo]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
191
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
192 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
193 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
194 @result_table=@matrix_pvalue;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
195 @result_table2=@array_probe;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
196 return(\@result_table,\@result_table2);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
197
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
198 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
199
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
200
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
201
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
202
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
203
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
204 ################################################################################################
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
205
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
206
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
207
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
208 sub peak
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
209 {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
210 @matrix_value=@_;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
211
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
212 $stop=$#matrix_value;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
213
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
214 for ($cio=0; $cio<=$stop;$cio++) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
215 @log_ratio=();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
216 @chilosa=();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
217 $inizio=$matrix_value[$cio][3];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
218 $somma=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
219 $media=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
220 $sommachilo=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
221 $mediachilo=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
222 $diviso=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
223 push(@log_ratio,$matrix_value[$cio][5]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
224 if ($matrix_value[$cio][8]>=$valore_percentile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
225 push(@chilosa,$matrix_value[$cio][8]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
226 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
227 for ($j=0; $j<=$stop;$j++){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
228 $distanza=($matrix_value[$cio+1][3]-$matrix_value[$cio][4]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
229 if (($distanza > $dist_max) || ($cio==$stop)||(!("$matrix_value[$cio+1][0]" eq "$matrix_value[$cio][0]"))){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
230 $j=$stop;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
231 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
232 elsif (($distanza <= $dist_max)&&("$matrix_value[$cio+1][0]" eq "$matrix_value[$cio][0]")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
233 $cio++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
234 push(@log_ratio,$matrix_value[$cio][5]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
235 $fine=$matrix_value[$cio][4];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
236 $inizio3=$inizio;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
237 $j++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
238 if ($matrix_value[$cio][8]>=$valore_percentile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
239 push(@chilosa,$matrix_value[$cio][8]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
240 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
241 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
242
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
243
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
244 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
245 $numeroprobes=($#chilosa+1);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
246 if ((($#log_ratio+1)>=$num_probe) && (($type_peak eq "s") ||(($#chilosa+1)>=$num_probe))){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
247 foreach $n (@log_ratio) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
248 $somma+=$n;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
249 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
250 if($type_peak eq "s"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
251 @chilosa=@log_ratio;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
252 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
253 foreach $nchilo (@chilosa) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
254 $sommachilo+=$nchilo;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
255 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
256 $diviso=$#log_ratio+1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
257 $media = $somma/(@log_ratio);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
258 $mediachilo=$sommachilo/(@chilosa);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
259 #$somma_media_chilo=((sqrt($#chilosa+1))+$mediachilo);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
260 #$moltipli=(($#log_ratio+1)*$media);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
261 #$somma_media=((sqrt($#log_ratio+1))+$media);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
262 if ($type_peak eq "p"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
263 $inizio3=int($inizio3+(($s_windows/2)-25));
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
264 $fine=int($fine-(($s_windows/2)-25));
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
265 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
266 @proviamo_double=($matrix_value[$cio][0],$matrix_value[$cio][1],$col3,$inizio3,$fine,$media,$matrix_value[$cio][6],$matrix_value[$cio][7],$mediachilo,$diviso);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
267 push (@matrix_for_double,[@proviamo_double]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
268
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
269 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
270 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
271
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
272 @result_table=@matrix_for_double;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
273 return(@result_table);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
274 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
275
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
276
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
277 ################################################################################################
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
278
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
279
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
280
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
281 sub double_peak
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
282 {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
283 @matrix_value=@_;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
284
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
285 $stop=$#matrix_value;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
286 $i=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
287 $j=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
288 #print $stop;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
289
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
290 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
291 # Print output file
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
292 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
293 if ($outfile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
294 open (OUTFILE, ">$outfile");
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
295 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
296
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
297 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
298 # print File Header
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
299 #
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
300 my $header=<<e0c6654;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
301 \# infile: $fname
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
302 \# percentile value: $value=$valore_percentile
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
303 \# fold change: $fc_value
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
304 \# type of analysis: $type_peak
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
305 \# log(pval analysis): $valore_log
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
306 \# num (probe defining a peak): $num_probe
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
307 \# dist: $dist_max
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
308 \# window length: $s_windows
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
309 track name=$col3 description="peaks find" visibility=2
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
310 e0c6654
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
311
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
312 if ($outfile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
313 print OUTFILE "$header";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
314 }else{
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
315 print "$header";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
316 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
317 if ($type_peak eq "p"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
318 print "perc value=$value=$valore_percentile, #probes=$num_probe (dist=$dist_max), window=$s_windows, type analisys =p-value (log=$valore_log), dist peaks=$dist_max_peaks";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
319 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
320 if ($type_peak eq "s"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
321 print "perc value=$value=$valore_percentile, #probes=$num_probe (dist=$dist_max), window=$s_windows, type analisys=score, dist peaks=$dist_max_peaks";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
322 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
323 for ($i=0; $i<=$stop;$i++) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
324 @log_ratio=();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
325 @log_ratio2=();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
326 @diviso2=();
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
327 $inizio=$matrix_value[$i][3];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
328 $somma=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
329 $somma2=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
330 $media=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
331 $media2=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
332 $diviso2=0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
333 push(@log_ratio,$matrix_value[$i][5]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
334 push(@log_ratio2,$matrix_value[$i][8]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
335 push(@diviso2,$matrix_value[$i][9]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
336 #print "giro $i\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
337 for ($j=0; $j<=$stop;$j++){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
338 # if ("$matrix_value[$i+1][0]" eq "$matrix_value[$i][0]"){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
339 $distanza=($matrix_value[$i+1][3]-$matrix_value[$i][4]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
340 #print "distanza fra i due $distanza\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
341 #exit;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
342 if (($distanza > $dist_max_peaks) || ($i==$stop)||(!("$matrix_value[$i+1][0]" eq "$matrix_value[$i][0]"))){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
343 $j=$stop;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
344 $fine=$matrix_value[$i][4];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
345 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
346 elsif (($distanza <= $dist_max_peaks)&&("$matrix_value[$i+1][0]" eq "$matrix_value[$i][0]")){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
347 $i++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
348 push(@log_ratio,$matrix_value[$i][5]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
349 push(@log_ratio2,$matrix_value[$i][8]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
350 push(@diviso2,$matrix_value[$i][9]);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
351 $fine=$matrix_value[$i][4];
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
352 $j++;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
353 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
354
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
355 # }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
356 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
357 foreach $n (@log_ratio) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
358 $somma+=$n;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
359 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
360 foreach $n1 (@log_ratio2) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
361 $somma2+=$n1;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
362 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
363 foreach $n2 (@diviso2) {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
364 $diviso2+=$n2;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
365 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
366 $media = $somma/(@log_ratio);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
367 $media2 = $somma2/(@log_ratio2);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
368 $somma_media=(sqrt($diviso2)+$media);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
369 $somma_score=(sqrt($diviso2)+$media2);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
370 $somma_media = sprintf "%.2f", $somma_media;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
371 $somma_score = sprintf "%.2f", $somma_score;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
372 #$somma_score = $somma_score.$i
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
373 #$somma_media_chilo=((sqrt($#chilosa+1))+$mediachilo);
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
374 if ($outfile){
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
375 print OUTFILE "$matrix_value[$i][0]\t$matrix_value[$i][1]\t$matrix_value[$i][2]\t$inizio\t$fine\t$somma_media\t$matrix_value[$i][6]\t$matrix_value[$i][7]\t$somma_score$i\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
376 }else{
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
377 print "$matrix_value[$i][0]\t$matrix_value[$i][1]\t$matrix_value[$i][2]\t$inizio\t$fine\t$somma_media\t$matrix_value[$i][6]\t$matrix_value[$i][7]\t$somma_score$i\n";
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
378 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
379
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
380
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
381 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
382 }
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
383
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
384 ####################################################################################################################################
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
385
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
386 sub printusage {
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
387
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
388 print<<eoc22334;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
389
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
390
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
391
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
392 ***************************************************
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
393 :: N i m b l e G e n C h i p A n a l y s i s ::
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
394 ***************************************************
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
395
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
396
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
397 USAGE SUMMARY
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
398 ---------------------------------------------------------------------------------
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
399 This program utilizes NimbleGen ratio files in gff format as INPUT FILE and
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
400 provides a table of the computed picks in the same gff file format.
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
401
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
402
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
403
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
404 --in [input filename]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
405 --perc [percentile value, it is used to calculate the threshold rate based
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
406 on dataset distribution to filter out background ratio; i.e. 0.99]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
407 OR
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
408 --fc [fold change value, it is used as fixed threshold to filter out
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
409 background ratio, i.e. 2]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
410 --t [type of analysis; p, performs peaks determination based on p-value inference;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
411 s, performs peaks determination based on a scoring system]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
412 --log (required only for p-value based analysis)
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
413 [log2(p-value), cutoff integer to be used to identify a significant peak; i.e. 5]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
414 --num [minimal number of consecutive probes used to define a peak; i.e. 3]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
415 --dist [greatest nucleotide distance between two probes or between two peaks that
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
416 allow to consider the signals as belonging to the same peak]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
417 --w [window length]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
418
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
419 --out [output filename (optional)]
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
420 -----------------------------------------------------------------------------------------
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
421 EXAMPLES:
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
422
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
423 perl program.pl --in 75340_ratio.gff --perc 0.98 --t s --num 3 --dist 250 --w 500
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
424 OR
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
425 perl program.pl --in 75340_ratio.gff --perc 0.98 --t p --log 5 --num 3 --dist 250 --w 500
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
426
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
427 -----------------------------------------------------------------------------------------
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
428
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
429 eoc22334
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
430 exit 0;
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
431
cdd489d98766 Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
matces
parents:
diff changeset
432 }