Degenerate primers

From BioPerl
Jump to: navigation, search

These code snippets were designed to be called from an external package.

This subroutine demonstrates how to return each of the oligomers present in a degenerate primer. It takes the sequence string of the degenerate primer and returns the oligomers that match the sequence string in an array. This can be used in conjunction with the snippets here to calculate the Tm (melting temperature) mean and Tm range of degenerate primers.

package Primer;
use Bio::Tools::IUPAC;
sub find_degenerates
	my ($class, $sequence) = @_;
	my $seq_obj = Bio::Seq->new(-seq => $sequence, -alphabet => 'dna');
	my $stream  = Bio::Tools::IUPAC->new(-seq => $seq_obj);
	my @oligomers;
	while (my $uniqueseq = $stream->next_seq()) { push @oligomers, $uniqueseq->seq; }
	return @oligomers;

This subroutine produces pattern strings that can be used to search within files or a database (such as BioSQL) for sequences that match a degenerate primer. It takes the primer as a sequence object and returns two patterns, one for each strand.

package Primer;
use Bio::Tools::SeqPattern;
sub generate_primer_search_patterns
	my ($class, $seqobj) = @_;
	my $pattern = Bio::Tools::SeqPattern->new(-SEQ =>$seqobj->seq, -TYPE =>'Dna');
	return ($pattern->expand, $pattern->revcom(1)->expand);

--Giles.weaver 19:36, 14 April 2010 (UTC)

Personal tools
Main Links