t/*: remove "use lib '.'" and t/lib/Error.pm
[bioperl-live.git] / t / Matrix / IO / masta.t
blob14843903de984d89caab3c40bbffa0301e464282
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7     use Bio::Root::Test;
8     
9     test_begin(-tests => 16);
10         
11         use_ok('Bio::Matrix::PSM::IO');
14 #Let's try masta formats here
15 my $mio =  Bio::Matrix::PSM::IO->new(-format=>'masta', 
16                                       -file=>test_input_file('masta.dat'));
17 my $masta_w_dat = test_output_file();
18 my $wmio=Bio::Matrix::PSM::IO->new(-format=>'masta', 
19                                       -file=>">".$masta_w_dat);
20 $wmio->_flush_on_write(1);
21 ok $mio;
22 ok $wmio;
23 my @cons;
24 my $carry;
25 while (my $site=$mio->next_matrix) {
26         ok $site;
27         push @cons,$site->consensus;    
28         $carry=$site if ($site->id eq 'm1logs');
29
30 is $cons[0],'CAGAAAAATNGAATNCCCACCCCCC';
31 is $cons[1],'CAGAAAAATAGAATCCCCACCCCCC';
32 is $cons[2],'CAGAAAAATNNAATNCCCACCNCCC';
34 $wmio->write_psm($carry,'PWM');
35 $carry->id('m1freq');
36 $wmio->write_psm($carry,'PFM');
37 $carry->id('m1seq');
38 $wmio->write_psm($carry,'SEQ');
39 $wmio->DESTROY;
40 my $chio=Bio::Matrix::PSM::IO->new(-format=>'masta', 
41                                       -file=>$masta_w_dat);
42 ok $chio;
43 my $site=$chio->next_matrix;
44 is $site->id,'m1logs';
45 is $site->consensus,'CAGAAAAATAGAATCCCCACCCCCC';        
46 $site=$chio->next_matrix;
47 is $site->id,'m1freq';
48 is $site->consensus,'CAGAAAAATAGAATCCCCACCCCCC';  
49 $site=$chio->next_matrix;
50 is $site->id,'m1seq';
51 is $site->consensus,'CAGAAAAATAGAATCCCCACCCCCC';