1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: WABA.t 11525 2007-06-27 10:16:38Z sendu $
9 test_begin(-tests => 64);
11 use_ok('Bio::SearchIO');
14 my $wabain = Bio::SearchIO->new(
16 -file => test_input_file('test.waba')
19 isa_ok($wabain, 'Bio::SearchIO') ;
21 # These won't look the same as the WABA file because Jim's code is 0 based
22 # while we (bioperl) are 1 based.
31 [qw(3833 34 2972 1 243 3688 1 40.9)],
32 [qw(4211 3022 6914 1 3705 6848 1 43.7)],
33 [qw(2218 7004 9171 1 6892 8712 1 50.3)],
37 'X57152', 'pair9_hs.fa',
38 'pair9_mm.fa', [ 'X80685', 1, [qw(7572 4 5845 1 632 7368 1 46.8)], ],
42 while ( my $wabar = $wabain->next_result ) {
43 my @r = @{ shift @results };
44 is( $wabar->query_name, shift @r, 'query_name' );
45 is( $wabar->query_database, shift @r, 'query database' );
46 is( $wabar->database_name, shift @r, 'database name' );
48 while ( my $wabah = $wabar->next_hit ) {
49 my (@h) = @{ shift @r };
50 is( $wabah->name, shift @h, 'name' );
51 is( $wabah->hsps(), shift @h, 'hsps' );
53 while ( my $wabahsp = $wabah->next_hsp ) {
54 my (@hsp) = @{ shift @h };
55 is( $wabahsp->length('total'), shift @hsp , 'total length');
56 is( $wabahsp->query->start, shift @hsp , 'start' );
57 is( $wabahsp->query->end, shift @hsp , 'end' );
58 is( $wabahsp->strand('query'), shift @hsp , 'strand' );
59 is( $wabahsp->start('hit'), shift @hsp , 'start' );
60 is( $wabahsp->end('subject'), shift @hsp , 'end' );
61 is( $wabahsp->subject->strand, shift @hsp, 'strand' );
62 is( length( $wabahsp->query_string ), $wabahsp->length('total') , 'query string');
63 is( length( $wabahsp->hit_string ), $wabahsp->length('total') , 'hit_string' );
64 is( length( $wabahsp->hmmstate_string ),
65 $wabahsp->length('total') , 'hmmstate string');
66 my $hs = $wabahsp->hit_string;
67 is( $wabahsp->gaps('hit'), $hs =~ tr/\-// );
68 my $qs = $wabahsp->query_string;
69 is( $wabahsp->gaps('query'), $qs =~ tr/\-// );
70 is( sprintf( "%.1f", $wabahsp->percent_identity ), shift @hsp );