Bio-Tools-Run-Alignment-TCoffee

 view release on metacpan or  search on metacpan

t/TCoffee.t  view on Meta::CPAN

my @seq_array =();

while ( my $seq = $str->next_seq() ) {
    push (@seq_array, $seq) ;
}

my $seq_array_ref = \@seq_array;

$aln = $factory->align($seq_array_ref);
is $aln->num_sequences, 7;
my $s1_perid = $aln->average_percentage_identity;

my $profile1 = test_input_file("cysprot1a.msf");
my $profile2 = test_input_file("cysprot1b.msf");

# convert any warnings about program to an actual exception
$factory->verbose(2);
lives_ok {$aln = $factory->profile_align($profile1,$profile2)};

ok(! $@, "no T-COFFEE errors");
is $aln->num_sequences, 7;

t/TCoffee.t  view on Meta::CPAN


$aln = $factory->profile_align($aln1,$aln2);
is $aln->num_sequences, 7;

$str1 = Bio::AlignIO->new(-file=> test_input_file("cysprot1a.msf"));
$aln1 = $str1->next_aln();
$str2 = Bio::SeqIO->new(-file=> test_input_file("cysprot1b.fa"));
my $seq = $str2->next_seq();

is $aln1->num_sequences, 3;
is( int($aln1->average_percentage_identity), 39);
$aln = $factory->profile_align($aln1,$seq);
is( $aln->num_sequences, 4);
if( $version <= 1.22 ) {
    cmp_ok( $aln->overall_percentage_identity, '>', 18);
    is( int($aln->average_percentage_identity), 44);
} else {
    my $overall = int($aln->overall_percentage_identity);
    ok( $overall >=21 && $overall <= 23, 'expect 21 >= val >= 23');
    my $avg = int($aln->average_percentage_identity);
    ok( $avg == 47 || $avg ==48, 'expect 47 or 48');
}

# test new 'run' generic running of factory

$aln = $factory->run('-type' => 'align',
                     '-seq'  => test_input_file("cysprot.fa"));
is ($aln->num_sequences, 7, 'simple generic run');
is ($aln->percentage_identity,$s1_perid); #calculated before

lives_ok{ $aln = $factory->run('-type' => 'profile',
                               '-profile' => $aln1,
                               '-seq'  => test_input_file("cysprot1b.fa"))} ;

ok(! $@, "no T-COFFEE errors");

is( $aln->num_sequences, 7);
if( $version <= 1.22 ) {
    cmp_ok( $aln->overall_percentage_identity, '>', 18);
    is( int($aln->average_percentage_identity), 44);
} else {
    my $overall = int $aln->overall_percentage_identity;
    ok($overall == 14 || $overall == 13, 'expect 13 or 14');
    my $avg = int($aln->average_percentage_identity);
    ok($avg == 41 || $avg == 42, 'expect 41 or 42');
}

done_testing();

END {
    # warnings are already given above, no need to keep report
    if (-e 'error_report.T-COFFEE') {
        unlink('error_report.T-COFFEE');
    }



( run in 0.310 second using v1.01-cache-2.11-cpan-709fd43a63f )