annotate ClassAnnotate.pl @ 53:f5a2e8308836 draft default tip

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