Skip to content
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

feat: allow passing query name to map #85

Merged
merged 1 commit into from
Nov 21, 2024
Merged

Conversation

mbhall88
Copy link
Contributor

This PR adds the ability to pass a query name to the map function.

This has been discussed/proposed in #80 but that PR seems to have grown quite large and tries to multiple things.

For the sake of keeping pieces of work smaller, easier to review, and easier to determine where issues may be introduced, I thought I would put in this small one.

It does take a slightly different approach to #80 where Rob creates a new function map_with_name. My reasoning for altering the existing map function is that it mirrors the minimap2 mm_map function, which takes a query name.

This will obviously require a minor version bump as it won't be backwards compatible, but as the project is still in the major version 0 phase that is valid semver.

Happy to discuss further.

PS. (as an aside) I think a future alteration to the Mapping API might also be to use &[u8] (or Vec<u8>) for the target and query names. This avoids the heavy conversion to strings for every mapping call. It is also quite conventional with other bioinfo Rust libraries such as noodles and needletail which work in byte space and leave it to the user to convert to Strings if required.

@jguhlin
Copy link
Owner

jguhlin commented Nov 18, 2024

Yeah. My rust skills have gotten better, so having it take in &[u8] would be a definite improvement, and leave it to the end-user to worry about strings.

I'll take a look at both PRs soon. I've gotten behind here, but it's time to catch up!

@jguhlin jguhlin mentioned this pull request Nov 21, 2024
@jguhlin
Copy link
Owner

jguhlin commented Nov 21, 2024

Merging this, and the other, then will reconcile and work on #71 and push out a release

@jguhlin jguhlin merged commit 0960646 into jguhlin:main Nov 21, 2024
jguhlin added a commit that referenced this pull request Nov 21, 2024
@rob-p Dunno if you can test it, or added the proper tests?

@mbhall88 Query name is passed in as AsRef<[u8]> and there is some not my favorite code in there to prevent a new allocation if the query name is already nul-allocated, and to  do an allocation if needed.

Also I've updated Mappings to return Arc<String>'s for query name and target name, which should decrease performance for very small jobs but increase for large jobs.... but I need to benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants