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');
19 my $A = Bio::Symbol::Symbol->new(-token => 'A' );
20 my $U = Bio::Symbol::Symbol->new(-token => 'U' );
21 my $G = Bio::Symbol::Symbol->new(-token => 'G' );
22 my $T = Bio::Symbol::Symbol->new(-token => 'T' );
24 my $rna = Bio::Symbol::Alphabet->new( -symbols => [ $A, $U, $G, $T ] );
26 isa_ok($rna, 'Bio::Symbol::Alphabet');
27 my @symbols = $rna->symbols;
28 is(scalar @symbols, 4);
30 ok($rna->contains($A));
31 ok($rna->contains($T));
32 ok($rna->contains($U));
33 ok($rna->contains($G));
36 my $dna = Bio::Symbol::DNAAlphabet->new();
37 isa_ok($dna, 'Bio::Symbol::AlphabetI');
40 my @dnasymbols = sort qw( A B C D G H K M N R S T U V W X Y );
41 foreach my $s ( sort { $a->name cmp $b->name } $dna->symbols ) {
42 is($s->name, $dnasymbols[$count]);
43 is($s->token, $dnasymbols[$count++]);
46 my $prot = Bio::Symbol::ProteinAlphabet->new();
47 isa_ok($prot, 'Bio::Symbol::AlphabetI');
49 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);
51 'Ala' => 'A', 'Asx' => 'B', 'Cys' => 'C', 'Asp' => 'D',
52 'Glu' => 'E', 'Phe' => 'F', 'Gly' => 'G', 'His' => 'H',
53 'Ile' => 'I', 'Lys' => 'K', 'Leu' => 'L', 'Met' => 'M',
54 'Asn' => 'N', 'Pro' => 'P', 'Gln' => 'Q', 'Arg' => 'R',
55 'Ser' => 'S', 'Thr' => 'T', 'Val' => 'V', 'Trp' => 'W',
56 'Xaa' => 'X', 'Tyr' => 'Y', 'Glx' => 'Z', 'Ter' => '*',
57 'Sec' => 'U', 'Pyl' => 'O', 'Xle' => 'J',
59 my @protnms = sort { $h{$a} cmp $h{$b} } keys %h;
61 foreach my $s ( sort { $a->token cmp $b->token } $prot->symbols ) {
62 is($s->name, $protnms[$count]);
63 is($s->token, $protsymbols[$count++]);