annotate ClassAnnotate.pl @ 28:e93f33f03019 draft

Uploaded
author big-tiandm
date Thu, 13 Nov 2014 22:45:51 -0500
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: Chen Tingting
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
4 #Email: chentt@big.ac.cn
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
5 #Date: 2014/5/13
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
6 #Modified:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
7 #Description: cluster annotate
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
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
13 my %opts;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
14 GetOptions(\%opts,"i=s","g=s","n=s","r=s","p=s","o=s","t=s","l=s","h");
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
15 if (!(defined $opts{i} and defined $opts{g} and defined $opts{n} and defined $opts{r} and defined $opts{p} and defined $opts{o} and defined $opts{t} and defined $opts{l}) || defined $opts{h}) { #necessary arguments
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
16 &usage;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
17 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
18
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
19 #my %gene;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
20 my %gene1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
21 open IN,"<$opts{g}";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
22 open OUT ,">$opts{l}";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
23 print OUT "#ID\tchr\tstart\tend\tstrand\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
24 my $n=1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
25 while (my $aline=<IN>) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
26 chomp $aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
27 next if($aline=~/^\#/);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
28 my @tmp=split/\t/,$aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
29 my $ID;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
30 if ($tmp[2] eq "gene") {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
31 $tmp[0]=~s/Chr\./Chr/;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
32 #$tmp[0]=~s/Chr/chr/;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
33 my @infor=split/;/,$tmp[8];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
34 for (my $i=0;$i<@infor ;$i++) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
35 if ($infor[$i]=~/Alias\=(\S+)$/) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
36 $ID=$1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
37 last;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
38 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
39 else {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
40 $ID="unknown$n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
41 $n++;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
42 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
43 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
44 #$gene{$tmp[0]}{$ID}=[$tmp[3],$tmp[4],$tmp[6]];#$gene{chr}{geneID}=[start,end,strand]
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
45 push @{$gene1{$ID}},[$tmp[3],$tmp[4],$tmp[0]];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
46 print OUT "$ID\t$tmp[0]\t$tmp[3]\t$tmp[4]\t$tmp[6]\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
47 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
48 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
49 #while (my $aline=<IN>) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
50 # chomp $aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
51 # next if($aline=~/^\#/);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
52 # my @tmp=split/\t/,$aline;#ID chr start end strand
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
53 # push @{$gene1{$tmp[0]}},[$tmp[2],$tmp[3],$tmp[1]];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
54 # #$gene{$tmp[1]}{$tmp[0]}=[$tmp[2],$tmp[3],$tmp[1]];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
55 #}
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
56 close IN;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
57 close OUT;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
58
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
59 my %nat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
60 open TMP,">$opts{t}";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
61 print TMP "#NAT_ID\tGene\tStrand\tChr\tGene_start\tGene_end\tAntiGene\tStrand\tChr\tAntiGene_start\tAntiGene_end\tType1\tType2\tNATS1_start\tNATS1_end\tNATS2_start\tNATS2_end\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
62
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
63 open IN,"<$opts{n}";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
64 my $nat_n=1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
65 while (my $aline=<IN>) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
66 next if($aline=~/^\#/);#osj LOC_Os05g02659 - LOC_Os01g24200 + trans 1559 1802 660 905 246 100nt -
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
67 chomp $aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
68 my @arr=split /\t/,$aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
69 my ($ns,$ne,$ns2,$ne2)=(0,0,0,0);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
70 if ($arr[11]=~/Nearby/) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
71 ($ns,$ne)=&nearby($gene1{$arr[1]}[0][0],$gene1{$arr[1]}[0][1],$gene1{$arr[3]}[0][0],$gene1{$arr[3]}[0][1]);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
72 push @{$nat{$gene1{$arr[1]}[0][2]}},[$ns,$ne,$arr[5],$arr[11],"NATs".$nat_n];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
73 print TMP "NATs$nat_n\t$arr[1]\t$arr[2]\t$gene1{$arr[1]}[0][2]\t$gene1{$arr[1]}[0][0]\t$gene1{$arr[1]}[0][1]\t$arr[3]\t$arr[4]\t$gene1{$arr[3]}[0][2]\t$gene1{$arr[3]}[0][0]\t$gene1{$arr[3]}[0][1]\t$arr[5]\t$arr[11]\t$ns\t$ne\t$ns\t$ne\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
74 $nat_n++;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
75 }else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
76 $ns=$gene1{$arr[1]}[0][0]+$arr[6]-1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
77 $ne=$gene1{$arr[1]}[0][0]+$arr[7]-1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
78 $ns2=$gene1{$arr[3]}[0][1]-$arr[9]+1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
79 $ne2=$gene1{$arr[3]}[0][1]-$arr[8]+1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
80 push @{$nat{$gene1{$arr[1]}[0][2]}},[$ns,$ne,$arr[5],$arr[11],"NATs$nat_n"."_1"];#start,end,class1,class2
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
81 push @{$nat{$gene1{$arr[3]}[0][2]}},[$ns2,$ne2,$arr[5],$arr[11],"NATs$nat_n"."_2"];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
82 print TMP "NATs$nat_n\t$arr[1]\t$arr[2]\t$gene1{$arr[1]}[0][2]\t$gene1{$arr[1]}[0][0]\t$gene1{$arr[1]}[0][1]\t$arr[3]\t$arr[4]\t$gene1{$arr[3]}[0][2]\t$gene1{$arr[3]}[0][0]\t$gene1{$arr[3]}[0][1]\t$arr[5]\t$arr[11]\t$ns\t$ne\t$ns2\t$ne2\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
83 $nat_n++;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
84 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
85 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
86 close IN;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
87 close TMP;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
88
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
89 my %repeat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
90 open IN,"<$opts{'r'}";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
91 my $first=<IN>;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
92 $first=<IN>;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
93 $first=<IN>;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
94 while (my $aline=<IN>) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
95 chomp $aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
96 $aline=~s/^\s+//;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
97 my @tmp=split/\s+/,$aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
98 $tmp[4]=~s/chr0/Chr/;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
99 $tmp[4]=~s/chr/Chr/;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
100 push @{$repeat{$tmp[4]}},[$tmp[5],$tmp[6],$tmp[10]];#start,end,class
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
101 #print "$tmp[4]\t$tmp[5]\t$tmp[6]\t$tmp[10]\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
102 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
103 close IN;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
104
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
105 my %phase;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
106 open IN,"<$opts{'p'}";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
107 while (my $aline=<IN>) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
108 chomp $aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
109 next if($aline=~/^\#/);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
110 my @tmp=split/\t/,$aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
111 if ($tmp[5]>=25) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
112 $phase{$tmp[0]}=$tmp[5];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
113 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
114 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
115 close IN;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
116
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
117 my $filein=$opts{'i'};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
118 my $fileout=$opts{'o'};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
119 open IN,"<$filein"; #input file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
120 open OUT,">$fileout"; #output file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
121 while (my $aline=<IN>) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
122 chomp $aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
123 if($aline=~/^\#/){
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
124 print OUT "$aline\tPhase\tLong\tRepeatClass\tNatClass1\tNatClass2\tNatID\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
125 next;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
126 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
127 my @tmp=split/\t/,$aline;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
128 my @inf=split/\:/,$tmp[0];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
129 my @pos=split/\-/,$inf[1];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
130 my $chr=$inf[0];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
131 $chr=~s/Chr0/Chr/;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
132 my $start=$pos[0];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
133 my $end=$pos[1];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
134 #=========Repeat============
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
135 my @repeat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
136 if (defined(@{$repeat{$chr}})) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
137 my @r_array=sort {$a->[0] <=> $b->[0]} @{$repeat{$chr}};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
138 for (my $i=0;$i<@r_array ;$i++) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
139 if ($start<$r_array[$i][0] && $end>$r_array[$i][0]) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
140 push @repeat,$r_array[$i][2];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
141 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
142 elsif($start>$r_array[$i][0] && $start<$r_array[$i][1]){
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
143 push @repeat,$r_array[$i][2];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
144
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
145 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
146 elsif($end<$r_array[$i][0]){
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
147 last;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
148 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
149 else{next;}
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
150 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
151 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
152 my $repeat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
153 if (@repeat==0) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
154 $repeat="\/";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
155 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
156 else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
157 $repeat=join ";",@repeat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
158 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
159 #=========nat===============
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
160 my @nat1;#class 1
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
161 my @nat2;#class 2
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
162 my @nat;#nat ID
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
163 #foreach my $chr (keys %nat) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
164 my @n_array=sort {$a->[0] <=> $b->[0] } @{$nat{$chr}};
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
165 for (my $i=0;$i<@n_array ;$i++) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
166 if ($start<$n_array[$i][0] && $end>$n_array[$i][0]) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
167 push @nat1,$n_array[$i][2];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
168 push @nat2,$n_array[$i][3];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
169 push @nat,$n_array[$i][4];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
170 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
171 elsif($start>$n_array[$i][0] && $start<$n_array[$i][1]){
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
172 push @nat1,$n_array[$i][2];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
173 push @nat2,$n_array[$i][3];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
174 push @nat,$n_array[$i][4];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
175 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
176 elsif($end<$n_array[$i][0]){
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
177 last;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
178 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
179 else{next;}
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
180 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
181 #}
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
182
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
183 my $nat1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
184 my $nat2;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
185 my $nat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
186 if (@nat1==0) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
187 $nat1="\/";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
188 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
189 else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
190 $nat1=join ";",@nat1;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
191 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
192 if (@nat2==0) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
193 $nat2="\/";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
194 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
195 else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
196 $nat2=join ";",@nat2;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
197 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
198 if (@nat==0) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
199 $nat="\/";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
200 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
201 else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
202 $nat=join ";",@nat;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
203 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
204 #========phase==============
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
205 my $phase="\/";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
206 if (defined($phase{$tmp[0]})) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
207 $phase="phase";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
208 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
209 #=========long===============
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
210 my $long="\/";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
211 if ($tmp[1] eq "\>30nt" and $tmp[2]>=0.5) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
212 $long="long";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
213 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
214 print OUT "$aline\t$phase\t$long\t$repeat\t$nat1\t$nat2\t$nat\n";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
215 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
216
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
217 close IN;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
218 close OUT;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
219
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
220 sub nearby{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
221 my @p=@_;
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
222 my ($s,$e)=(0,0);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
223 if ($p[1]<$p[2]) {
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
224 $s=$p[1];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
225 $e=$p[2];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
226 }else{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
227 $s=$p[3];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
228 $e=$p[0];
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
229 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
230 return ($s,$e);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
231 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
232
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
233 sub usage{
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
234 print <<"USAGE";
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
235 Version $version
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
236 Usage:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
237 $0 -i -o -g -n -r -p -t -l
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
238 options:
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
239 -i input file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
240 -g gff file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
241 -n NATs file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
242 -r repeat file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
243 -p phase file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
244 -o output file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
245 -t nat output file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
246 -l genelist output file
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
247 -h help
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
248 USAGE
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
249 exit(1);
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
250 }
07745c0958dd Uploaded
big-tiandm
parents:
diff changeset
251