#!/usr/bin/perl -w
use strict;

# randomize 10% of nucleotides

my @nucleotides = ( 'A', 'C', 'G', 'T' );

while ( my $DNA = <> ) {
	chomp( $DNA );
	my $DNA_length = length( $DNA );
	warn "DNA has $DNA_length nucleotides\n";
	my $mutations = int( $DNA_length / 10 );
	warn "We will perform $mutations mutations\n";
	my @mutated_DNA = split( //, $DNA );
	for ( 1 .. $mutations ) {
		my $mutation_position = int( rand( $DNA_length ) );
		my $random_position = int( rand( $#nucleotides ) );
		my $random_nucleotide = $nucleotides[ $random_position ];
		$mutated_DNA[ $mutation_position ] = $random_nucleotide;
		warn "mutation on $mutation_position to $random_nucleotide\n";
	}
	warn "$DNA\n";
	print join('', @mutated_DNA),"\n";
}
