~ubuntu-branches/ubuntu/karmic/bioperl/karmic

« back to all changes in this revision

Viewing changes to t/CodonTable.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
1
#-*-Perl-*-
2
2
## Bioperl Test Harness Script for Modules
3
 
## $Id: CodonTable.t,v 1.15 2003/10/25 14:39:35 heikki Exp $
 
3
## $Id: CodonTable.t,v 1.20 2006/08/16 21:07:01 cjfields Exp $
4
4
 
5
5
# Before `make install' is performed this script should be runnable with
6
6
# `make test'. After `make install' it should work as `perl test.t'
7
7
 
8
8
use strict;
 
9
use lib './';
9
10
BEGIN { 
10
11
    # to handle systems with no installed Test module
11
12
    # we include the t dir (where a copy of Test.pm is located)
16
17
    }
17
18
    use Test;
18
19
 
19
 
    plan tests => 38;
 
20
    plan tests => 51;
20
21
}
21
22
use Bio::Tools::CodonTable;
22
23
use vars qw($DEBUG);
32
33
$myCodonTable = Bio::Tools::CodonTable->new();
33
34
ok $myCodonTable->id(), 1;
34
35
 
35
 
 
36
36
# change codon table
37
37
$myCodonTable->id(10);
38
38
ok $myCodonTable->id, 10;
39
 
 
40
39
ok $myCodonTable->name(), 'Euplotid Nuclear';
41
40
 
 
41
# enumerate tables as object method
 
42
my $table = $myCodonTable->tables();
 
43
ok (keys %{$table} >= 17); # currently 17 known tables
 
44
ok $table->{11}, q{"Bacterial"};
 
45
 
 
46
# enumerate tables as class method
 
47
$table = Bio::Tools::CodonTable->tables;
 
48
ok (values %{$table} >= 17); # currently 17 known tables
 
49
ok $table->{23}, 'Thraustochytrium Mitochondrial';
 
50
 
42
51
# translate codons
43
52
$myCodonTable->id(1);
44
53
 
98
107
 
99
108
# reverse translate amino acids 
100
109
 
101
 
ok $myCodonTable->revtranslate('J'), 0;
102
 
 
 
110
ok $myCodonTable->revtranslate('U'), 0;
 
111
ok $myCodonTable->revtranslate('O'), 0;
 
112
ok $myCodonTable->revtranslate('J'), 9;
 
113
ok $myCodonTable->revtranslate('I'), 3;
103
114
 
104
115
@ii = qw(A l ACN Thr sER ter Glx);
105
116
@res = (
132
143
$myCodonTable->id(1);
133
144
 
134
145
ok $myCodonTable->is_start_codon('ATG');  
135
 
ok( $myCodonTable->is_start_codon('GGH'), 0);
 
146
ok $myCodonTable->is_start_codon('GGH'), 0;
136
147
ok $myCodonTable->is_start_codon('HTG');
137
148
ok $myCodonTable->is_start_codon('CCC'), 0;
138
149
 
146
157
ok $myCodonTable->is_unknown_codon('jg');
147
158
ok $myCodonTable->is_unknown_codon('UAG'), 0;
148
159
 
149
 
 
150
160
ok $myCodonTable->translate_strict('ATG'), 'M';
151
161
 
152
162
 
174
184
ok $seq->translate()->seq, 'MKNTTTT';
175
185
ok $seq->translate(undef, undef, undef, undef, undef, undef, $myCodonTable)->seq, 'MKXXTTT';
176
186
 
 
187
# test gapped translated
 
188
 
 
189
ok $seq = Bio::PrimarySeq->new(-seq      => 'atg---aar------aay',
 
190
                                           -alphabet => 'dna');
 
191
ok $seq->translate->seq, 'M-K--N';
 
192
 
 
193
ok $seq = Bio::PrimarySeq->new(-seq=>'ASDFGHKL');
 
194
ok $myCodonTable->reverse_translate_all($seq), 'GCBWSNGAYTTYGGVCAYAARYTN';
 
195
ok $seq = Bio::PrimarySeq->new(-seq=>'ASXFHKL');
 
196
ok $myCodonTable->reverse_translate_all($seq), 'GCBWSNNNNTTYCAYAARYTN';