1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 100);
12 use_ok('Bio::Symbol::Alphabet');
13 use_ok('Bio::Symbol::Symbol');
14 use_ok('Bio::Symbol::DNAAlphabet');
15 use_ok('Bio::Symbol::ProteinAlphabet');
18 my $A = Bio::Symbol::Symbol->new(-token => 'A' );
19 my $U = Bio::Symbol::Symbol->new(-token => 'U' );
20 my $G = Bio::Symbol::Symbol->new(-token => 'G' );
21 my $T = Bio::Symbol::Symbol->new(-token => 'T' );
23 my $rna = Bio::Symbol::Alphabet->new( -symbols => [ $A, $U, $G, $T ] );
25 isa_ok($rna, 'Bio::Symbol::Alphabet');
26 my @symbols = $rna->symbols;
27 is(scalar @symbols, 4);
29 ok($rna->contains($A));
30 ok($rna->contains($T));
31 ok($rna->contains($U));
32 ok($rna->contains($G));
34 my $dna = Bio::Symbol::DNAAlphabet->new();
35 isa_ok($dna, 'Bio::Symbol::AlphabetI');
38 my @dnasymbols = sort qw( A B C D G H K M N R S T U V W X Y );
39 foreach my $s ( sort { $a->name cmp $b->name } $dna->symbols ) {
40 is($s->name, $dnasymbols[$count]);
41 is($s->token, $dnasymbols[$count++]);
44 my $prot = Bio::Symbol::ProteinAlphabet->new();
45 isa_ok($prot, 'Bio::Symbol::AlphabetI');
47 my @protsymbols = sort qw( * A B C D E F G H I J K L M N O P Q R S T U V W X Y Z);
49 'Ala' => 'A', 'Asx' => 'B', 'Cys' => 'C', 'Asp' => 'D',
50 'Glu' => 'E', 'Phe' => 'F', 'Gly' => 'G', 'His' => 'H',
51 'Ile' => 'I', 'Lys' => 'K', 'Leu' => 'L', 'Met' => 'M',
52 'Asn' => 'N', 'Pro' => 'P', 'Gln' => 'Q', 'Arg' => 'R',
53 'Ser' => 'S', 'Thr' => 'T', 'Val' => 'V', 'Trp' => 'W',
54 'Xaa' => 'X', 'Tyr' => 'Y', 'Glx' => 'Z', 'Ter' => '*',
55 'Sec' => 'U', 'Pyl' => 'O', 'Xle' => 'J',
57 my @protnms = sort { $h{$a} cmp $h{$b} } keys %h;
59 foreach my $s ( sort { $a->token cmp $b->token } $prot->symbols ) {
60 is($s->name, $protnms[$count]);
61 is($s->token, $protsymbols[$count++]);