qiime2/q2-feature-classifier

extract-reads: add trim-right option

Closed this issue · 2 comments

Addition Description
trim a specified number of nucleotides off of the 3' end of sequences

Current Behavior
trunc-len trims to a fixed length, but does not trim an explicit number of nucleotides. This should be done to mirror what is done to query sequences during denoising (i.e., if trim-left-r is used in q2-dada2 denoise-paired, that same number of nt should be trimmed off of the 3' end of extracted reads to match the same read position + length).

Proposed Behavior
add a trim-right parameter.

References
forum xref

I'm interested in this.

For my own notes, the stack appears to be

I think this is within my range conceptually, but I'm a big noob wrt python style and API design.

Glad to hear you are interested! See how trim-left and trunc-len are used here:

if trunc_len > 0:
amp = amp[:trunc_len]
if trim_left > 0:
amp = amp[trim_left:]

Adding trim-right would just be a matter of adding a similar line between those two (so the order should probably be trim-left, trim-right, trunc-len; in practice trunc-len will very often trim over what trim-right cut, but trunc-len is not always used so this is when trim-right might make sense), and of course registering this parameter on up through the stack and adding a simple unit test.