| Summary | Included libraries | Package variables | Synopsis | Description | General documentation | Methods |
| WebCvs |
# 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 primary tag for the primer. This is always 'Primer'. my $tag = $primer->primary_tag; # Get or set the start and end of the primer match on the template $primer->start(2); my $start = $primer->start; $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; # Calculate the Tm (melting temperature) for the primer 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";
| new | Description | Code |
| seq | Description | Code |
| primary_tag | Description | Code |
| source_tag | Description | Code |
| location | Description | Code |
| start | Description | Code |
| end | Description | Code |
| strand | Description | Code |
| display_id | Description | Code |
| Tm | Description | Code |
| Tm_estimate | Description | Code |
| new() | code | next | Top |
Title : new() |
| seq() | code | prev | next | Top |
Title : seq() |
| primary_tag() | code | prev | next | Top |
Title : primary_tag() |
| source_tag() | code | prev | next | Top |
Title : source_tag() |
| location() | code | prev | next | Top |
Title : location() |
| start() | code | prev | next | Top |
Title : start() |
| end() | code | prev | next | Top |
Title : end() |
| strand() | code | prev | next | Top |
Title : strand() |
| display_id() | code | prev | next | Top |
Title : display_id() |
| Tm() | code | prev | next | Top |
Title : Tm() |
| Tm_estimate | code | prev | next | Top |
Title : Tm_estimate |
| new | description | prev | next | Top |
my ($class, %args) = @_; my $self = $class->SUPER::new(%args); # Set the display ID}
my $id = delete $args{'-id'} || 'SeqFeature Primer object'; # Set the primer sequence
my $seq = delete $args{'-seq'} || delete $args{'-sequence'} || $self->throw("Need to provide a sequence during Primer object construction\n"); if (not ref $seq) { $seq = Bio::Seq->new( -seq => $seq, -id => $id ); } else { if (not $seq->isa('Bio::PrimarySeqI')) { $self->throw("Expected a sequence object but got a [".ref($seq)."]\n"); } } $self->{seq} = $seq; # Save arbitrary parameters like:
# TARGET=513,26
# PRIMER_FIRST_BASE_INDEX=1
# PRIMER_LEFT=484,20
while (my ($arg, $val) = each %args) { $self->{$arg} = $val; } return $self;
| seq | description | prev | next | Top |
my $self = shift; return $self->{seq};}
| primary_tag | description | prev | next | Top |
return 'Primer';}
| source_tag | description | prev | next | Top |
my ($self, $insource) = @_; if ($insource) { $self->{source} = $insource; } return $self->{source};}
| location | description | prev | next | Top |
my ($self, $location) = @_; if ($location) { $self->{location} = $location; } return $self->{location} || 0;}
| start | description | prev | next | Top |
my ($self, $start) = @_; if ($start) { $self->{start_position} = $start; } return $self->{start_position} || 0;}
| end | description | prev | next | Top |
my ($self, $end) = @_; if ($end) { $self->{end_position} = $end; } return $self->{end_position} || 0;}
| strand | description | prev | next | Top |
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; } return $self->{strand} || 0;}
| display_id | description | prev | next | Top |
my ($self, $newid) = @_; if ($newid) { $self->seq()->display_id($newid); } return $self->seq()->display_id();}
| Tm | description | prev | next | Top |
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}, 'TG' => {'enthalpy' => -8.5, 'entropy' => -22.7}, 'TT' => {'enthalpy' => -7.9, 'entropy' => -22.2}, 'A' => {'enthalpy' => 2.3, 'entropy' => 4.1}, 'C' => {'enthalpy' => 0.1, 'entropy' => -2.8}, 'G' => {'enthalpy' => 0.1, 'entropy' => -2.8}, 'T' => {'enthalpy' => 2.3, 'entropy' => 4.1} ); # Loop through dinucleotides and calculate cumulative enthalpy and entropy values
for (@dinucleotides) { $enthalpy += $thermo_values{$_}{enthalpy}; $entropy += $thermo_values{$_}{entropy}; } # Account for initiation parameters
$enthalpy += $thermo_values{substr($sequence, 0, 1)}{enthalpy}; $entropy += $thermo_values{substr($sequence, 0, 1)}{entropy}; $enthalpy += $thermo_values{substr($sequence, -1, 1)}{enthalpy}; $entropy += $thermo_values{substr($sequence, -1, 1)}{entropy}; # Symmetry correction
$entropy -= 1.4; my $r = 1.987; # molar gas constant
my $tm = $enthalpy * 1000 / ($entropy + ($r * log($oligo_conc))) - 273.15 + (12* (log($salt_conc)/log(10))); return $tm;
| Tm_estimate | description | prev | next | Top |
# This should probably be put into seqstats as it is more generic, but what the heck.
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);
# and now error check compared to primer3
# note that this NEVER gives me the same values, so I am ignoring it
# you can get these out separately anyway
#if ($self->{'PRIMER_LEFT_TM'}) {
# unless ($self->{'PRIMER_LEFT_TM'} == $tm) {
# $self->warn("Calculated $tm for Left primer but received ".$self->{'PRIMER_LEFT_TM'}." from primer3\n");
# }
#}
#elsif ($self->{'PRIMER_RIGHT_TM'}) {
# unless ($self->{'PRIMER_RIGHT_TM'} == $tm) {
# $self->warn("Calculated $tm for Right primer but received ".$self->{'PRIMER_RIGHT_TM'}." from primer3\n");
# }
#}
return $tm;
}
1;}| FEEDBACK | Top |
| Mailing Lists | Top |
bioperl-l@bioperl.org - General discussion
http://bioperl.org/wiki/Mailing_lists - About the mailing lists
| Support | Top |
| Reporting Bugs | Top |
https://redmine.open-bio.org/projects/bioperl/
| AUTHOR | Top |
| APPENDIX | Top |