BioPerl
view release on metacpan or search on metacpan
Bio/SearchIO/Writer/TextResultWriter.pm view on Meta::CPAN
my ($string) = @_;
my ($gi,$acc);
if( $string =~ s/gi\|(\d+)\|?// )
{ $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; }
=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. "\n";
if( $result->algorithm_version =~ /WashU/i ) {
return $res .qq{
Copyright (C) 1996-2000 Washington University, Saint Louis, Missouri USA.
All Rights Reserved.
Reference: Gish, W. (1996-2000) http://blast.wustl.edu
};
} else {
return $res . qq{
Reference: Altschul, Stephen F., Thomas L. Madden, Alejandro A. Schaffer,
Jinghui Zhang, Zheng Zhang, Webb Miller, and David J. Lipman (1997),
"Gapped BLAST and PSI-BLAST: a new generation of protein database search
programs", Nucleic Acids Res. 25:3389-3402.
};
}
} elsif( $result->algorithm =~ /FAST/i ) {
return $result->algorithm. " ". $result->algorithm_version . "\n".
"\nReference: Pearson et al, Genomics (1997) 46:24-36\n";
} 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;
}
sub _linewrap {
my ($str) = @_;
if($TextWrapLoaded) {
return Text::Wrap::wrap("","",$str); # use Text::Wrap
} else { return $str; } # cannot wrap
}
=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.520 second using v1.01-cache-2.11-cpan-39bf76dae61 )