As currently implemented, slicing a SeqLike that contains AA and NT records yields:
- a simple behavior when the AA record is primary, and
- a slow and less robust behavior when the NT record is primary (e.g., if the slice is not a triplet, SeqLike returns a "Partial codon" warning)
In particular, the computational overhead of translating the NT sequence during each __getitem__() call can be very tedious (e.g., when applying a long sliding window over an entire sequence).
I propose that we eliminate the second behavior (attempting to slice the AA record when NT is primary)-- i.e., when slicing the NT SeqLike, all bets are off with respect to the AA record, and the user must explicitly translate the SeqLike to yield a new AA record.
Alternatively, we could add a flag to optionally retain the AA record when True (default False; similar to how BioPython already addresses this for SeqRecord.reverse_complement()), though I don't know how to implement this properly in __getitem__().
As currently implemented, slicing a SeqLike that contains AA and NT records yields:
In particular, the computational overhead of translating the NT sequence during each
__getitem__()call can be very tedious (e.g., when applying a long sliding window over an entire sequence).I propose that we eliminate the second behavior (attempting to slice the AA record when NT is primary)-- i.e., when slicing the NT SeqLike, all bets are off with respect to the AA record, and the user must explicitly translate the SeqLike to yield a new AA record.
Alternatively, we could add a flag to optionally retain the AA record when True (default False; similar to how BioPython already addresses this for
SeqRecord.reverse_complement()), though I don't know how to implement this properly in__getitem__().