annotate phased_siRNA.pl @ 15:0e4b6b0c6e9d draft

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