BioPerl
view release on metacpan or search on metacpan
Bio/SeqFeature/Primer.pm view on Meta::CPAN
=cut
sub new {
my ($class, %args) = @_;
# Legacy stuff
my $sequence = delete $args{-sequence};
if ($sequence) {
Bio::Root::Root->deprecated(
-message => 'Creating a Bio::SeqFeature::Primer with -sequence is deprecated. Use -seq instead.',
-warn_version => '1.006',
-throw_version => '1.008',
);
$args{-seq} = $sequence;
}
# Initialize Primer object
my $self = $class->SUPER::new(%args);
my ($id) = $self->_rearrange([qw(ID)], %args);
$id && $self->seq->id($id);
$self->primary_tag('Primer');
return $self;
}
# Bypass B::SF::Generic's location() when a string is passed (for compatibility)
sub location {
my ($self, $location) = @_;
if ($location) {
if ( not ref $location ) {
# Use location as a string for backward compatibility
Bio::Root::Root->deprecated(
-message => 'Passing a string to location() is deprecated. Pass a Bio::Location::Simple object or use start() and end() instead.',
-warn_version => '1.006',
-throw_version => '1.008',
);
$self->{'_location'} = $location;
} else {
$self->SUPER::location($location);
}
}
return $self->SUPER::location;
}
=head2 Tm()
Title : Tm()
Usage : my $tm = $primer->Tm(-salt => 0.05, -oligo => 0.0000001);
Function: Calculate 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
(default=0.05 molar).
: -oligo : set the oligo concentration on which to base the
calculation (default=0.00000025 molar).
Notes : Calculation of Tm as per Allawi et. al Biochemistry 1997
36:10581-10594. Also see documentation at
http://www.idtdna.com/Scitools/Scitools.aspx as they use this
formula and have a couple nice help pages. These Tm values will be
about are about 0.5-3 degrees off from those of the idtdna web tool.
I don't know why.
This was suggested by Barry Moore (thanks!). See the discussion on
the bioperl-l with the subject "Bio::SeqFeature::Primer Calculating
the PrimerTM"
=cut
sub Tm {
my ($self, %args) = @_;
my $salt_conc = 0.05; # salt concentration (molar units)
my $oligo_conc = 0.00000025; # oligo concentration (molar units)
if ($args{'-salt'}) {
# Accept object defined salt concentration
$salt_conc = $args{'-salt'};
}
if ($args{'-oligo'}) {
# Accept object defined oligo concentration
$oligo_conc = $args{'-oligo'};
}
my $seqobj = $self->seq();
my $length = $seqobj->length();
my $sequence = uc $seqobj->seq();
my @dinucleotides;
my $enthalpy;
my $entropy;
# Break sequence string into an array of all possible dinucleotides
while ($sequence =~ /(.)(?=(.))/g) {
push @dinucleotides, $1.$2;
}
# Build a hash with the thermodynamic values
my %thermo_values = ('AA' => {'enthalpy' => -7.9,
'entropy' => -22.2},
'AC' => {'enthalpy' => -8.4,
'entropy' => -22.4},
'AG' => {'enthalpy' => -7.8,
'entropy' => -21},
'AT' => {'enthalpy' => -7.2,
'entropy' => -20.4},
'CA' => {'enthalpy' => -8.5,
'entropy' => -22.7},
'CC' => {'enthalpy' => -8,
'entropy' => -19.9},
'CG' => {'enthalpy' => -10.6,
'entropy' => -27.2},
'CT' => {'enthalpy' => -7.8,
'entropy' => -21},
'GA' => {'enthalpy' => -8.2,
'entropy' => -22.2},
'GC' => {'enthalpy' => -9.8,
'entropy' => -24.4},
'GG' => {'enthalpy' => -8,
'entropy' => -19.9},
'GT' => {'enthalpy' => -8.4,
'entropy' => -22.4},
'TA' => {'enthalpy' => -7.2,
'entropy' => -21.3},
'TC' => {'enthalpy' => -8.2,
'entropy' => -22.2},
( run in 0.701 second using v1.01-cache-2.11-cpan-2398b32b56e )