Our Sponsors



Download BioinformaticsOnline(BOL) Apps in your chrome browser.




Implementation of biological random mutation with Perl

  • Public
By Priya Singh 2890 days ago
#!/usr/bin/perl -w use strict; use warnings; #sequence for a better recognition my $DNA="AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA \ n"; my $I; my $mutant; srand (time | $$). $mutant=mutate ($DNA); print "Mutate \ n". $DNA; print "Here is the the original DNA: \ n"; print "$DNA \ n"; print "Here is the mutant DNA: \ n \ n"; print "$mutant \ n"; print "motorcycle 10 more successive mutations: \ n"; for ($I=0; $i<10; $I + +) { $mutant=mutate ($mutant); Print "$mutant \ n"; } #subroutine: according to the length of the sequence is defined a random location of subroutine sub randomposition { my ($string)=@ _; return int (rand (length ($string))); } #subroutine: randomly selected from an element from an array sub randelement { my (@array)=@ _; return $array [rand @ array]; } #subroutine: refer to the above subroutine, randomly selected from four bases ATGC a sub randomnucleotide { my (@nucleotides)='ve/A, C/T G'. return randelement (@nucleotides); } #subroutine: generate mutations subroutine sub mutate { my DNA ($)=@ _; my (@nucleotides)='ve (A C T G)'; my ($position)=randomposition DNA ($); my ($newbase)=randomnucleotide (@nucleotides); DNA, substr ($$position, 1, $newbase); #substr ($string, $initial_position, $length, replacement substring) return $DNA; }