Bio::Seq::PrimedSeq(3)

NAME
Bio::Seq::PrimedSeq - A representation of a sequence and two primers flanking a
  target region for amplification

SYNOPSIS # The easiest way to use this is probably as one of the following: # (i) to get the output from Bio::Tools::Run::Primer3, Bio::Tools::Primer3, # or Bio::Tools::PCRSimulation
  #    For example, start with a fasta file

      use Bio::SeqIO;
      use Bio::Tools::Run::Primer3;

      my $file = shift || die "need a file to read";
      my $seqin = Bio::SeqIO->new(-file=>$file);
      my $seq = $seqin->next_seq;
      # use primer3 to design some primers
      my $primer3run = Bio::Tools::Run::Primer3->new(-seq=>$seq);
      $primer3run -> run; # we'll just run it with the default parameters

      # create a file to write the results to
      my $seqout=Bio::SeqIO->new(-file=>">primed_sequence.gbk", -format=>'genbank');

      # now just get all the results and write them out.
      while (my $results=$primer3run->next_primer) {
       $seqout->write_seq($results->annotated_seq);
      }

   #(ii) to create a genbank file for a sequence and its cognate primers

     #For example:

     use Bio::SeqIO;
     use Bio::Seq::PrimedSeq;

     # have a sequence file ($file) with the template, and two primers
     # that match it, in fasta format

     my $file=shift || die "$0 <file>";
     my $seqin=new Bio::SeqIO(-file=>$file);

     # read three sequences
     my ($template, $leftprimer, $rightprimer) =
           ($seqin->next_seq, $seqin->next_seq, , $seqin->next_seq);
     # set up the primed sequence object
     my $primedseq = Bio::Seq::PrimedSeq->new(-seq=>$template,
                                              -left_primer=>$leftprimer,
                                              -right_primer=>$rightprimer);
     # open a file for output
     my $seqout=Bio::SeqIO->new(-file=>">primed_sequence.gbk",
                                -format=>'genbank');
     # print the sequence out
     $seqout->write_seq($primedseq->annotated_sequence);

  # This should output a genbank file with the two primers labeled.

DESCRIPTION
This module is a slightly glorified capsule containg a primed sequence. It was created to address the fact that a primer is more the a seqfeature and there need to be ways to represent the primer-sequence complex and the behaviors and attributes that are associated with the complex.

The primers are represented as Bio::SeqFeature::Primer objects, and should be instatiated first.

The simplest way to initiate a PrimedSeq object is as follows:

  my $primedseq=Bio::Seq::PrimedSeq->new(
  -seq=>Bio::Seq object,
  -left_primer=>Bio::SeqFeature::Primer object,
  -right_primer=>Bio::SeqFeature::Primer object,
  );

From the PrimedSeq object you should be able to retrieve information about Tm's and what not of each of the primers and the amplicon.

This is based on the PrimedSeq.pm module started by Chad Matsalla, with additions/improvements by Rob Edwards.

FEEDBACK
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://bio.perl.org/MailList.html             - About the mailing lists

  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 email or the web:

    bioperl-bugs@bio.perl.org
    http://bugzilla.bioperl.org/

AUTHOR
Rob Edwards, redwards@utmem.edu

Based on a module written by Chad Matsalla, bioinformatics1@dieselwurks.com

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

  new
 Title   : new()
 Usage   : $primed_sequence = new Bio::SeqFeature::Primer( -seq => $sequence,
                                                            -left_primer => $left_primer,
                                                            -right_primer => $right_primer);
 Function: A constructor for an object representing a primed sequence
 Returns : A Bio::Seq::PrimedSeq object
 Args    :
     -target_sequence => a Bio::Seq object (required)
     -left_primer => a Bio::SeqFeature::Primer object (required)
     -right_primer => a Bio::SeqFeature::Primer object (required)

     Many other parameters can be included including all of the output
     parameters from the primer3 program. At the moment some of these
     parameters (most...) will not do anything.

  get_primer
 Title   : get_primer();
 Usage   : $primer = $primedseq->get_primer(l, left, left_primer, -left_primer); to return the left primer
           or
           $primer = $primedseq->get_primer(r, right, right_primer, -right_primer); to return the right primer
           or
           $primer = $primedseq->get_primer(b, both, both_primers, -both_primers); to return the left primer, right primer array
 Function: A getter for the left primer in thie PrimedSeq object.
 Returns : A Bio::SeqFeature::Primer object
 Args    : Either of (l, left, left_primer, -left_primer) to get left primer.
           Either of (r, right, right_primer, -right_primer) to get right primer
           Either of (b, both, both_primers, -both_primers) to get both primers. Note that this is plural.

  annotated_sequence
 Title   : annotated_sequence
 Usage   : $annotated_sequence_object = $primedseq->annotated_sequence()
 Function: Get an annotated sequence object containg the left and right primers
 Returns : An annotated sequence object or 0 if not defined.
 Args    :
 Note    : Use this method to return a sequence object that you can write out (e.g. in GenBank format)
           See the example above.

  amplicon
 Title   : amplicon
 Usage   : my $amplicon = $primedseq->amplicon()
 Function: Retrieve the amplicon as a sequence object
 Returns : A seq object. To get the sequence use $amplicon->seq
 Args    : None
 Note    :

  seq
 Title   : seq
 Usage   : my $seqobj = $primedseq->seq()
 Function: Retrieve the target sequence as a sequence object
 Returns : A seq object. To get the sequence use $seqobj->seq
 Args    : None
 Note    :

  _place_seqs
 Title   : _place_seqs
 Usage   : $self->_place_seqs()
 Function: An internal method to place the primers on the sequence, and set up the ranges of the sequences
 Returns : Nothing
 Args    : None
 Note    : Internal use only

  _set_seqfeature
 Title   : _set_seqfeature
 Usage   : $self->_set_seqfeature()
 Function: An internal method to create Bio::SeqFeature::Generic objects for the primed seq
 Returns : Nothing
 Args    : None
 Note    : Internal use only. Should only call this once left and right primers have been placed on the sequence
           This will then set them as sequence features so hopefully we can get a nice output with write_seq