~ubuntu-branches/ubuntu/oneiric/bioperl/oneiric

« back to all changes in this revision

Viewing changes to t/Matrix/SiteMatrix.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090310071911-ever3si2bbzx1iks
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-*- Test Harness script for Bioperl
 
2
# $Id: SiteMatrix.t 15112 2008-12-08 18:12:38Z sendu $
 
3
 
 
4
 
 
5
use strict;
 
6
 
 
7
BEGIN {
 
8
  use lib '.';
 
9
  use Bio::Root::Test;
 
10
  
 
11
  test_begin(-tests => 14);
 
12
  
 
13
  use_ok('Bio::Matrix::PSM::SiteMatrix');
 
14
}
 
15
 
 
16
my $score;
 
17
my $A='a0501';
 
18
my $C='014a0';
 
19
my $G='01103';
 
20
my $T='08006';
 
21
my $eval=0.0001;
 
22
my %param=(pA=>$A,pC=>$C,pG=>$G,pT=>$T,e_val=>$eval, correction =>0);
 
23
ok my $matrix=Bio::Matrix::PSM::SiteMatrix->new(%param);
 
24
 
 
25
#Simple methods here
 
26
is $matrix->IUPAC,'ABVCD';
 
27
 
 
28
is $matrix->consensus,'ATACT';
 
29
 
 
30
is $matrix->width,5;
 
31
 
 
32
is $matrix->curpos,0;
 
33
 
 
34
is $matrix->get_string('A'),$A;
 
35
 
 
36
my %x= (base=>'A',pA=>1,pC=>0,pG=>0,pT=>0,prob=>10,rel=>0, 
 
37
        lA=>undef,lC=>undef,lG=>undef,lT=>undef);
 
38
my %pos = $matrix->next_pos;
 
39
my ($all) = 1;
 
40
while(my ($k,$v) = each %x ) {
 
41
    my $r =$pos{$k};
 
42
    if( ! defined $v && ! defined $r) {
 
43
    } elsif($pos{$k} ne $v ) { 
 
44
        $all = 0;
 
45
        last;
 
46
    }
 
47
}
 
48
ok($all);
 
49
 
 
50
is $matrix->curpos,1;
 
51
 
 
52
ok $matrix->e_val(0.0001);
 
53
 
 
54
is $matrix->e_val,0.0001;
 
55
 
 
56
#Now some PSM specific methods like regexp and matrix info
 
57
is $matrix->regexp,'[Aa][CcGgTtBb][AaCcGgVv][Cc][AaGgTtDd]';
 
58
 
 
59
my @x=(1,0,0.5,0,0.1);
 
60
is_deeply [$matrix->get_array('A')], \@x;
 
61
 
 
62
@x=qw([Aa] [CcGgTtBb] [AaCcGgVv] [Cc] [AaGgTtDd]);
 
63
is_deeply [$matrix->regexp_array], \@x;