fasta rework - #284
Conversation
b52b79f to
0eacd43
Compare
|
@soypat the benchmark needs some fixing but this is looking really good! Is your plan to eventually deprecate the legacy fasta parsers as well? |
|
@TimothyStiles I'd really like to see those "Concurrent" parsers go. Maybe |
1ad691f to
ec58940
Compare
|
@TimothyStiles So I have changed the following things:
|
|
@soypat recent additions are looking great. Having a shorthand like
|
|
@TimothyStiles Alright, looks much better. Fixed various bugs and test coverage is up to 95% |
| } | ||
| fastas = append(fastas, fasta) | ||
| } | ||
| return fastas, nil |
There was a problem hiding this comment.
success case doesn't seem to be covered by tests?
|
@soypat I just rewrote
Been super busy the past several days but will be free to work on this together any time this week after tonight! |
| expected []Fasta | ||
| }{ | ||
| { | ||
| content: ">humen\nGATTACA\nCATGAT", // EOF-ended Fasta not valid |
There was a problem hiding this comment.
we should probably be more permissive and allow EOF-ended Fasta as valid?
There was a problem hiding this comment.
@soypat my latest changes have this entire suite of tests failing on off-by-one errors where there's always one more fasta than what is expected. Any idea what's going on?
There was a problem hiding this comment.
I'll take a deep dive look today! Sorry, was in the zone with another project yesterday
There was a problem hiding this comment.
I'm hesitant to say EOF ended fastas are OK. This means you can't use io.LimitReader to read fastas at all using poly API since its use will return incomplete fastas without warning. The reason this is important to me is because io.LimitReader is a commonly used foundation for writing software resilient to adversarial user input.
Though I'd also like users who want to parse EOF ended fastas to be able to use poly. This is possible since we can return a valid fasta alongside an io.EOF error when the fasta is immediately terminated by an EOF. This will allow users who need this functionality to build their own parsers who treat the EOF case specially.
Note: ParseNext now (correctly?) parses data/empty.fasta, returning a single fasta.
There was a problem hiding this comment.
Maybe we can add a boolean flag to the ParseN, ParseAll, ParseBytes: acceptEOFTerminatedFastas?
There was a problem hiding this comment.
Maybe we can add a boolean flag to the ParseN, ParseAll, ParseBytes: acceptEOFTerminatedFastas?
This feels a little clunky but may be the way to do it. Should this variadic or explicit?
There was a problem hiding this comment.
Note: ParseNext now (correctly?) parses data/empty.fasta, returning a single fasta.
Just made empty.fasta truly empty. It's meant to test the corner cases I just commented on.
There was a problem hiding this comment.
This feels a little clunky but may be the way to do it. Should this variadic or explicit?
Maybe we can have parser options? Something like this https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis? Or maybe that's too much- just a struct with fields?
|
I removed |





So this is NOT intended as a performance boost change. This is above all an API rework for ease of use and clarity.
I have implemented a fasta.Parser type. This type is intended to be the base to parse all fasta data and replace all other implementations.
Benefits of
Parser.ParseNext()when compared toXConcurrentfunctions:io.Readerfor user liberty to use with any API or stream.