1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 46);
12 use_ok('Bio::Tools::IUPAC');
14 use_ok('Bio::PrimarySeq');
18 # IUPAC sequences and regular expressions
20 my $ambiseq = Bio::Seq->new(
25 my $ambiprimaryseq = Bio::Seq->new(
30 ok my $iupac = Bio::Tools::IUPAC->new( -seq => $ambiprimaryseq );
32 ok $iupac = Bio::Tools::IUPAC->new( -seq => $ambiseq );
34 ok my $regexp = $iupac->regexp, 'Regexp';
35 is $regexp, 'A[AGR]TCGTTG[ACGTBDHKMNRSVWY]';
37 $regexp = $iupac->regexp(1);
38 is $regexp, 'A[AGR][TU]CG[TU][TU]G[ACGTUBDHKMNRSVWY]', 'Regexp';
41 is $iupac->count(), 8, 'Count';
44 while (my $uniqueseq = $iupac->next_seq()) {
45 push @seqs, $uniqueseq->seq;
46 is $uniqueseq->isa('Bio::PrimarySeqI'), 1;
47 like $uniqueseq->seq, qr/$regexp/i;
51 is_deeply \@seqs, [ 'AATCGTTGA', 'AATCGTTGC', 'AATCGTTGG', 'AATCGTTGT',
52 'AGTCGTTGA', 'AGTCGTTGC', 'AGTCGTTGG', 'AGTCGTTGT' ];
54 like $ambiseq->seq, qr/$regexp/i, 'Regexp matches ambiguous sequences';
55 like 'ARTCGTTGW', qr/$regexp/i;
61 ok %iupac = $iupac->iupac_iub(), 'Nucleic IUPAC';
62 ok exists $iupac{'A'};
63 ok not exists $iupac{'Z'};
65 ok %iupac = $iupac->iupac_iub_amb();
66 ok exists $iupac{'N'};
67 ok not exists $iupac{'A'};
69 ok %iupac = $iupac->iupac_rev_iub();
71 ok %iupac = $iupac->iupac_iup(), 'Proteic IUPAC';
72 ok exists $iupac{'A'};
73 ok exists $iupac{'Z'};
75 ok %iupac = $iupac->iupac_iup_amb();
76 ok exists $iupac{'B'};
77 ok not exists $iupac{'A'};
79 ok %iupac = $iupac->iupac();
80 ok not(exists $iupac{'Z'});
82 ok %iupac = $iupac->iupac_amb();
83 ok not(exists $iupac{'A'});
85 ok %iupac = Bio::Tools::IUPAC->new->iupac_iup;