Bio-Polloc

 view release on metacpan or  search on metacpan

lib/Bio/Polloc/TypingI.pm  view on Meta::CPAN


Use this interface to initialize the Bio::Polloc::Typing::* objects.  Any
rule inherits from this Interface.  Usually, rules are initialized
from files (via the L<Bio::Polloc::TypingIO> package).

=head1 AUTHOR - Luis M. Rodriguez-R

Email lrr at cpan dot org

=head1 IMPLEMENTS OR EXTENDS

=over

=item *

L<Bio::Polloc::Polloc::Root>

=back

=cut

package Bio::Polloc::TypingI;
use strict;
use base qw(Bio::Polloc::Polloc::Root);
use Error qw(:try);
our $VERSION = 1.0503; # [a-version] from Bio::Polloc::Polloc::Version


=head1 APPENDIX

Methods provided by the package

=cut

=head2 new

Attempts to initialize a C<Bio::Polloc::Typing::*> object

B<Arguments>

=over

=item -type I<str>

The typing method.  For further description of the
different type, see:

  Li, W., Raoult, D., & Fournier, P.-E. (2009).
  Bacterial strain typing in the genomic era.
  FEMS Microbiology Reviews, 33(5), 892-916.

L<http://www.mendeley.com/research/bacterial-strain-typing-in-the-genomic-era/>.

One of:

=over

=item bandingPattern

"DNA banding pattern-based methods which classify bacteria
according to the size of fragments generated by amplification
and/or enzymatic digestion of genomic DNA" (Li I<et al> 2009)

=item bandingPattern::amplification

Same of C<bandingPattern>, but specifying fragments generated
B<by amplification>.

=item bandingPattern::restriction

Same of C<bandingPattern>, but specifying fragments generated
B<by enzymatic digestion>.

=item sequencing

"DNA sequencing-based methods, which study the polymorphism of
DNA sequences" (Li I<et al> 2009)

=item hybridization

"DNA hybridization-based methods using nucleotidic probes" (Li
I<et al> 2009)

=back

=item -locigroup I<Bio::Polloc::LociGroup object>

Group of loci (L<Bio::Polloc::LociGroup>) to be use for typing.

=back

B<Returns>

The C<Bio::Polloc::Typing::*> object

B<Throws>

L<Bio::Polloc::Polloc::Error> if unable to initialize the proper object

=cut

sub new {
   my($caller,@args) = @_;
   my $class = ref($caller) || $caller;
   
   # Pre-fix based on type, unless the caller is a proper class
   if($class !~ m/Bio::Polloc::Typing::(\S+)/){
      my $bme = Bio::Polloc::Polloc::Root->new(@args);
      my($type) = $bme->_rearrange([qw(TYPE)], @args);
      
      if($type){
         $type = Bio::Polloc::TypingI->_qualify_type($type);
         $class = "Bio::Polloc::Typing::" . $type if $type;
      }
   }

   # Try to load the object
   if($class =~ m/Bio::Polloc::Typing::(\S+)/){
      if(Bio::Polloc::TypingI->_load_module($class)){;
         my $self = $class->SUPER::new(@args);
	 my($locigroup) = $self->_rearrange([qw(LOCIGROUP)], @args);
	 $self->debug("Got the TypingI class $class ($1)");
	 $self->locigroup($locigroup);
         $self->_initialize(@args);
         return $self;
      }
      my $bme = Bio::Polloc::Polloc::Root->new(@args);
      $bme->throw("Impossible to load the module", $class);
   }

   # Throws exception if any previous return



( run in 1.013 second using v1.01-cache-2.11-cpan-364913b4093 )