Bio::S...imedSeq(3pm)

πŸ“¦
version 1.7.8 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– NAME πŸ’–

Okay so this page is the Bio::S...imedSeq(3pm) manpage (yeah the title's truncated, the terminal did that, iykyk ✨) and what it's actually about is Bio::Seq::PrimedSeq β€” a sequence plus a pair of primers that match on it. That's it, that's the whole vibe πŸ§¬πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

Bestie, here's the whole flow, verbatim, no cap:

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

my $template = Bio::Seq->new( -seq => 'AGCTTTTCATTCTGACTGCAAC' );
my $left     = Bio::Seq->new( -seq => 'AGCT' );
my $right    = Bio::Seq->new( -seq => 'GTTGC' );

my $primedseq = Bio::Seq::PrimedSeq->new(
        -seq          => $template,  # sequence object
        -left_primer  => $left,      # sequence or primer object
        -right_primer => $right      # sequence or primer object
);

# Get the primers as Bio::SeqFeature::Primer objects
my @primer_objects = $primedseq->get_primer();

# Sequence object representing the PCR product, i.e. the section of the target
# sequence contained between the primers (primers included)
my $amplicon_seq = $primedseq->amplicon();

print 'Got amplicon sequence: '.$amplicon_seq->seq."\n";
# Amplicon should be: agctTTTCATTCTGACTgcaac

Periodt. That's the entire personality of the module in one script πŸ’…


🌸 DESCRIPTION 🌸

So basically this module exists because a primer is more than a SeqFeature, and because we needed a way to represent the whole primer–sequence complex and all the attributes that come with that complex. Main character energy for the primer, fr fr.

A PrimedSeq object gets initialized with a target sequence and two primers. Where the primers land on the target sequence gets calculated if it needs to be, so you can then grab the PCR product β€” the amplicon sequence. And from the PrimedSeq object you can also pull info like melting temperatures and what not, on each of the primers and on the amplicon too. Shoutout to Bio::Tools::Primer3, which uses PrimedSeq objects extensively. Iconic behaviour πŸ‘‘

⚠️ Okay real talk though, super important: this module does not simulate PCR. It assumes the primers will match in a single location on the target sequence, and it does not understand degenerate primers. That's the boundary, bestie, don't come for me 😭

πŸ’œ Providing primers as sequence objects

If the primers are specified as sequence objects β€” like Bio::PrimarySeq or Bio::Seq β€” they get converted to Bio::SeqFeature::Primer objects first. Then their location on the target sequence is calculated and added to those Bio::SeqFeature::Primer objects, which you can retrieve with the get_primer() method. Cute, right? πŸŽ€

πŸ’œ Providing primers as primer objects

Because of the limitations of specifying primers as sequence objects, the recommended method is to hand over Bio::SeqFeature::Primer objects. And if you didn't record the location of the primers in the primer object, no worries β€” it will be calculated for you ✨

Also, fun origin story: Bio::Seq::PrimedSeq was initially started by Chad Matsalla, and later improved on by Rob Edwards. Team effort, we love to see it 🫢


πŸŽ€ RECIPES πŸŽ€

1. Run Primer3 to get PrimedSeq objects:

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

# Read a target sequences from a FASTA file
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 $primer3 = Bio::Tools::Run::Primer3->new(-seq => $seq);
my $results = $primer3->run; # default parameters

# Write all the results in a Genbank file
my $seqout = Bio::SeqIO->new(-file => ">primed_sequence.gbk",
                             -format => 'genbank');
while (my $primedseq = $results->next_primer) {
   $seqout->write_seq( $primedseq->annotated_seq );
}

2. Create a genbank file for a sequence and its cognate primers:

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

# Read a FASTA file that contains the target sequence and its two primers
my $file = shift || die "$0 <file>";
my $seqin = Bio::SeqIO->new(-file => $file);
my ($template, $leftprimer, $rightprimer) =
      ($seqin->next_seq, $seqin->next_seq, $seqin->next_seq);

# Set up a PrimedSeq object
my $primedseq = Bio::Seq::PrimedSeq->new(-seq => $template,
                                         -left_primer => $leftprimer,
                                         -right_primer => $rightprimer);

# Write the sequences in an output Genbank file
my $seqout = Bio::SeqIO->new(-file => ">primed_sequence.gbk",
                             -format => 'genbank');
$seqout->write_seq($primedseq->annotated_sequence);

Two recipes, both absolute bangers πŸ”₯ Copy, paste, go off.


🫢 FEEDBACK 🫢

User feedback is an integral part of the evolution of this and other Bioperl modules β€” like, genuinely, your input matters. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated, fr fr πŸ’–

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 πŸ‘‘

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 _ β€” that underscore is their little "do not touch, bestie" marker πŸ™ˆ

✨ new

Title   : new()
Usage   : my $primedseq = Bio::SeqFeature::Primer->new(
                           -seq => $sequence,
                           -left_primer => $left_primer,
                           -right_primer => $right_primer
          );
Function: Construct a primed sequence.
Returns : A Bio::Seq::PrimedSeq object
Args    :  -seq => a Bio::Seq object (required)
           -left_primer => a Bio::SeqFeature::Primer or sequence object (required)
           -right_primer => a Bio::SeqFeature::Primer or sequence object (required)

          If you pass a sequence object to specify a primer, it will be used to
          construct a Bio::SeqFeature::Primer that you can retrieve with the
          L<get_primer> method.

          Many other parameters can be included including all of the output
          parameters from the primer3 program (see L<Bio::Tools::Primer3>). At
          the moment these parameters will simply be stored and do anything.

So yeah: -seq, -left_primer and -right_primer are all required β€” no skipping, that's the vibe check βœ… And note the little L<get_primer> and L<Bio::Tools::Primer3> cross-references if you wanna go down the rabbit hole πŸ‡

✨ get_primer

Title   : get_primer();
Usage   :  my @primers = $primedseq->get_primer();
             or
           my $primer = $primedseq->get_primer('-left_primer');
Function: Get the primers associated with the PrimedSeq object.
Returns : A Bio::SeqFeature::Primer object
Args    : For the left primer, use: l, left, left_primer or -left_primer
          For the right primer, use: r, right, right_primer or -right_primer
          For both primers [default], use: b, both, both_primers or -both_primers

Lowkey the most forgiving API ever β€” you can call the left one l, left, left_primer or -left_primer, the right one r, right, right_primer or -right_primer, and both (the default!) with b, both, both_primers or -both_primers. Pick your fighter πŸ’…

✨ annotated_sequence

Title   : annotated_sequence
Usage   : my $annotated_sequence_object = $primedseq->annotate_sequence();
Function: Get an annotated sequence object containing 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.

Pro tip from the manpage itself: use this one when you wanna write a sequence object out, like in GenBank format β€” check the example above ⬆️ And heads up, it returns 0 if it's not defined.

✨ amplicon

Title   : amplicon
Usage   : my $amplicon = $primedseq->amplicon();
Function: Retrieve the amplicon as a sequence object. The amplicon sequnce is
          only the section of the target sequence between the primer matches
          (primers included).
Returns : A Bio::Seq object. To get the sequence use $amplicon->seq
Args    : None
Note    :

That's your PCR product right there 🧬 β€” the section of the target sequence between the primer matches, primers included, wrapped up as a Bio::Seq object. Grab the actual letters with $amplicon->seq πŸ“

✨ 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    :

Same energy, but for the target sequence itself. Use $seqobj->seq for the raw sequence 🌸

✨ _place_primers

Title   : _place_primers
Usage   : $self->_place_primers();
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

Underscore squad 🚫 β€” internal use only, bestie, don't @ it. It places the primers on the sequence and sets up the ranges of the sequences, and returns nothing. That's all the tea β˜•


And that's a wrap on Bio::S...imedSeq(3pm) πŸ’– This page came to you from perl v5.32.1, dated 2021-08-15, under the Bio::S...imedSeq(3pm) banner β€” so go forth, prime your sequences, and slay πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from