Hello, I need help to fix a perl script that obtains a DNA file with a FASTA sequence and randomly shuffle the sequence while maintaining the overall distribution of bases. I must also randomly shuffle the sequence 10-20 times.
Then measure the similarity between the shuffled sequence versus the original sequence by scoring. (z-scores).
Scoring criteria:
If a purine was mutated to a purine, or a pyrimidine to a pyrimidine assign a value of +1 to that base pair. If a purine was mutated to a pyrimidine or vice versa assign a value of -1 to that base pair. If the base pair did not change assign 0 .e.g.
Here is what is giving me the issue in the script ( I think):
(@sequence contains the FASTA sequence by the way)
random_int(10, 20);
print "$x\n";
@sequence_shuffle = shufflearray(@sequence);
#subroutine that randomly shuffles the sequence in the file as many times as $x and takes the sequence as an argument.
sub shufflearray {
my (@sequence) = @_;
for (my $i = 0; $i < $length; $i++) {
my $j = $x;
my $tmp = $sequence[$i];
$sequence[$i] = $sequence[$j];
$sequence[$j] = $sequence[$i];
}
return "@sequence\n";