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
Loads tree in NewickFormat, uses BP to parse tree faster #42
Conversation
uses BP to parse tree faster
gemelli/rpca.py
Outdated
@@ -39,6 +42,11 @@ def phylogenetic_rpca(table: biom.Table, | |||
gemelli. | |||
""" | |||
|
|||
# loads NewickFormat tree as bp.BP tree; loads & parses tree faster | |||
phylogeny = get_bp(phylogeny) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_bp
is only like two lines and it is pretty easy to get burned by importing from private modules in python. I would probably recommend just duplicating that code here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks so much @ahdilmore. Since get_bp isn't a public function I would suggest to just copy the 2 lines directly into the code.
Also, NewickFormat can probably not be included here because the standalone CLI will not work if q2_types isn't installed. @cameronmartino or @gibsramen any suggestions on how to handle this? Short of writing a wrapper for this function that's decorated with the relevant types, etc?
Not super familiar with how |
As a hack, you could probably use
So something like
Could work. Though I would want to check integration with qiime2. Alternatively, it is pretty easy to include only |
The |
Sure but in that case why not specify that Aside from that
I think this is a decent solution. |
Good point. In that case I think a transformer would need to be defined for the q2 plugin. |
Thanks for the contribution @ahdilmore, this tree import is way faster. Also, good points from @gibsramen, @ElDeveloper, and @gwarmstrong. I made a few changes:
It looks like everything is now passing. If someone wants to take a second check at everything, I think we should be good to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @ahdilmore and @cameronmartino! Just one suggested change because the comment seems out of place.
gemelli/preprocessing.py
Outdated
# The file will still be closed even though we return from within the | ||
# with block: see https://stackoverflow.com/a/9885287/10730311. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment seems a bit outdated.
# The file will still be closed even though we return from within the | |
# with block: see https://stackoverflow.com/a/9885287/10730311. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch @ElDeveloper. That comment is now removed. Thanks!
Thanks @cameronmartino! |
Uses BP to parse tree to improve Phylo-RPCA's memory usage. I also updated the setup.py to account for new dependencies.