@nucleotides=('A','T','G','C'); foreach(1..1000) { $seq1.=$nucleotides[int(rand(3))]; } foreach(1..1000) { $seq2.=$nucleotides[int(rand(3))]; }
You are only using the first three elements of the array @nucleotides. The proper way to do that is:
my @nucleotides = qw( A T G C ); foreach ( 1 .. 1_000 ) { $seq1 .= $nucleotides[ rand @nucleotides ]; $seq2 .= $nucleotides[ rand @nucleotides ]; }
@seq1=split('',$seq1); foreach(1..$window_size) { shift@seq1; } @seq2=split('',$seq2); foreach(1..$window_size) { shift@seq2; }
The usual way to do that is:
my @seq1 = split //, $seq1; splice @seq1, 0, $window_size; my @seq2 = split //, $seq2; splice @seq2, 0, $window_size;
open(OUT,">ID_matrix.txt");
You should always verify that open worked correctly:
open OUT, '>', 'ID_matrix.txt' or die "Cannot open 'ID_matrix.txt' bec +ause: $!";
In reply to Re: Speed up DNA dotplot
by jwkrahn
in thread Speed up DNA dotplot
by Microcebus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |