Currently, if you have a protein that could be DNA or RNA all the way until the last few elements, you end up re-scanning the whole input several times before parsing as a protein.
I reckon it would be faster to do everything in a single pass, with a stack of possible alphabets being eliminated as the sequence is traversed. The top alphabet surviving on that priority stack would be the assigned type.
Needs benchmarking to ensure I'm not just muddling the code for no gain!
Currently, if you have a protein that could be DNA or RNA all the way until the last few elements, you end up re-scanning the whole input several times before parsing as a protein.
I reckon it would be faster to do everything in a single pass, with a stack of possible alphabets being eliminated as the sequence is traversed. The top alphabet surviving on that priority stack would be the assigned type.
Needs benchmarking to ensure I'm not just muddling the code for no gain!