Bio::SeqFeature
Primer
Summary
Bio::SeqFeature::Primer - Primer Generic SeqFeature
Package variables
No package variables defined.
Included modules
Inherit
Synopsis
# set up a single primer that can be used in a PCR reaction
use Bio::SeqFeature::Primer;
# initiate a primer with raw sequence
my $primer=Bio::SeqFeature::Primer->new(-seq=>'CTTTTCATTCTGACTGCAACG');
# get the primery tag for the primer # should return Primer
my $tag=$primer->primary_tag;
# get or set the location that the primer binds to the target at
$primer->location(500);
my $location=$primer->location(500);
# get or set the 5' end of the primer homology, as the primer doesn't have to be the
# same as the target sequence
$primer->start(2);
my $start=$primer->start;
# get or set the 3' end of the primer homology
$primer->end(19);
my $end = $primer->end;
# get or set the strand of the primer. Strand should be 1, 0, or -1
$primer->strand(-1);
my $strand=$primer->strand;
# get or set the id of the primer
$primer->display_id('test_id');
my $id=$primer->display_id;
# get the tm of the primer. This is calculated for you by the software.
# however, see the docs.
my $tm = $primer->Tm;
print "These are the details of the primer:\n\tTag:\t\t$tag\n\tLocation\t$location\n\tStart:\t\t$start\n";
print "\tEnd:\t\t$end\n\tStrand:\t\t$strand\n\tID:\t\t$id\n\tTm:\t\t$tm\n";
Description
Handle primer sequences. This will allow you to generate a primer
object required for a Bio::Seq::PrimedSeq object. This module is
designed to integrate with Bio::Tools::Primer3 and
Bio::Seq::PrimedSeq.
In addition, you can calculate the melting temperature of the primer.
This module is supposed to implement location and range, presumably
through generic.pm, but does not do so yet. However, it does allow you
to set primers, and use those objects as the basis for
Bio::Seq::PrimedSeq objects.
See also the POD for Bio::Seq::PrimedSeq and
Bio::Tools::Nucleotide::Analysis::Primer3
Methods
Methods description
Title : new()
Usage : $primer = Bio::SeqFeature::Primer(-seq=>sequence_object);
Function: Instantiate a new object
Returns : A SeqPrimer object
Args : You must pass either a sequence object (preferable) or a sequence. |
Title : seq()
Usage : $seq = $primer->seq();
Function: Return the sequence associated with this Primer.
Returns : A Bio::Seq object
Args : None. |
Title : source_tag()
Usage : $tag = $feature->source_tag();
Function: Returns the source of this tag.
Returns : A string.
Args : If an argument is provided, the source of this SeqFeature
is set to that argument. |
Title : location()
Usage : $tag = $primer->location();
Function: Gets or sets the location of the primer on the sequence
Returns : If the location is set, returns that, if not returns 0.
Note: At the moment I am using the primer3 notation of location
(although you can set whatever you want).
In this form, both primers are given from their 5' ends and a length.
In this case, the left primer is given from the leftmost end, but
the right primer is given from the rightmost end.
You can use start() and end() to get the leftmost and rightmost base
of each sequence.
Args : If supplied will set a location |
Title : start()
Usage : $start_position = $primer->start($new_position);
Function: Return the start position of this Primer.
This is the leftmost base, regardless of whether it is a left or right primer.
Returns : The start position of this primer or 0 if not set.
Args : If supplied will set a start position. |
Title : end()
Usage : $end_position = $primer->end($new_position);
Function: Return the end position of this primer.
This is the rightmost base, regardless of whether it is a left or right primer.
Returns : The end position of this primer.
Args : If supplied will set an end position. |
Title : strand()
Usage : $strand=$primer->strand()
Function: Get or set the strand.
Returns : The strand that the primer binds to.
Args : If an argument is supplied will set the strand, otherwise will return it. Should be 1, 0 (not set), or -1 |
Title : display_id()
Usage : $id = $primer->display_id($new_id)
Function: Returns the display ID for this Primer feature
Returns : A scalar.
Args : If an argument is provided, the display_id of this primer is set to that value. |
Title : Tm()
Usage : $tm = $primer->Tm(-salt=>'0.05')
Function: Calculates and returns the Tm (melting temperature) of the primer
Returns : A scalar containing the Tm.
Args : -salt set the Na+ concentration on which to base the calculation.
Notes : This Tm calculations are taken from the Primer3 docs: They are
based on Bolton and McCarthy, PNAS 84:1390 (1962)
as presented in Sambrook, Fritsch and Maniatis,
Molecular Cloning, p 11.46 (1989, CSHL Press).
Tm = 81.5 + 16.6(log10([Na+])) + .41*(%GC) - 600/length
where [Na+] is the molar sodium concentration, %GC is the
%G+C of the sequence, and length is the length of the sequence.
However.... I can never get this calculation to give me the same result
as primer3 does. Don't ask why, I never figured it out. But I did
want to include a Tm calculation here becuase I use these modules for
other things besides reading primer3 output.
The primer3 calculation is saved as 'PRIMER_LEFT_TM' or 'PRIMER_RIGHT_TM'
and this calculation is saved as $primer->Tm so you can get both and
average them! |
Methods code
BEGIN { @RES=qw();
foreach my $attr (@RES) {$OK_FIELD{$attr}++ } |
sub AUTOLOAD
{ my $self = shift;
my $attr = $AUTOLOAD;
$attr =~ s/.*:://;
$self->throw("Unallowed parameter: $attr !") unless $OK_FIELD{$attr};
$self->{$attr} = shift if @_;
return $self->{$attr};} |
sub new
{
my ($class, %args) = @_;
my $self = $class->SUPER::new(%args);
foreach my $argument (keys %args) {
if ($argument eq "-SEQUENCE" || $argument eq "-sequence" || $argument eq "-seq") {
if (ref($args{$argument}) eq "Bio::Seq") {$self->{seq} = $args{$argument}}
else {
unless ($args{-id}) {$args{-id}="SeqFeature Primer object"}
$self->{seq} = new Bio::Seq( -seq => $args{$argument}, -id => $args{-id});
}
$self->{$argument} = $self->{seq};
push (@{$self->{arguments}}, "seq");
}
else {
$self->{$argument} = $args{$argument};
push (@{$self->{arguments}}, $argument); }
}
if (!$self->{seq}) {$self->throw("You must pass in a sequence to construct this object.")}
$self->Tm();
return $self; } |
sub seq
{ my $self = shift;
return $self->{seq};} |
sub primary_tag
{ return "Primer"; } |
sub source_tag
{ my ($self,$insource) = @_;
if ($insource) { $self->{source} = $insource; }
return $self->{source};} |
sub location
{ my ($self, $location) = @_;
if ($location) {$self->{location}=$location}
if ($self->{location}) {return $self->{location}}
else {return 0}} |
sub start
{ my ($self,$start) = @_;
if ($start) {$self->{start_position} = $start}
if ($self->{start_position}) {return $self->{start_position}}
else {return 0}} |
sub end
{ my ($self,$end) = @_;
if ($end) {$self->{end_position} = $end}
if ($self->{end_position}) {return $self->{end_position}}
else {return 0}} |
sub strand
{ my ($self, $strand) = @_;
if ($strand) {
unless ($strand == -1 || $strand == 0 ||$strand == 1) {$self->throw("Strand must be either 1, 0, or -1 not $strand")}
$self->{strand}=$strand;
}
if ($self->{strand}) {return $self->{strand}}
else {return 0}} |
sub display_id
{ my ($self,$newid) = @_;
if ($newid) {$self->seq()->display_id($newid)}
return $self->seq()->display_id();} |
sub Tm
{
my ($self, %args) = @_;
my $salt=0.2;
if ($args{'-salt'}) {$salt=$args{'-salt'}}
my $seqobj=$self->seq();
my $length=$seqobj->length();
my $seqdata = Bio::Tools::SeqStats->count_monomers($seqobj);
my $gc=$$seqdata{'G'} + $$seqdata{'C'};
my $percent_gc=($gc/$length)*100;
my $tm= 81.5+(16.6*(log($salt)/log(10)))+(0.41*$percent_gc) - (600/$length);
$self->{'Tm'}=$tm;
return $tm; } |
General documentation
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
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/
The rest of the documentation details each of the object
methods. Internal methods are usually preceded with a _