-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rust DAT parser #39
Merged
Merged
Rust DAT parser #39
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rien
reviewed
Jan 31, 2024
scripts/helper_scripts/unipept-database-rs/src/dat_parser/threaded_parser.rs
Outdated
Show resolved
Hide resolved
scripts/helper_scripts/unipept-database-rs/src/dat_parser/threaded_parser.rs
Show resolved
Hide resolved
scripts/helper_scripts/unipept-database-rs/src/dat_parser/sequential_parser.rs
Outdated
Show resolved
Hide resolved
scripts/helper_scripts/unipept-database-rs/src/dat_parser/entry.rs
Outdated
Show resolved
Hide resolved
…ential_parser.rs Co-authored-by: Rien <[email protected]>
rien
approved these changes
Feb 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I created my own parser for Uniprot's custom DAT file format. This format is completely undocumented, so I had to reverse-engineer it by comparing it to an XML file. I have made notes of my findings and added them in a markdown file for you to reference in the future.
My parser is very heavily based on the
uniprot-rs
library we're using for the XML parser, as writing threaded parsers is quite difficult and I had never done it before.The parser includes both a simple single-threaded parser, as well as a (far) more complex multi-threaded parser. The multi-threaded parser is only a few hundredths of a second faster than the single-threaded one, so I have left the simple single-threaded parser in as well because it's easier to work with and expand upon.
As a bonus, I introduced unit tests into the project :) There were none before, and I felt like the parser warranted it because it heavily exploits the structure of the DAT file. Testing was added to the CI as well.