AI::Gene::Sequence

A base class for storing and mutating genetic sequences
Download

AI::Gene::Sequence Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Publisher Name:
  • Alex Gough
  • Publisher web site:
  • http://search.cpan.org/~ajgough/

AI::Gene::Sequence Tags


AI::Gene::Sequence Description

A base class for storing and mutating genetic sequences AI::Gene::Sequence is a Perl class which provides generic methods for the creation and mutation of genetic sequences. Various mutations are provided as is a way to ensure that genes created by mutations remain useful (for instance, if a gene gives rise to code, it can be tested for correct syntax).If you do not need to keep check on what sort of thing is currently occupying a slot in the gene, you would be better off using the AI::Gene::Simple class instead as this will be somewhat faster. The interface to the mutations is the same though, so if you need to change in future, then it will not be too painful.This module should not be confused with the bioperl modules which are used to analyse DNA sequences.It is intended that the methods in this code are inherited by other modules.SYNOPSIS package Somegene; use AI::Gene::Sequence; our @ISA = qw(AI::Gene::Sequence); my %things = ( a => , b => ,); sub generate_token { my $self = shift; my ($type, $prev) = @_; if ($type) { $prev = ${ $things{$type} }; } else { $type = ('a','b'); $prev = ${$things{$type}}; } return ($type, $prev); } sub valid_gene { my $self = shift; return 0 if $_ =~ /(.)\1/; return 1; } sub seed { my $self = shift; $self-> = 'ababab'; @{$self->} = qw(A1 B1 A2 B2 A3 B3); } sub render { my $self = shift; return join(' ', @{$self->}); } # elsewhere package main; my $gene = Somegene->new; $gene->seed; print $gene->render, "\n"; $gene->mutate(5); print $gene->render, "\n"; $gene->mutate(5); print $gene->render, "\n"; Requirements: · Perl


AI::Gene::Sequence Related Software