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