~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to Bio/SearchIO/Writer/HTMLResultWriter.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# $Id: HTMLResultWriter.pm,v 1.32 2003/11/25 17:52:36 jason Exp $
 
1
# $Id: HTMLResultWriter.pm,v 1.38.4.1 2006/10/02 23:10:27 sendu Exp $
2
2
#
3
3
# BioPerl module for Bio::SearchIO::Writer::HTMLResultWriter
4
4
#
9
9
# You may distribute this module under the same terms as perl itself
10
10
 
11
11
# Changes 2003-07-31 (jason)
12
 
# Gary has cleaned up the code a lot to produce better looking
13
 
# HTML
 
12
# Gary has cleaned up the code a lot to produce better looking HTML
 
13
 
14
14
# POD documentation - main docs before the code
15
15
 
16
16
=head1 NAME
17
17
 
18
 
Bio::SearchIO::Writer::HTMLResultWriter - Object to implement writing a Bio::Search::ResultI in HTML.
 
18
Bio::SearchIO::Writer::HTMLResultWriter - write a Bio::Search::ResultI in HTML
19
19
 
20
20
=head1 SYNOPSIS
21
21
 
52
52
=head1 DESCRIPTION
53
53
 
54
54
This object implements the SearchWriterI interface which will produce
55
 
a set of HTML for a specific Bio::Search::Report::ReportI interface.
 
55
a set of HTML for a specific L<Bio::Search::Report::ReportI interface>.
56
56
 
57
57
See L<Bio::SearchIO::SearchWriterI> for more info on the filter method.
58
58
 
64
64
Bioperl modules. Send your comments and suggestions preferably to
65
65
the Bioperl mailing list.  Your participation is much appreciated.
66
66
 
67
 
  bioperl-l@bioperl.org              - General discussion
68
 
  http://bioperl.org/MailList.shtml  - About the mailing lists
 
67
  bioperl-l@bioperl.org                  - General discussion
 
68
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
69
69
 
70
70
=head2 Reporting Bugs
71
71
 
72
72
Report bugs to the Bioperl bug tracking system to help us keep track
73
 
of the bugs and their resolution. Bug reports can be submitted via
74
 
email or the web:
 
73
of the bugs and their resolution. Bug reports can be submitted via the
 
74
web:
75
75
 
76
 
  bioperl-bugs@bioperl.org
77
 
  http://bugzilla.bioperl.org/
 
76
  http://bugzilla.open-bio.org/
78
77
 
79
78
=head1 AUTHOR - Jason Stajich
80
79
 
92
91
=cut
93
92
 
94
93
 
95
 
 
96
94
package Bio::SearchIO::Writer::HTMLResultWriter;
97
 
use vars qw(@ISA %RemoteURLDefault
 
95
use strict;
 
96
use vars qw(%RemoteURLDefault
98
97
            $MaxDescLen $DATE $AlignmentLineWidth $Revision);
99
 
use strict;
100
 
$Revision = '$Id: HTMLResultWriter.pm,v 1.32 2003/11/25 17:52:36 jason Exp $'; #'
101
98
 
102
99
# Object preamble - inherits from Bio::Root::RootI
103
100
 
104
101
BEGIN {
 
102
    $Revision = '$Id: HTMLResultWriter.pm,v 1.38.4.1 2006/10/02 23:10:27 sendu Exp $';
105
103
    $DATE = localtime(time);
106
 
    %RemoteURLDefault = ( 'PROTEIN' => 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=protein&cmd=search&term=%s',                     
107
 
                          'NUCLEOTIDE' => 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=nucleotide&cmd=search&term=%s'
108
 
                          );
109
 
 
 
104
    %RemoteURLDefault = ( 
 
105
      'PROTEIN' => 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=protein&cmd=search&term=%s',                         
 
106
      'NUCLEOTIDE' => 'http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=nucleotide&cmd=search&term=%s'
 
107
    );
110
108
    $MaxDescLen = 60;
111
109
    $AlignmentLineWidth = 60;
112
110
}
113
111
 
114
 
use Bio::Root::Root;
115
 
use Bio::SearchIO::SearchWriterI;
116
112
 
117
 
@ISA = qw(Bio::Root::Root Bio::SearchIO::SearchWriterI);
 
113
use base qw(Bio::Root::Root Bio::SearchIO::SearchWriterI);
118
114
 
119
115
=head2 new
120
116
 
130
126
           -no_wublastlinks => boolean. Do not display WU-BLAST lines 
131
127
                               even if they are parsed out.
132
128
                               Links = (1) 
 
129
 
133
130
=cut
134
131
 
135
132
sub new {
225
222
             $alg =~ /(WABA|EXONERATE)/i ) {
226
223
        $qtype      = $dbtype = '';
227
224
        $type = $dbseqtype  = 'NUCLEOTIDE';
228
 
    } elsif( $alg =~ /(FAST|BLAST)P/  || $alg =~ /SSEARCH/i ) {
 
225
    } elsif( $alg =~ /(FAST|BLAST)P/  || 
 
226
             $alg =~ /SSEARCH|HMM(PFAM|SEARCH)/i ) {
229
227
        $qtype      = $dbtype = '';
230
228
        $type = $dbseqtype  = 'PROTEIN';
231
229
    } elsif( $alg =~ /(FAST|BLAST)[XY]/i ) {
233
231
        $dbtype     = 'PROTEIN';
234
232
        $dbseqtype  = $type      = 'PROTEIN';
235
233
    } else { 
236
 
        print STDERR "algorithm was ", $result->algorithm, " couldn't match\n";
 
234
        $self->warn("algorithm was ", $result->algorithm, " couldn't match\n");
237
235
    }
238
236
    
239
237
    
309
307
            foreach my $hsp (@hsps ) {
310
308
                next if( $hspfilter && ! &{$hspfilter}($hsp) );
311
309
                $hspstr .= sprintf(" Score = %s bits (%s), Expect = %s",
312
 
                                   $hsp->bits, $hsp->score, $hsp->evalue);
 
310
                                   $hsp->bits || $hsp->score, 
 
311
                                   $hsp->score || $hsp->bits, 
 
312
                                   $hsp->evalue || '');
313
313
                if( defined $hsp->pvalue ) {
314
314
                    $hspstr .= ", P = ".$hsp->pvalue;
315
315
                }
463
463
    }
464
464
    $str .= "</table><p><h2>Search Statistics</h2><table border=1><tr><th>Statistic</th><th>Value</th></tr>\n";
465
465
    foreach my $stat ( sort $result->available_statistics ) {
466
 
        $str .= "<tr><td>$stat</td><td>". $result->get_statistic($stat). "</td></th>\n";
 
466
        $str .= "<tr><td>$stat</td><td>". $result->get_statistic($stat). "</td></tr>\n";
467
467
    }
468
468
    $str .=  "</table><P>".$self->footer() . "<P>\n";
469
469
    return $str;