CDCgov / SeqSpawnR

Spawn Normally-Distributed Mutant DNA Sequences
https://cdcgov.github.io/SeqSpawnR/
Apache License 2.0
0 stars 1 forks source link

Mismatching Logic #1

Open gmkarl opened 5 years ago

gmkarl commented 5 years ago

Hey,

I'm confused by a line of logic in the code.

On line 49, the code waits until it picks a set of codons that are found within the last sequence: https://github.com/CDCgov/SeqSpawnR/blob/91d5857dbda5998839a002fbecae0f494dca960a/R/SequenceSpawner.R#L48

Then once this check passes, it randomly samples all generated sequences to pick one to replace the sequence in: https://github.com/CDCgov/SeqSpawnR/blob/91d5857dbda5998839a002fbecae0f494dca960a/R/SequenceSpawner.R#L49

This seems to mean that it may not replace anything at all, because it will usually randomly pick a sequence different from the one that matched.

Is this the intended behavior?

AABoyles commented 5 years ago

I tried re-writing this passage once before, and it broke the sequence generation in a way I didn't anticipate or understand. (I didn't write the original logic--I just packaged what was an internal R script in our department.) If you can tweak it such that it continues to generate sequences with the same statistical properties, be my guest!