tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / t / Tools / Match.t
blob7e94c94dec849206b98327a4d651df2b337a84d5
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: Match.t,v 1.15 2007/06/27 10:16:38 sendu Exp $
4 use strict;
6 BEGIN {
7     use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 38,
11                            -requires_module => 'URI::Escape');
12         
13     use_ok('Bio::Tools::Match');
16 ok my $parser = Bio::Tools::Match->new(-file => test_input_file('match.output'));
18 my $count = 0;
19 my @expected = ([qw(4338 4349 1.000 0.945 V$MYOD_01)],
20                 [qw(7390 7401 1.000 0.932 V$MYOD_01)],
21                 [qw(8503 8514 1.000 0.941 V$MYOD_01)],
22                 [qw(8767 8778 1.000 0.937 V$MYOD_01)],
23                 [qw(33 47 0.693 0.779 V$E47_01)]);
24 while (my $feat = $parser->next_result) {
25     $count++;
26     my @exp = @{shift(@expected)};
27     
28     isa_ok $feat, 'Bio::SeqFeature::Annotated';
29     is $feat->source->value, 'transfac_match', 'correct source';
30     is $feat->start, shift(@exp), 'feature start correct';
31     is $feat->end, shift(@exp), 'feature end correct';
32     
33     my $core_score = $feat->score;
34     my $matrix_score = ($feat->annotation->get_Annotations('matrix_score'))[0]->value;
35     my $matrix_id = ($feat->annotation->get_Annotations('matrix_id'))[0]->value;
36     
37     is $core_score, shift(@exp), 'feature core score correct';
38     is $matrix_score, shift(@exp), 'feature matrix score correct';
39     is $matrix_id, shift(@exp), 'feature matrix id correct';
40     
41     last if $count == 5;
44 is $count, 5, "correct number of results managed to get tested";