~ubuntu-branches/ubuntu/trusty/bioperl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/masta.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*-Perl-*-
2
 
#Some simple tests for meme and transfac parsers
3
 
 
4
 
use strict;
5
 
 
6
 
BEGIN {
7
 
    # to handle systems with no installed Test module
8
 
    # we include the t dir (where a copy of Test.pm is located)
9
 
    # as a fallback
10
 
    eval { require Test; };
11
 
    if( $@ ) {
12
 
        use lib 't';
13
 
    }
14
 
    use Test;
15
 
 
16
 
    plan tests => 16;
17
 
}
18
 
 
19
 
use Bio::Matrix::PSM::IO;
20
 
use Bio::Root::IO;
21
 
 
22
 
ok(1);
23
 
END {
24
 
 unlink(Bio::Root::IO->catfile(qw(t data masta_w.dat)));
25
 
}
26
 
#Let's try masta formats here
27
 
my $mio =  new Bio::Matrix::PSM::IO(-format=>'masta', 
28
 
                                      -file=>Bio::Root::IO->catfile(qw(t data masta.dat)));
29
 
my $wmio=new Bio::Matrix::PSM::IO(-format=>'masta', 
30
 
                                      -file=>">".Bio::Root::IO->catfile(qw(t data masta_w.dat)));
31
 
$wmio->_flush_on_write(1);
32
 
ok $mio;
33
 
ok $wmio;
34
 
my @cons;
35
 
my $carry;
36
 
while (my $site=$mio->next_matrix) {
37
 
        ok $site;
38
 
        push @cons,$site->consensus;    
39
 
        $carry=$site if ($site->id eq 'm1logs');
40
 
41
 
ok $cons[0],'CAGAAAAATNGAATNCCCACCCCCC';
42
 
ok $cons[1],'CAGAAAAATAGAATCCCCACCCCCC';
43
 
ok $cons[2],'CAGAAAAATNNAATNCCCACCNCCC';
44
 
 
45
 
$wmio->write_psm($carry,'PWM');
46
 
$carry->id('m1freq');
47
 
$wmio->write_psm($carry,'PFM');
48
 
$carry->id('m1seq');
49
 
$wmio->write_psm($carry,'SEQ');
50
 
$wmio->DESTROY;
51
 
my $chio=new Bio::Matrix::PSM::IO(-format=>'masta', 
52
 
                                      -file=>Bio::Root::IO->catfile(qw(t data masta_w.dat)));
53
 
ok $chio;
54
 
my $site=$chio->next_matrix;
55
 
ok $site->id,'m1logs';
56
 
ok $site->consensus,'CAGAAAAATAGAATCCCCACCCCCC';        
57
 
$site=$chio->next_matrix;
58
 
ok $site->id,'m1freq';
59
 
ok $site->consensus,'CAGAAAAATAGAATCCCCACCCCCC';  
60
 
$site=$chio->next_matrix;
61
 
ok $site->id,'m1seq';
62
 
ok $site->consensus,'CAGAAAAATAGAATCCCCACCCCCC';