5 #use Time::HiRes qw ( gettimeofday tv_interval );
6 #use Term::ANSIColor qw(:constants);
8 #use HTTP::Request::Common qw(POST);
9 use HTML
::TreeBuilder
::XPath
;
10 #use LWP::Simple qw ( get );
13 use HTML
::TableExtract
;
16 my @ArrayList = qw
{RXP_1006 RXP_1009 RXP_1010 RXP_1008 RXP_1007 RXP_1012
};
17 my $Order = '0 hr (Cy3)|0 hr (Cy5)|1 hr (Cy3)|1 hr (Cy5)|3 hr (Cy3)|3 hr (Cy5)|6 hr (Cy3)|6 hr (Cy5)|12 hr (Cy3)|12 hr (Cy5)';
19 open I
,'<','resLOC.anno' or die $!;
20 open O
,'>','resLOC.cydat' or die $!;
21 print O
join("\t",'# FeatureNum',@ArrayList),"\n## $Order\n";
25 my ($tigLOC,undef,$FeatureNums) = split /\t/;
26 #next unless defined $FeatureNums;
27 my @FeatureNums = split /\|/,$FeatureNums;
28 next unless @FeatureNums > 0;
29 #print "$tigLOC,@FeatureNums\n";
30 ++$Acc2Loc{$_}{$tigLOC} for @FeatureNums;
33 my @AccNums = sort {$a <=> $b} keys %Acc2Loc;
36 print join(',',@ArrayList),"\n";
38 my $ua = LWP
::UserAgent
->new;
39 $ua->agent("Mozilla/5.0");
41 for my $FeatureNum (@AccNums) {
43 #my $FeatureNum = 4865;
44 #my $Exp = 'RXP_1006';
46 for my $Exp (@ArrayList) {
49 my $req = HTTP
::Request
->new(GET
=> "http://ricexpro.dna.affrc.go.jp/$Exp/view-plot-data.php?featurenum=$FeatureNum");
50 my $res = $ua->request($req);
52 if (! $res->is_success) {
53 warn "Error: Login as Guest failed !\n";
58 my $tmp_html = $res->content;
60 $tmp_html = (grep /\<table\>\<tr\>\<th\>\<\/th\
>\
<th\
>0 hr \
(Cy3\
)\
<\
/th\>/,(split /\n/,$tmp_html))[0];
61 #print $tmp_html,"\n";
63 <table><tr><th></th><th>0 hr (Cy3)</th><th>0 hr (Cy5)</th><th>1 hr (Cy3)</th><th>1 hr (Cy5)</th><th>3 hr (Cy3)</th><th>3 hr (Cy5)</th><th>6 hr (Cy3)</th><th>6 hr (Cy5)</th><th>12 hr (Cy3)</th><th>12 hr (Cy5)</th></tr><tr><tr><th>rep1</th><td>1489.2</td><td>1468.1</td><td>2461.9</td><td>2467.7</td><td>2531.5</td><td>2546.4</td><td>3237.8</td><td>4325</td><td>2353</td><td>2589.5</td><tr><th>rep2</th><td>1584.1</td><td>1701.6</td><td>1875.8</td><td>2041.3</td><td>2742.3</td><td>2961.4</td><td>3275</td><td>3770</td><td>3569</td><td>4014</td><tr><th>mean</th><td>1536.6</td><td>1584.9</td><td>2168.9</td><td>2254.5</td><td>2636.9</td><td>2753.9</td><td>3256.4</td><td>4047.5</td><td>2961</td><td>3301.7</td><tr><th>median</th><td>1536.6</td><td>1584.9</td><td>2168.9</td><td>2254.5</td><td>2636.9</td><td>2753.9</td><td>3256.4</td><td>4047.5</td><td>2961</td><td>3301.7</td></tr></table>
65 my $te = HTML
::TableExtract
->new(); #headers => [( undef, '0 hr (Cy3)', '0 hr (Cy5)', '1 hr (Cy3)', '1 hr (Cy5)', '3 hr (Cy3)', '3 hr (Cy5)', '6 hr (Cy3)', '6 hr (Cy5)', '12 hr (Cy3)', '12 hr (Cy5)' )] );
66 $te->parse("$tmp_html");
67 my $ts = $te->first_table_found();
70 warn "\n[!Table]$tmp_html\n";
73 # "|0 hr (Cy3)|0 hr (Cy5)|1 hr (Cy3)|1 hr (Cy5)|3 hr (Cy3)|3 hr (Cy5)|6 hr (Cy3)|6 hr (Cy5)|12 hr (Cy3)|12 hr (Cy5)",
74 # "rep1|1489.2|1468.1|2461.9|2467.7|2531.5|2546.4|3237.8|4325|2353|2589.5",
75 # "rep2|1584.1|1701.6|1875.8|2041.3|2742.3|2961.4|3275|3770|3569|4014",
76 # "mean|1536.6|1584.9|2168.9|2254.5|2636.9|2753.9|3256.4|4047.5|2961|3301.7",
77 # "median|1536.6|1584.9|2168.9|2254.5|2636.9|2753.9|3256.4|4047.5|2961|3301.7",
78 foreach my $row ($ts->rows) {
80 my $title = shift @rowdat;
81 unless (defined $title) {
82 my $tmp = join("|",@rowdat);
83 die if $tmp ne $Order;
86 push @dat,join("|",$title,@rowdat) if $title =~ /^(rep\d+|mean)$/;
88 $ArrayDat{$Exp}=\
@dat;
92 print $FeatureNum," ---\n";
95 for my $Exp (@ArrayList) {
96 $tmp .= "\t" . join(',',@
{$ArrayDat{$Exp}} );
98 $tmp = $FeatureNum . $tmp;