/usr/share/perl5/Bio/PrimerDesigner/Tables.pm is in libbio-primerdesigner-perl 0.07-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | package Bio::PrimerDesigner::Tables;
# $Id: Tables.pm 9 2008-11-06 22:48:20Z kyclark $
=pod
=head1 NAME
Bio::PrimerDesigner::Table -- Draw HTML tables for PCR primer display
=head1 DESCRIPTION
Draws simple HTML tables to display Bio::PrimerDesigner PCR primer
design and e-PCR results for web applications.
=head1 METHODS
=cut
use strict;
use warnings;
use Readonly;
Readonly our
$VERSION => sprintf "%s", q$Revision: 24 $ =~ /(\d+)/;
use base 'Class::Base';
# -------------------------------------------------------------------
sub info_table {
=head2 info_table
Prints a two-column table for generic, key-value style annotations.
Expects to be passed the name of the gene/feature/etc. and a hash of
attributes. If there is an 'image' key, the value is assumed to be an
image URL, which is printed in a double-wide cell at the bottom of the
table.
my $gene = 'Abc-1';
my %gene_info = (
Chromosome => I,
Start => 100450,
Stop => 102893,
Strand => '+'
);
my $page = Bio::PrimerDesigner::Tables->new;
$page->info_table( $gene, %gene_info );
=cut
my $self = shift;
my $name = shift or return $self->error('No name argument');
my %info = @_ or return $self->error('No attributes');
my $image = $info{'image'} || '';
delete $info{'image'} if $image;
my $table .= <<" END";
<table width=710 border=0 cellpadding=5>
<tr>
<th colspan=2 bgcolor=blue align="center">
<font size=+2 color=white>$name Information</font>
</th>
</tr>
END
for my $key (sort keys %info) {
next if $key eq 'other';
my $ukey = ucfirst $key;
$table .= <<" END";
<tr valign=top>
<td width=20%>
<b>$ukey</b>
</td>
<td>
$info{$key}
</td>
</tr>
END
}
my $other = $info{'other'};
$table .= <<" END" if $other;
<tr valign=top>
<td width=20%>
<b>Other</b>
</td>
<td>
$other
</td>
</tr>
END
$table .= $image ? "<tr><td colspan=2>$image</td></tr><table>"
: "</table>";
}
# -------------------------------------------------------------------
sub PCR_header {
=head2 PCR_header
Returns a generic header for the PCR primer table. Does not expect
any argumments.
=cut
my $self = shift;
return "
<table align=center width=710>
<tr>
<th bgcolor='#3333FF' align=center>
<font color=white size=5>PCR Primers</font>
</th>
</tr>
</table>
"
}
# -------------------------------------------------------------------
sub PCR_set {
=head2 PCR_set
Returns the top row for the PCR primer table. Expects the primer set
number as its only argument.
=cut
my $self = shift;
my $num = shift || '';
return "
<table BORDER=0 WIDTH=710>
<tr BGCOLOR='#3399FF'>
<th bgcolor='#000066' align=center>
<font color=white><b>Set $num</b></font>
</th>
<th>Primer</th>
<th>Sequence</th>
<th>Tm</th>
<th ALIGN=CENTER>Coordinate</th>
<th ALIGN=CENTER>Primer Pair Quality</th>
</tr>
";
}
# -------------------------------------------------------------------
sub PCR_row {
=head2 PCR_row
Returns table rows with PCR primer info. Should be called once for
each primer pair. Expects to be passed a hash containing the
Bio::PrimerDesigner::Result object and the primer set number and an
(optional) label.
my $pcr_row = PCR_row(
primers => $result_obj,
setnum => $set_number,
label => $label
);
=cut
my $self = shift;
my %primers = @_ or return $self->error('No arguments for PCR_row method');
my $set = $primers{'setnum'} || 1;
my $label = $primers{'label'} || 1;
my %args = %{$primers{'primers'}{$set}};
return "
<tr>
<td>$label</td>
<td>Forward</td>
<td>$args{'left'}</td>
<td>$args{'tmleft'}</td>
<td ALIGN=CENTER>$args{'startleft'}</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>Reverse</td>
<td>$args{'right'}</td>
<td>$args{'tmright'}</td>
<td ALIGN=CENTER>$args{'startright'}</td>
<td ALIGN=CENTER>$args{'qual'}</td>
</tr>
";
}
# -------------------------------------------------------------------
sub ePCR_row {
=head2 ePCR_row
Returns table rows summarizing e-PCR results. Expects to be passed an
Bio::PrimerDesigner::Result e-PCR results object and an optional e-PCR label.
=cut
my $self = shift;
my $args = shift or return $self->error('No arguments for ePCR_row method');
my %epcr = %$args;
my $label = shift;
my $num_prods = $epcr{1}{'products'};
my $s = $num_prods > 1 ? 's' : '';
$num_prods ||= 'No';
my $sizes = '';
for (1..$num_prods) {
if ($_ == 1) {
$sizes = "Size$s $epcr{$_}{'size'}"
}
elsif ($_ < $num_prods) {
$sizes .= ", " . $epcr{$_}{'size'}
}
else {
$sizes .= "and " . $epcr{$_}{'size'}
}
}
$sizes .= " bp" if $num_prods ne 'No';
my $row = "
<tr BGCOLOR='#99FFFF'>
<th colspan=6 align=left>
<b>$label e-PCR Results:</b>
$num_prods product${s}
$sizes
</th>
</tr>
<tr><td> </td></tr>
";
$row;
}
# -------------------------------------------------------------------
sub render {
=head2 render
Renders the image URL. Expects to be passed a hash of the map start
and stop, and other features to be mapped (i.e.
gene,forward_primer,reverse_primer, label,start and stop of each
feature, and gene strand).
my $image = $page->render(
start => $startleft,
stop => $startright,
feat => $features
);
=cut
my $self = shift;
my %draw = @_ or return $self->error('No name argument');
my $start = $draw{'start'} || 0;
my $stop = $draw{'stop'} || 0;
my $feat = $draw{'feat'} || '';
(my $config = <<"END") =~ s/^\s+//gm;
[general]
bases = $start-$stop
height = 12
[gene]
glyph = transcript2
bgcolor = cyan
label = 1
description = 1
height = 7
[forward_primer]
glyph = triangle
bgcolor = blue
orient = E
height = 7
label = 1
[reverse_primer]
glyph = triangle
bgcolor = green
orient = W
height = 7
label = 1
$feat
END
$config =~ s/\n/@@/gm;
$config =~ s/\s+/%20/g;
$config = "<br><img src=\"http://elegans.bcgsc.bc.ca/".
"perl/render?width=700;text=\'$config\'\">";
return $config;
}
# -------------------------------------------------------------------
sub PCR_map {
=head2 PCR_map
Returns a 6 column wide table cell with the <IMG ...> info.
Will display the image of mapped primers in the browser when
passed the image URL.
=cut
my $self = shift;
my $image_url = shift || '';
return "
<tr>
<td colspan=6>
$image_url
</td>
</tr>
<tr>
<td colspan=6> </td>
</tr>
";
}
1;
# -------------------------------------------------------------------
=pod
=head1 AUTHOR
Copyright (C) 2003-2009 Sheldon McKay E<lt>mckays@cshl.eduE<gt>.
=head1 LICENSE
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 or any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
=head1 SEE ALSO
Bio::PrimerDesigner::primer3, Bio::PrimerDesigner::epcr.
=cut
|