~ubuntu-branches/ubuntu/precise/bioperl/precise

« back to all changes in this revision

Viewing changes to t/SiteMatrix.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2007-09-21 22:52:22 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070921225222-tt20m2yy6ycuy2d8
Tags: 1.5.2.102-1
* Developer release.
* Upgraded source package to debhelper 5 and standards-version 3.7.2.
* Added libmodule-build-perl and libtest-harness-perl to
  build-depends-indep.
* Disabled automatic CRAN download.
* Using quilt instead of .diff.gz to manage modifications.
* Updated Recommends list for the binary package.
* Moved the "production-quality" scripts to /usr/bin/.
* New maintainer: Debian-Med packaging team mailing list.
* New uploaders: Charles Plessy and Steffen Moeller.
* Updated Depends, Recommends and Suggests.
* Imported in Debian-Med's SVN repository on Alioth.
* Executing the regression tests during package building.
* Moved the Homepage: field out from the package's description.
* Updated watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
#Some simple test, nothing fancy...
4
 
 
5
 
use strict;
6
 
 
7
 
BEGIN {
8
 
    # to handle systems with no installed Test module
9
 
    # we include the t dir (where a copy of Test.pm is located)
10
 
    # as a fallback
11
 
    eval { require Test; };
12
 
    if( $@ ) {
13
 
        use lib 't';
14
 
    }
15
 
    use Test;
16
 
 
17
 
    plan tests => 15;
18
 
}
19
 
use Bio::Matrix::PSM::SiteMatrix;
20
 
 
21
 
ok(1);
22
 
 
23
 
my $score;
24
 
my $A='a0501';
25
 
my $C='014a0';
26
 
my $G='01103';
27
 
my $T='08006';
28
 
my $eval=0.0001;
29
 
my %param=(pA=>$A,pC=>$C,pG=>$G,pT=>$T,e_val=>$eval, correction =>0);
30
 
my $matrix=new Bio::Matrix::PSM::SiteMatrix(%param);
31
 
ok $matrix;
32
 
 
33
 
#Simple methods here
34
 
ok $matrix->IUPAC,'ATMCK';
35
 
 
36
 
ok $matrix->consensus,'ATACT';
37
 
 
38
 
ok $matrix->width,5;
39
 
 
40
 
ok $matrix->curpos,0;
41
 
 
42
 
ok $matrix->get_string('A'),$A;
43
 
 
44
 
my %x= (base=>'A',pA=>1,pC=>0,pG=>0,pT=>0,prob=>10,rel=>0);
45
 
ok $matrix->next_pos, %x;
46
 
 
47
 
ok $matrix->curpos,1;
48
 
 
49
 
ok $matrix->e_val(0.0001);
50
 
 
51
 
ok $matrix->e_val,0.0001;
52
 
 
53
 
#Now some PSM specific methods like regexp and matrix info
54
 
ok $matrix->regexp,'[Aa][Tt][AaCc][Cc][GgTt]';
55
 
my $regexp=$matrix->regexp;
56
 
ok 'ATCCT',"/$regexp/";
57
 
 
58
 
my @x=(1,0,0.5,0,0.1);
59
 
ok $matrix->get_array('A'),@x;
60
 
 
61
 
@x=qw(Aa Tt AaCc Cc GgTt);
62
 
ok $matrix->regexp_array,@x;
63
 
 
 
1
# -*-Perl-*-
 
2
# $Id: SiteMatrix.t,v 1.4.6.3 2006/10/02 23:10:40 sendu Exp $
 
3
#Some simple test, nothing fancy...
 
4
 
 
5
use strict;
 
6
 
 
7
CHECK {
 
8
  $ENV{PERL_HASH_SEED} = 0;
 
9
}
 
10
 
 
11
BEGIN {
 
12
    # to handle systems with no installed Test module
 
13
    # we include the t dir (where a copy of Test.pm is located)
 
14
    # as a fallback
 
15
    eval { require Test; };
 
16
    if( $@ ) {
 
17
        use lib 't';
 
18
    }
 
19
    use Test;
 
20
 
 
21
    plan tests => 15;
 
22
}
 
23
use Bio::Matrix::PSM::SiteMatrix;
 
24
 
 
25
ok(1);
 
26
 
 
27
my $score;
 
28
my $A='a0501';
 
29
my $C='014a0';
 
30
my $G='01103';
 
31
my $T='08006';
 
32
my $eval=0.0001;
 
33
my %param=(pA=>$A,pC=>$C,pG=>$G,pT=>$T,e_val=>$eval, correction =>0);
 
34
my $matrix=new Bio::Matrix::PSM::SiteMatrix(%param);
 
35
ok $matrix;
 
36
 
 
37
#Simple methods here
 
38
ok $matrix->IUPAC,'ABVCD';
 
39
 
 
40
ok $matrix->consensus,'ATACT';
 
41
 
 
42
ok $matrix->width,5;
 
43
 
 
44
ok $matrix->curpos,0;
 
45
 
 
46
ok $matrix->get_string('A'),$A;
 
47
 
 
48
my %x= (base=>'A',pA=>1,pC=>0,pG=>0,pT=>0,prob=>10,rel=>0, 
 
49
        lA=>undef,lC=>undef,lG=>undef,lT=>undef);
 
50
my %pos = $matrix->next_pos;
 
51
my ($all) = 1;
 
52
while(my ($k,$v) = each %x ) {
 
53
    my $r =$pos{$k};
 
54
    if( ! defined $v && ! defined $r) {
 
55
    } elsif($pos{$k} ne $v ) { 
 
56
        $all = 0;
 
57
        last;
 
58
    }
 
59
}
 
60
ok($all);
 
61
 
 
62
ok $matrix->curpos,1;
 
63
 
 
64
ok $matrix->e_val(0.0001);
 
65
 
 
66
ok $matrix->e_val,0.0001;
 
67
 
 
68
#Now some PSM specific methods like regexp and matrix info
 
69
ok $matrix->regexp,'[Aa][CcGgTtBb][AaCcGgVv][Cc][AaGgTtDd]';
 
70
my $regexp=$matrix->regexp;
 
71
ok 'ATCCT',"/$regexp/";
 
72
 
 
73
my @x=(1,0,0.5,0,0.1);
 
74
ok $matrix->get_array('A'),@x;
 
75
 
 
76
@x=qw(Aa Tt AaCc Cc GgTt);
 
77
ok $matrix->regexp_array,@x;
 
78