Refactor fasta reader index usage and allow filelike object use #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fasta implementation was a little tricky since there are multiple relevant readers upstream in noodles:
fasta::Reader
,fasta::IndexedReader
, andfasta::fai::Reader
. The corerecords_to_ipc
function relies on thequery
method supplied by thefasta::Reader
, so thefasta::Reader
was turned into aFastaReader
struct field. Since thequery
method also relies on the fasta index,index
was made into aFastaReader
struct field and is now read through a separatefasta::fai::Reader
instead of using thefasta::IndexedReader
, which has access to the index, butlacks the. (EDIT: yes it does have aquery
methodquery
method)Filelike object compatability was also implemented in line with the other readers, and generics have been sprinkled about accordingly.
Also now provides a proper error message when a
.fai
index file can't be found instead of providing a generic "file not found" error which a user may attribute to the fasta file and not the index file.