Bio-Polloc

 view release on metacpan or  search on metacpan

lib/Bio/Polloc/Typing/bandingPattern/amplification.pm  view on Meta::CPAN

   my $right_aln  = $locigroup->align_context(1, $self->flanking_size, 0) or return;
   # Consensus
   my $left_cons  = $left_aln->consensus_string($self->primer_conservation);
   my $right_cons = $right_aln->consensus_string($self->primer_conservation);
   # Conserved region
   my $len = $self->primer_size;
   $left_cons  =~ s/^.*?([^?]{$len}).*$/$1/;
   $right_cons =~ s/^.*?([^?]{$len}).*$/$1/;
   return unless length($left_cons)==$len and length($right_cons)==$len;
   # Reverse complement
   my $uprc   = Bio::Seq->new(-seq=>$left_cons )->revcom->seq;
   my $downrc = Bio::Seq->new(-seq=>$right_cons)->revcom->seq;
   # Output file
   my $io = Bio::Polloc::Polloc::IO->new(-createtemp=>1);
   $io->_print("Polloc   $uprc   $downrc\n");
   return $io;
}

=head2 primer_conservation

Gets/sets the minimum conservation of a region to design primers.  1 by default.

=cut

sub primer_conservation {
   my($self, $value) = @_;
   $self->{'_primer_conservation'} = $value+0 if defined $value;
   return 1 unless defined $self->{'_primer_conservation'};
   return $self->{'_primer_conservation'};
}

=head2 primer_size

Gets/sets the primer size.  20 by default.

=cut

sub primer_size {
   my($self, $value) = @_;
   $self->{'_primer_size'} = $value+0 if defined $value;
   return 20 unless defined $self->{'_primer_size'};
   return $self->{'_primer_size'};
}

=head2 flanking_size

Gets/sets the size of the flanking region to take into account for the
primer design.  500 by default.

=cut

sub flanking_size {
   my($self, $value) = @_;
   $self->{'_flanking_size'} = $value+0 if defined $value;
   return 500 unless defined $self->{'_flanking_size'};
   return $self->{'_flanking_size'};
}

=head2 annealing_errors

Gets/sets the maximum percentage of errors allowed for a primer to anneal.
0 by default.

=cut

sub annealing_errors {
   my($self, $value) = @_;
   $self->{'_annealing_errors'} = $value+0 if defined $value;
   return $self->{'_annealing_errors'} || 0;
}

=head1 INTERNAL METHODS

Methods intended to be used only within the scope of Bio::Polloc::*

=head2 _initialize

=head2 _initialize_method

=cut

sub _initialize_method {
   my($self,@args) = @_;
   my($primerConservation, $primerSize, $flankingSize, $annealingErrors) =
   	$self->_rearrange([qw(PRIMERCONSERVATION PRIMERSIZE FLANKINGSIZE ANNEALINGERRORS)], @args);
   $self->type('bandingPattern::amplification');
   $self->primer_conservation($primerConservation);
   $self->primer_size($primerSize);
   $self->flanking_size($flankingSize);
   $self->annealing_errors($annealingErrors);
}

1;



( run in 0.778 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )