You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I understand, DNA Strings will sometimes have "n" in them, to indicate an unknown base. The way DNA Mutation is set up, currently, it doesn't recognize "n" as a possible base, so if it is encountered during the mutation process, it will likely throw an error. There are two options, I think, for how to handle this, and they're both simple to implement:
If encountered during mutation, an unknown base will be kept unknown. They wouldn't be considered when looking at what bases to mutate, or,
If encountered during mutation, a "n" base will be treated like any other base, and changed to one of the known bases.
For option 1, it could just be a matter of filtering out "n" or "N" when producing the available mutatable positions within the original dnaString:
List<Integer> availablePositions = new ArrayList<>();
for (int i = 0; i < dnaString.length(); i++) {
char base = dnaString.charAt(i);
if (base == 'n' || base == 'N') {
continue; // Skip
}
availablePositions.add(i);
}
For option 2, I think it would just be a matter of adding a little filter to the beginning of the getDifferentBase() method to catch them:
if (originalBase == 'n' || originalBase == 'N') { // Unknown base in original DNA sequence
return BASES[random.nextInt(BASES.length)]; // Randomly choose any known base
}
Which do you think would be the better approach? @VerisimilitudeX
The text was updated successfully, but these errors were encountered:
From what I understand, DNA Strings will sometimes have "n" in them, to indicate an unknown base. The way DNA Mutation is set up, currently, it doesn't recognize "n" as a possible base, so if it is encountered during the mutation process, it will likely throw an error. There are two options, I think, for how to handle this, and they're both simple to implement:
If encountered during mutation, an unknown base will be kept unknown. They wouldn't be considered when looking at what bases to mutate, or,
If encountered during mutation, a "n" base will be treated like any other base, and changed to one of the known bases.
For option 1, it could just be a matter of filtering out "n" or "N" when producing the available mutatable positions within the original dnaString:
For option 2, I think it would just be a matter of adding a little filter to the beginning of the getDifferentBase() method to catch them:
Which do you think would be the better approach? @VerisimilitudeX
The text was updated successfully, but these errors were encountered: