AI::Gene::Simple

AI::Gene::Simple is a base Perl class for storing and mutating genetic sequences.
Download

AI::Gene::Simple Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Alex Gough
  • Publisher web site:
  • http://search.cpan.org/~ajgough/Data-Dimensions-0.04/lib/Data/Dimensions.pm

AI::Gene::Simple Tags


AI::Gene::Simple Description

AI::Gene::Simple is a base Perl class for storing and mutating genetic sequences. AI::Gene::Simple is a base Perl class for storing and mutating genetic sequences.SYNOPSIS package Somegene; use AI::Gene::Simple; our @ISA = qw (AI::Gene::Simple); sub generate_token { my $self = shift; my $prev = $_ ? $_ + (1-rand(1)) : rand(1)*10; return $prev; } sub calculate { my $self = shift; my $x = $_; my $rt=0; for (0..(scalar(@{$self->}) -1)) { $rt += $self-> * ($x ** $_); } return $rt; } sub seed { my $self = shift; $self-> = rand(1) * 10 for (0..$_); return $self; } # ... then elsewhere package main; my $gene = Somegene->new; $gene->seed(5); print $gene->calculate(2), "n"; $gene->mutate_minor; print $gene->calculate(2), "n"; $gene->mutate_major; print $gene->calculate(2), "n";This is a class which provides generic methods for the creation and mutation of genetic sequences. Various mutations are provided but the resulting mutations are not checked for a correct syntax. These classes are suitable for genes where it is only necessary to know what lies at a given position in a gene. If you need to ensure a gene maintains a sensible grammar, then you should use the AI::Gene::Sequence class instead, the interfaces are the same though so you will only need to modify your overiding classes if you need to switch from one to the other.A suitable use for this module might be a series of coefficients in a polynomial expansion or notes to be played in a musical score.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.Requirements:· Perl Requirements: · Perl


AI::Gene::Simple Related Software