annotate phased_siRNA.pl @ 51:3202911efdae draft

Uploaded
author big-tiandm
date Fri, 05 Dec 2014 01:14:28 -0500
parents 7b5a48b972e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
1 #!/usr/bin/perl -w
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
2 #Filename:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
3 #Author: Tian Dongmei
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
4 #Email: tiandm@big.ac.cn
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
5 #Date: 2013/7/19
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
6 #Modified:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
7 #Description:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
8 my $version=1.00;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
9
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
10 use strict;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
11 use Getopt::Long;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
12 #use Math::Cephes qw(:hypergeometrics);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
13
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
14 my %opts;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
15 GetOptions(\%opts,"i=s","o=s","h");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
16 if (!(defined $opts{i} and defined $opts{o} ) || defined $opts{h}) { #necessary arguments
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
17 &usage;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
18 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
19
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
20 my $filein=$opts{'i'};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
21 my $fileout=$opts{'o'};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
22
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
23 open IN,"<$filein"; #input file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
24 open OUT,">$fileout"; #output file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
25
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
26 while (my $aline=<IN>) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
27 chomp $aline;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
28 if ($aline=~/^\#/) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
29 print OUT $aline,"\tp-value\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
30 next;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
31 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
32 my @tmp=split/\t/,$aline;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
33 my @pos=split/:|-/,$tmp[0];
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
34 $tmp[1]=~s/nt//;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
35 my $pv=&phase($tmp[1],$pos[1],$pos[2],$tmp[4]);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
36
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
37 print OUT $aline,"\t",$pv,"\n";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
38 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
39 close IN;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
40 close OUT;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
41
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
42 sub phase{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
43 my ($tagL,$start,$end,$tags)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
44 my @tmp=split/\;/,$tags;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
45 my %tag;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
46 for (my $i=0;$i<@tmp;$i++) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
47 my @aa=split/\,/,$tmp[$i];
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
48 next if($aa[1]-$aa[0]+1 != $tagL);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
49 # $tag{$aa[0].",".$aa[2]}+=$aa[3] if($aa[2] eq "+");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
50 # $tag{($aa[1]).",".$aa[2]}+=$aa[3] if($aa[2] eq "-");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
51 $tag{$aa[0]}+=$aa[3] if($aa[2] eq "+");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
52 $tag{($aa[1]+3)}+=$aa[3] if($aa[2] eq "-");
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
53 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
54
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
55 my $pv=&pvalue2(\%tag,$tagL,$start,$end);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
56
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
57 return $pv;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
58 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
59
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
60 sub pvalue2{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
61 my ($tag,$tagL,$start,$end)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
62
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
63 my $p=1; my $pp=1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
64 foreach my $ccs(keys %{$tag}){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
65 my $n=0;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
66 my $k=0;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
67 my $K=0;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
68 my $N=0;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
69
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
70 my $cor= $ccs;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
71 my $ss=$cor;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
72 my $ee=($cor+$tagL*10-1)<$end ? $cor+$tagL*10-1 : $end;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
73
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
74 my $max=0;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
75 for (my $i=$ss; $i<=$ee; $i++) # calculate n on the sense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
76 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
77 my $x=$i;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
78 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
79 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
80 if ($max<$$tag{$x}) {$max=$$tag{$x};}
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
81 $n +=$$tag{$x};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
82 $N++;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
83 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
84 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
85 for (my $i=$ss; $i<=$ee; $i=$i+$tagL) # calculate k on the sense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
86 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
87 my $x=$i;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
88 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
89 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
90 $k +=$$tag{$x};
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
91 $K++;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
92 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
93 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
94
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
95
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
96 return $p if($K<3);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
97 return $p if($max/$n>0.8);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
98
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
99 my $pn=0;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
100 next if($n==$k);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
101 $pn=10*$k/($n-$k)+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
102 $pn = $pn ** ($K-2);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
103 $pn = log($pn);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
104 if ($p<$pn) {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
105 $p=$pn;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
106 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
107
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
108 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
109
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
110 return $p;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
111
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
112 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
113
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
114 sub pvalue{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
115 my ($tag,$tagL,$start,$end)=@_;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
116
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
117 my $p=1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
118 foreach my $ccs(keys %{$tag}){
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
119 my $n=-1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
120 my $k=-1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
121
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
122 my ($cor, $str)=split(/,/, $ccs);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
123 if ($str eq "+") # small RNAs on the Watson strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
124 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
125 my $ss=$cor;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
126 my $ee=($cor+$tagL*11-1)<$end ? $cor+$tagL*11-1 : $end;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
127 for (my $i=$ss; $i<=$ee; $i++) # calculate n on the sense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
128 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
129 my $x=$i.","."+";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
130 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
131 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
132 $n=$n+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
133 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
134 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
135 for (my $i=$ss; $i<=$ee; $i=$i+$tagL) # calculate k on the sense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
136 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
137 my $x=$i.","."+";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
138 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
139 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
140 $k=$k+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
141 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
142 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
143
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
144 for (my $j=$ss-2; $j<=$ee-2; $j++) # calculate n on the antisense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
145 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
146 my $x=$j.","."-";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
147 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
148 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
149 $n=$n+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
150 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
151 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
152
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
153 for (my $j=$ss+$tagL-2; $j<=$ee-2; $j=$j+$tagL) # calculate k on the antisense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
154 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
155 my $x=$j.","."-";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
156 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
157 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
158 $k=$k+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
159 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
160 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
161 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
162
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
163 elsif ($str eq "-") # small RNAs on the Crick strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
164 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
165 my $ee=$cor;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
166 my $ss=$cor-$tagL*11+1> $start ? $cor-$tagL*11+1 : $start;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
167 for (my $i=$ss; $i<=$ee; $i++) # calculate n on the sense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
168 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
169 my $x=$i.","."-";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
170 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
171 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
172 $n=$n+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
173 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
174 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
175 for (my $i=$ss+$tagL-1; $i<=$ee; $i=$i+$tagL) # calculate k on the sense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
176 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
177 my $x=$i.","."-";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
178 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
179 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
180 $k=$k+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
181 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
182 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
183
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
184 for (my $j=$ss+2; $j<=$ee+2; $j++) # calculate n on the antisense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
185 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
186 my $x=$j.","."+";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
187 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
188 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
189 $n=$n+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
190 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
191 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
192 for (my $j=$ss+2; $j<=$ee+2; $j=$j+$tagL) # calculate k on the antisense strand
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
193 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
194 my $x=$j.","."+";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
195 if (defined $$tag{$x})
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
196 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
197 $k=$k+1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
198 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
199 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
200 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
201
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
202 next if($k<3);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
203
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
204 my $pn=0; my $N=$tagL*11*2-1; my $M=21;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
205 for (my $w=$k; $w<=$M; $w++) # calculate p-value from n and k
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
206 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
207 my $c=1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
208 my $rr=1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
209 my $rw=1;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
210
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
211 for (my $j=0; $j<=$w-1; $j++)
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
212 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
213 $c=$c*($M-$j)/($j+1);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
214 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
215 for (my $x=0; $x<=$n-$w-1; $x++)
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
216 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
217 $rr=$rr*($N-$M-$x)/($x+1);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
218 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
219 for (my $y=0; $y<=$n-1; $y++)
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
220 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
221 $rw=$rw*($y+1)/($N-$y);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
222 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
223 my $pr=$c*$rr*$rw;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
224
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
225 $pn=$pn+$pr;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
226 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
227
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
228 $p=$pn<$p ? $pn :$p;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
229
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
230 if ($p<0.001) #select and output small RNA clusters with p<0.001
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
231
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
232 {
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
233
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
234 return $p;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
235
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
236 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
237
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
238 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
239 return $p;
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
240 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
241
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
242 sub usage{
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
243 print <<"USAGE";
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
244 Version $version
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
245 Usage:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
246 $0 -i -o
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
247 options:
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
248 -i input file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
249 -o output file
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
250 -h help
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
251 USAGE
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
252 exit(1);
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
253 }
7b5a48b972e9 Uploaded
big-tiandm
parents:
diff changeset
254