NAME

Bio::Tools::AmpliconSearch - Find amplicons in a template using degenerate PCR primers

SYNOPSIS

use Bio::PrimarySeq;
use Bio::Tools::AmpliconSearch;

my $template = Bio::PrimarySeq->new(
   -seq => 'aaaaaCCCCaaaaaaaaaaTTTTTTaaaaaCCACaaaaaTTTTTTaaaaaaaaaa',
);
my $fwd_primer = Bio::PrimarySeq->new(
   -seq => 'CCNC',
);
my $rev_primer = Bio::PrimarySeq->new(
   -seq => 'AAAAA',
);

my $search = Bio::Tools::AmpliconSearch->new(
   -template   => $template,
   -fwd_primer => $fwd_primer,
   -rev_primer => $rev_primer,
);

while (my $amplicon = $search->next_amplicon) {
   print "Found amplicon at position ".$amplicon->start.'..'.$amplicon->end.":\n";
   print $amplicon->seq->seq."\n\n";
}

# Now change the template (but you could change the primers instead) and look
# for amplicons again

$template = Bio::PrimarySeq->new(
   -seq => 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
);
$search->template($template);

while (my $amplicon = $search->next_amplicon) {
   print "Found amplicon at position ".$amplicon->start.'..'.$amplicon->end.":\n";
   print $amplicon->seq->seq."\n\n";
}

DESCRIPTION

Perform an in silico PCR reaction, i.e. search for amplicons in a given template sequence using the specified degenerate primer.

The template sequence is a sequence object, e.g. Bio::Seq, and the primers can be a sequence or a Bio::SeqFeature::Primer object and contain ambiguous residues as defined in the IUPAC conventions. The primer sequences are converted into regular expressions using Bio::Tools::IUPAC and the matching regions of the template sequence, i.e. the amplicons, are returned as Bio::Seq::PrimedSeq objects.

AmpliconSearch will look for amplicons on both strands (forward and reverse- complement) of the specified template sequence. If the reverse primer is not provided, an amplicon will be returned and span a match of the forward primer to the end of the template. Similarly, when no forward primer is given, match from the beginning of the template sequence. When several amplicons overlap, only the shortest one to more accurately represent the biases of PCR. Future improvements may include modelling the effects of the number of PCR cycles or temperature on the PCR products.

TODO

Future improvements may include:

  • Allowing a small number of primer mismatches

  • Reporting all amplicons, including overlapping ones

  • Putting a limit on the length of amplicons, in accordance with the processivity of the polymerase used

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues

AUTHOR

Florent Angly <florent.angly@gmail.com>

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

new

Title    : new
Usage    : my $search = Bio::Tools::AmpliconSearch->new( );
Function : Initialize an amplicon search
Args     : -template       Sequence object for the template sequence. This object
                           will be converted to Bio::Seq if needed in since features
                           (amplicons and primers) will be added to this object.
           -fwd_primer     A sequence object representing the forward primer
           -rev_primer     A sequence object representing the reverse primer
           -primer_file    Read primers from a sequence file. It replaces
                           -fwd_primer and -rev_primer (optional)
           -attach_primers Whether or not to attach primers to Amplicon objects. Default: 0 (off)
Returns  : A Bio::Tools::AmpliconSearch object

template

Title    : template
Usage    : my $template = $search->template;
Function : Get/set the template sequence. Setting a new template resets any
           search in progress.
Args     : Optional Bio::Seq object
Returns  : A Bio::Seq object

fwd_primer

Title    : fwd_primer
Usage    : my $primer = $search->fwd_primer;
Function : Get/set the forward primer. Setting a new forward primer resets any
           search in progress.
Args     : Optional sequence object or primer object or '' to match beginning
           of sequence.            
Returns  : A sequence object or primer object or undef

rev_primer

Title    : rev_primer
Usage    : my $primer = $search->rev_primer;
Function : Get/set the reverse primer. Setting a new reverse primer resets any
           search in progress.
Args     : Optional sequence object or primer object or '' to match end of
           sequence. 
Returns  : A sequence object or primer object or undef

primer_file

Title    : primer_file
Usage    : my ($fwd, $rev) = $search->primer_file;
Function : Get/set a sequence file to read the primer from. The first sequence
           must be the forward primer, and the second is the optional reverse
           primer. After reading the file, the primers are set using fwd_primer()
           and rev_primer() and returned.
Args     : Sequence file
Returns  : Array containing forward and reverse primers as sequence objects.

attach_primers

Title    : attach_primers
Usage    : my $attached = $search->attach_primers;
Function : Get/set whether or not to attach primer objects to the amplicon
           objects.
Args     : Optional integer (1 for yes, 0 for no)
Returns  : Integer (1 for yes, 0 for no)

next_amplicon

Title    : next_amplicon
Usage    : my $amplicon = $search->next_amplicon;
Function : Get the next amplicon
Args     : None
Returns  : A Bio::SeqFeature::Amplicon object

annotate_template

Title    : annotate_template
Usage    : my $template = $search->annotate_template;
Function : Search for all amplicons and attach them to the template.
           This is equivalent to running:
              while (my $amplicon = $self->next_amplicon) {
                 # do something
              }
              my $annotated = $self->template;
Args     : None
Returns  : A Bio::Seq object with attached Bio::SeqFeature::Amplicons (and
           Bio::SeqFeature::Primers if you set -attach_primers to 1).