base pair distribution and randomly? mutate the sequence 10-20 times to find the similarilty between the mutated and the original DNA sequence by calculating an adhoc score? If it is a purine to purine then the score is +2, pyrimidine to pyrimidine +2, purine to pyrimidine or vice versa -1, and no change =0
This is what I have so far:
use strict;
use warnings;
my $sequence='A G G G C A C C T C T C A G T T C T C A T T C T A A C A C C A C
A T A A T T';
my $i;
my $mutant;
# time|$$ combines the current time with the current process id
srand(time|$$);
$mutant = mutate_DNA($sequence);
print "\nMutate DNA\n\n";
print "\nHere is the original DNA sequence:\n\n";
print "$sequence\n";
print "\nHere is the mutated DNA:\n\n";
print "$mutant\n";
exit;
sub mutate_DNA{
my($dna) = @_;
my (@nucleotides)=('A', 'C', 'G', 'T');
# Pick a random position in the DNA
my($position) = randomposition($dna);
#Pick a random nucleotide
my ($newbase)=randomnucleotide(@nucleotides);
substr ($dna, $position, 1, $newbase);
return $dna;
}
sub randomelement{
my(@array) = @_;
return $array[rand @array];
}
sub randomnucleotide{
my(@nucs) = ('A','C','G','T');
return $nucs[rand @nucs];
}
sub randomposition{
my($string) = @_;
return int (rand(length($string)));
}
This is what I have so far:
use strict;
use warnings;
my $sequence='A G G G C A C C T C T C A G T T C T C A T T C T A A C A C C A C
A T A A T T';
my $i;
my $mutant;
# time|$$ combines the current time with the current process id
srand(time|$$);
$mutant = mutate_DNA($sequence);
print "\nMutate DNA\n\n";
print "\nHere is the original DNA sequence:\n\n";
print "$sequence\n";
print "\nHere is the mutated DNA:\n\n";
print "$mutant\n";
exit;
sub mutate_DNA{
my($dna) = @_;
my (@nucleotides)=('A', 'C', 'G', 'T');
# Pick a random position in the DNA
my($position) = randomposition($dna);
#Pick a random nucleotide
my ($newbase)=randomnucleotide(@nucleotides);
substr ($dna, $position, 1, $newbase);
return $dna;
}
sub randomelement{
my(@array) = @_;
return $array[rand @array];
}
sub randomnucleotide{
my(@nucs) = ('A','C','G','T');
return $nucs[rand @nucs];
}
sub randomposition{
my($string) = @_;
return int (rand(length($string)));
}