Bio-Phylo
view release on metacpan or search on metacpan
lib/Bio/Phylo/Matrices/MatrixRole.pm view on Meta::CPAN
sub maxname_length { $logger->warn }
sub no_residues { $logger->warn }
sub no_sequences {
my $self = shift;
return scalar @{ $self->get_entities };
}
sub percentage_identity { $logger->warn }
# from simplealign
sub average_percentage_identity{
my ($self,@args) = @_;
my @alphabet = ('A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
my ($len, $total, $subtotal, $divisor, $subdivisor, @seqs, @countHashes);
if (! $self->is_flush()) {
throw 'Generic' => "All sequences in the alignment must be the same length";
}
lib/Bio/Phylo/Matrices/MatrixRole.pm view on Meta::CPAN
foreach my $res (keys %hash) {
$total += $hash{$res}*($hash{$res} - 1);
$subdivisor += $hash{$res};
}
$divisor += $subdivisor * ($subdivisor - 1);
}
return $divisor > 0 ? ($total / $divisor )*100.0 : 0;
}
# from simplealign
sub overall_percentage_identity{
my ($self, $length_measure) = @_;
my @alphabet = ('A','B','C','D','E','F','G','H','I','J','K','L','M',
'N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
my ($len, $total, @seqs, @countHashes);
my %enum = map {$_ => 1} qw (align short long);
throw 'Generic' => "Unknown argument [$length_measure]"
lib/Bio/Phylo/Unparsers/Figtree.pm view on Meta::CPAN
# fetch Meta objects, filter out the ones that are _NS_FIGTREE_,
# turn them into a hash without the fig prefix
my @meta = @{ $node->get_meta };
my %meta = map { $_->get_predicate_local => $_->get_object }
grep { $_->get_predicate_namespace eq $ns } @meta;
$log->debug( Dumper(\%meta) );
# there can be separate annotations that are _min and _max for
# the same variable name stem. We combine these into a range
# between curly braces. Also add % percentage symbol for 95%
# HPD ranges - the % symbol is disallowed in CURIEs, hence we
# have to bring it back here.
my %merged;
KEY: for my $key ( keys %meta ) {
if ( $key =~ /^(.+?)_min$/ ) {
my $stem = $1;
my $max_key = $stem . '_max';
$stem =~ s/95/95%/;
$merged{$stem} = '{'.$meta{$key}.','.$meta{$max_key}.'}';
}
t/24-bioperl-alignio.t view on Meta::CPAN
'-format' => 'emboss',
'-file' => test_input_file('cysprot.water'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->score, '501.50' );
is( $aln->get_seq_by_pos(1)->get_nse, 'PAPA_CARPA/3-342' );
is( $aln->get_seq_by_pos(2)->get_nse, 'CATL_HUMAN/1-331' );
SKIP: {
skip 'percentage identity', 2, if 1;
is( sprintf( "%.1f", $aln->overall_percentage_identity ), 33.8 );
is( sprintf( "%.1f", $aln->average_percentage_identity ), 40.1 );
}
is( $aln->get_seq_by_pos(1)->start, 3 );
SKIP: {
skip 'length', 1, if 1;
is( $aln->length, 364 );
}
# EMBOSS needle
$str = Bio::AlignIO->new(
'-format' => 'emboss',
t/24-bioperl-alignio.t view on Meta::CPAN
# EMBOSS water 2.2.x sparse needle
$str = Bio::AlignIO->new(
-verbose => $DEBUG,
'-format' => 'emboss',
'-file' => test_input_file('sparsealn.needle'),
'-verbose' => -1,
);
$aln = Bio::Phylo::Matrices::Matrix->new_from_bioperl( $str->next_aln() );
isa_ok( $aln, 'Bio::Align::AlignI' );
is( $aln->score, '18.0' );
is( sprintf( "%.1f", $aln->overall_percentage_identity ), 2.1 );
is( sprintf( "%.1f", $aln->average_percentage_identity ), 38.5 );
is( $aln->get_seq_by_pos(1)->length, 238 );
is( $aln->length, 238 );
is( $aln->get_seq_by_pos(1)->get_nse, 'KV1K_HUMAN/1-108' );
is( $aln->get_seq_by_pos(2)->get_nse, 'IF1Y_HUMAN/1-143' );
is( $aln->get_seq_by_pos(1)->seq(),
'DIQMTQSPSTLSVSVGDRVTITCEASQTVLSYLNWYQQK'
. 'PGKAPKLLIYAASSLETGVPSRFSGQGSGTBFTFTISSVZPZBFATYYCQZYLDLPRTFGQGTKVDLKR'
. '-' x 130 );
is( $aln->get_seq_by_pos(2)->seq(),
( '-' x 94 )
( run in 0.483 second using v1.01-cache-2.11-cpan-709fd43a63f )