annotate ClassAnnotate.pl @ 0:87fe81de0931 draft default tip

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