1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin(-tests => 46);
11 use_ok('Bio::Tools::IUPAC');
13 use_ok('Bio::PrimarySeq');
17 # IUPAC sequences and regular expressions
19 my $ambiseq = Bio::Seq->new(
24 my $ambiprimaryseq = Bio::Seq->new(
29 ok my $iupac = Bio::Tools::IUPAC->new( -seq => $ambiprimaryseq );
31 ok $iupac = Bio::Tools::IUPAC->new( -seq => $ambiseq );
33 ok my $regexp = $iupac->regexp, 'Regexp';
34 is $regexp, 'A[AGR]TCGTTG[ACGTBDHKMNRSVWY]';
36 $regexp = $iupac->regexp(1);
37 is $regexp, 'A[AGR][TU]CG[TU][TU]G[ACGTUBDHKMNRSVWY]', 'Regexp';
40 is $iupac->count(), 8, 'Count';
43 while (my $uniqueseq = $iupac->next_seq()) {
44 push @seqs, $uniqueseq->seq;
45 is $uniqueseq->isa('Bio::PrimarySeqI'), 1;
46 like $uniqueseq->seq, qr/$regexp/i;
50 is_deeply \@seqs, [ 'AATCGTTGA', 'AATCGTTGC', 'AATCGTTGG', 'AATCGTTGT',
51 'AGTCGTTGA', 'AGTCGTTGC', 'AGTCGTTGG', 'AGTCGTTGT' ];
53 like $ambiseq->seq, qr/$regexp/i, 'Regexp matches ambiguous sequences';
54 like 'ARTCGTTGW', qr/$regexp/i;
60 ok %iupac = $iupac->iupac_iub(), 'Nucleic IUPAC';
61 ok exists $iupac{'A'};
62 ok not exists $iupac{'Z'};
64 ok %iupac = $iupac->iupac_iub_amb();
65 ok exists $iupac{'N'};
66 ok not exists $iupac{'A'};
68 ok %iupac = $iupac->iupac_rev_iub();
70 ok %iupac = $iupac->iupac_iup(), 'Proteic IUPAC';
71 ok exists $iupac{'A'};
72 ok exists $iupac{'Z'};
74 ok %iupac = $iupac->iupac_iup_amb();
75 ok exists $iupac{'B'};
76 ok not exists $iupac{'A'};
78 ok %iupac = $iupac->iupac();
79 ok not(exists $iupac{'Z'});
81 ok %iupac = $iupac->iupac_amb();
82 ok not(exists $iupac{'A'});
84 ok %iupac = Bio::Tools::IUPAC->new->iupac_iup;