Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Access bigwigmerge from other crates #59

Closed
donaldcampbelljr opened this issue Nov 12, 2024 · 5 comments
Closed

Access bigwigmerge from other crates #59

donaldcampbelljr opened this issue Nov 12, 2024 · 5 comments

Comments

@donaldcampbelljr
Copy link
Contributor

Hi @jackh726,

Thank you for your work on bigtools!

I am currently exploring using bigtools to create bigwig files in one of our rust crates (https://github.com/databio/gtars). Our crate would create intermediate bigwigs before merging them into a single bigwig as a final result.

I thought the best way would be to call the the public function bigwigmerge from bigwigmerge.rs and pass a constructed BigWigMergeArgs struct to the function. However, while the BigWigMergeArgs struct is public, some of the fields are private and I am unable to edit these fields from within another crate.

I also looked at a second option, where I merge the values and write them using BigWigWrite<File>'s wrtie function:

            let all_values = ChromGroupReadImpl {
                iter: Box::new(iter),
            };
            outb.write(all_values, runtime)?;

However, all values is a private struct that implements the necessary BBIDataSource trait.

I guess my questions for you are:

  1. Should I be approaching this differently? I could have the user run bigwigmerge [OPTIONS] <OUTPUT> after using our crate, but I thought it would be nicer and less clunky to do this behind the scenes for the user.
  2. Could we make the ChromGroupReadImpl struct public? I believe this might be the simplest solution to using the bigtools merge code in another external crate.
@jackh726
Copy link
Owner

Hi @donaldcampbelljr!

The right thing to do is for me to just make the available functions and structs public. Happy to take a PR for this - otherwise I will try to get to it maybe this evening or something this week.

@donaldcampbelljr
Copy link
Contributor Author

Great, I've created a PR with the necessary changes. I've tested my forked branch in our external crate and have confirmed that they fix the problem I was having.

#60

@jackh726
Copy link
Owner

Merged. Will keep this open until the next release. (Will make a release cut soonish.)

@donaldcampbelljr
Copy link
Contributor Author

Awesome. Thank you!

@jackh726
Copy link
Owner

This is included in bigtools 0.5.4 released today!

Closing - let me know if you run into other issues!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants