BioPerl

 view release on metacpan or  search on metacpan

Bio/SearchIO/Writer/HTMLResultWriter.pm  view on Meta::CPAN

    { $gi = $1; $acc = $1;}
    
    if( $string =~ /(\w+)\|([A-Z\d\.\_]+)(\|[A-Z\d\_]+)?/ ) {
	$acc = defined $2 ? $2 : $1;
    } else {
        $acc = $string;
	$acc =~ s/^\s+(\S+)/$1/;
	$acc =~ s/(\S+)\s+$/$1/;	
    } 
    return ($gi,$acc);
}
	
sub MIN { $a <=> $b ? $a : $b; }
sub MAX { $a <=> $b ? $b : $a; }

sub footer { 
    my ($self) = @_;
    return "<hr><h5>Produced by Bioperl module ".ref($self)." on $DATE<br>Revision: $Revision</h5>\n"
    
}

=head2 algorithm_reference

 Title   : algorithm_reference
 Usage   : my $reference = $writer->algorithm_reference($result);
 Function: Returns the appropriate Bibliographic reference for the 
           algorithm format being produced
 Returns : String
 Args    : L<Bio::Search::Result::ResultI> to reference


=cut

sub algorithm_reference {
   my ($self,$result) = @_;
   return '' if( ! defined $result || !ref($result) ||
		 ! $result->isa('Bio::Search::Result::ResultI')) ;   
   if( $result->algorithm =~ /BLAST/i ) {
       my $res = $result->algorithm . ' ' . $result->algorithm_version . "<p>";
       if( $result->algorithm_version =~ /WashU/i ) {
	   return $res .
"Copyright (C) 1996-2000 Washington University, Saint Louis, Missouri USA.<br>
All Rights Reserved.<p>
<b>Reference:</b>  Gish, W. (1996-2000) <a href=\"http://blast.wustl.edu\">http://blast.wustl.edu</a><p>";	   
       } else {
	   return $res . 
"<b>Reference:</b> Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer,<br>
Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997),<br>
\"Gapped BLAST and PSI-BLAST: a new generation of protein database search<br>
programs\",  Nucleic Acids Res. 25:3389-3402.<p>";

       }       
   } elsif( $result->algorithm =~ /FAST/i ) {
       return $result->algorithm . " " . $result->algorithm_version . "<br>" .
	   "\n<b>Reference:</b> Pearson et al, Genomics (1997) 46:24-36<p>";
   } else { 
       return '';
   }
}

# from Perl Cookbook 2.17
sub _numwithcommas {
    my $num = reverse( $_[0] );
    $num =~ s/(\d{3})(?=\d)(?!\d*\.)/$1,/g;
    return scalar reverse $num;
}

=head2 Methods Bio::SearchIO::SearchWriterI

L<Bio::SearchIO::SearchWriterI> inherited methods.

=head2 filter

 Title   : filter
 Usage   : $writer->filter('hsp', \&hsp_filter);
 Function: Filter out either at HSP,Hit,or Result level
 Returns : none
 Args    : string => data type,
           CODE reference


=cut


=head2 no_wublastlinks

 Title   : no_wublastlinks
 Usage   : $obj->no_wublastlinks($newval)
 Function: Get/Set boolean value regarding whether or not to display
           Link = (1) 
           type output in the report output (WU-BLAST only)
 Returns : boolean
 Args    : on set, new boolean value (a scalar or undef, optional)


=cut

sub no_wublastlinks{
    my $self = shift;

    return $self->{'no_wublastlinks'} = shift if @_;
    return $self->{'no_wublastlinks'};
}

1;



( run in 0.704 second using v1.01-cache-2.11-cpan-39bf76dae61 )