in reply to Bioinformatics - Scoring DNA mutations

Hello allsop_5, and welcome to the Monastery!

The code as given is imcomplete, as it doesn’t show the declaration and initialization of the variables $string and $shuf_seq. It would be useful if you could provide sample values for these variables, together with the final $score value you expect to generate from these sample values.

One point stands out: in these lines:

$score = scoring($s, $m); $score += $score;

you first overwrite the value of the variable $score, then add this new value to itself (thereby doubling it). Neither of these is what you intend. You need something along these lines:

my $score; foreach (...) { ... my $local_score = scoring($s, $m); $score += $local_score; print $local_score; # (or did you want to print $score here?) }

And BTW: you do begin your script with:

use strict; use warnings;

don’t you?

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,