Skip to content

Commit

Permalink
Merge github.com:bioperl/bioperl-live into amplicons
Browse files Browse the repository at this point in the history
  • Loading branch information
fangly committed Mar 6, 2012
2 parents 92eec7d + d41b38b commit 37596a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Bio/Tools/IUPAC.pm
Expand Up @@ -515,7 +515,10 @@ sub count {
Function: Converts the ambiguous sequence into a regular expression that
matches all of the corresponding ambiguous and non-ambiguous sequences.
You can further manipulate the resulting regular expression with the
Bio::Tools::SeqPattern module.
Bio::Tools::SeqPattern module. After you are done building your
regular expression, you might want to compile it and make it case-
insensitive:
$re = qr/$re/i;
Args : none
Return : regular expression
Expand All @@ -541,7 +544,6 @@ sub regexp {
$re .= $$iupacs[0];
}
}
$re = qr/$re/i;
return $re;
}

Expand Down
8 changes: 4 additions & 4 deletions t/Tools/IUPAC.t
Expand Up @@ -33,23 +33,23 @@ ok $iupac = Bio::Tools::IUPAC->new( -seq => $ambiseq );

ok my $regexp = $iupac->regexp;

like $regexp, qr/A\[AGR\]TCGTTG\[ACGTBDHKMNRSVWY\]/, 'Regexp';
is $regexp, 'A[AGR]TCGTTG[ACGTBDHKMNRSVWY]', 'Regexp';

is $iupac->count(), 8, 'Count';

my @seqs;
while (my $uniqueseq = $iupac->next_seq()) {
push @seqs, $uniqueseq->seq;
is $uniqueseq->isa('Bio::PrimarySeqI'), 1;
like $uniqueseq->seq, $regexp;
like $uniqueseq->seq, qr/$regexp/i;
}

@seqs = sort @seqs;
is_deeply \@seqs, [ 'AATCGTTGA', 'AATCGTTGC', 'AATCGTTGG', 'AATCGTTGT',
'AGTCGTTGA', 'AGTCGTTGC', 'AGTCGTTGG', 'AGTCGTTGT' ];

like $ambiseq->seq, $regexp, 'Regexp matches ambiguous sequences';
like 'ARTCGTTGW', $regexp;
like $ambiseq->seq, qr/$regexp/i, 'Regexp matches ambiguous sequences';
like 'ARTCGTTGW', qr/$regexp/i;


# IUPAC code methods
Expand Down

0 comments on commit 37596a6

Please sign in to comment.