6 <& /tools/bulk/display/buttons.mas,
7 page_size=>$data->{page_size} || 50,
8 page_number => $data->{page_number},
9 idType => $data->{idType},
10 dumpfile => $data->{dumpfile} &>
14 use File::Slurp qw | read_file |;
15 use CXGN::Page::FormattingHelpers qw | html_break_string |;
16 print STDERR "DATA:".Data::Dumper::Dumper($data);
18 $data->{page_size} || ($data->{page_size} = 50);
20 if ( !( exists($data->{page_number}) || $data->{page_number} ) ) {
21 $data->{page_number} = 1;
23 if ( !( exists($data->{page_size}) || $data->{page_size} )) { $data->{page_size} = 50; }
24 my $file = $data->{tempdir} . "/" . $data->{dumpfile};
28 my @file_lines = read_file($file);
30 print STDERR "Line Count in the file: ".scalar(@file_lines)."\n";
32 if ( @file_lines < 2 ) {
34 "No data was retrieved. Please verify your input parameters. Thanks.<br /><br />\n";
38 # read the column definitions
41 my $defs = shift @file_lines;
42 if ($defs) { chomp($defs); @output_fields = split /\t/, $defs; }
43 print STDERR "column definitions: " . ( join " ", @output_fields )."\n";
48 "/search/est.pl?request_type=10&search=Search&request_id=",
49 SGN_U => "/search/unigene.pl?unigene_id=",
50 converted_id => "/search/unigene.pl?unigene_id=",
52 $data->{links} = \%links;
55 # read in the required page
60 $content .= "<table summary=\"\" border=\"1\">\n";
64 "<tr><td>line</td><td>"
65 . ( join "</td><td>", @output_fields )
68 foreach my $fl (@file_lines) {
69 print STDERR "Processing line $fl...\n";
73 my $show_line = ( $line_count >= ($data->{page_number} - 1 ) * $data->{page_size} + 1 )
74 && ($line_count <= ( $data->{page_number} ) * $data->{page_size} );
77 my @fields = split /\t/, $fl;
79 for ( my $i = 0 ; $i < @fields ; $i++ ) {
80 $row{ $output_fields[$i] } = $fields[$i];
83 # format the sequence data for output to browser.
84 # number of letters in sequence or qual to wrap on
85 my $breakspace_num = 60;
88 html_break_string( $row{est_seq}, $breakspace_num );
91 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{est_seq}</span>";
94 html_break_string( $row{unigene_seq}, $breakspace_num );
96 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{unigene_seq}</span>";
99 html_break_string( $row{protein_seq}, $breakspace_num );
101 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{protein_seq}</span>";
103 html_break_string( $row{estscan_seq}, $breakspace_num );
105 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{estscan_seq}</span>";
106 $row{longest6frame_seq} =
107 html_break_string( $row{longest6frame_seq}, $breakspace_num );
108 $row{longest6frame_seq} =
109 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{longest6frame_seq}</span>";
110 $row{preferred_protein_seq} =
111 html_break_string( $row{preferred_protein_seq},
113 $row{preferred_protein_seq} =
114 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{preferred_protein_seq}</span>";
116 $row{bac_end_sequence} =
117 html_break_string( $row{bac_end_sequence}, $breakspace_num );
118 $row{bac_end_sequence} =
119 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{bac_end_sequence}</span>";
121 my $qual = $row{qual_value_seq};
122 my @qual = split /\s+/, $qual;
123 $row{qual_value_seq} = "";
124 s/^(\d)$/ $1/ foreach (@qual);
125 while ( my @a = splice( @qual, 0, $breakspace_num ) ) {
126 $row{qual_value_seq} .= join( " ", @a ) . "<br />";
128 $row{qual_value_seq} =
129 "<span class=\"sequence\" style=\"font-size: smaller;\"> $row{qual_value_seq}</span>";
134 # cycle through @output_fields and find the corresponding hash elements
136 $content .= "<tr><td>$line_count</td>\n";
137 foreach my $f (@output_fields) {
139 #$data-> debug("outputting $row{$f}...");
140 if ( !exists( $row{$f} ) || $row{$f} eq undef ) {
145 # add links as required. Links for each output field are stored in the %links hash.
147 if ( exists( $links{$f} ) && $row{$f} ne "N.A." ) {
149 "<a href=\"$links{$f}$row{$f}\">$row{$f}</a>";
151 if ( $f eq "clone_id" ) {
152 $content .= "<td>$row{$f}</td>";
155 $content .= "<td>$row{$f}</td>";
158 #push @output, $row{$f};
160 $content .= "</tr>\n";
162 #$content .= "<tr><td>".(join "</td><td>", @output) . "</td></tr>";
165 $content .= "</table><!-- dump info -->\n";
179 <& /tools/bulk/display/buttons.mas,
180 line_count => $data->{line_count},
181 page_size=>$data->{page_size},
182 page_number => $data->{page_number},
183 dumpfile => $data->{dumpfile},
184 idType => $data->{idType}