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

Add wrapper object that initialises and contains enricher and analyzer objects #34

Conversation

ubyndr
Copy link
Collaborator

@ubyndr ubyndr commented Aug 11, 2023

Resolves #32

I have some uncertainty about the wrapper class; it might not align exactly with what you had in mind. Everything seems like working in the workflow you described. It would require some improvement though.

This is what I use in my tries;

import tabulate

from pandasaurus_cxg.enrichment_analysis import AnndataEnrichmentAnalyzer
from pandasaurus_cxg.graph_generator.graph_generator import GraphGenerator


aea = AnndataEnrichmentAnalyzer("test/data/modified_human_kidney.h5ad")
# aea = AnndataEnrichmentAnalyzer("test/data/human_kidney.h5ad")

print(aea.enricher_manager.contextual_slim_enrichment())

df = aea.analyzer_manager.co_annotation_report()
df = df.sort_values(["field_name1", "value1"]).reset_index(drop=True)
print(tabulate.tabulate(df, df.columns.tolist(), tablefmt="fancy_grid"))

gg = GraphGenerator(aea)
gg.generate_rdf_graph()
gg.set_label_adding_priority(["class", "cell_type", "subclass.l1", "subclass.l1", "subclass.full", "subclass.l2", "subclass.l3"])
gg.add_label_to_terms()
gg.enrich_rdf_graph()
# gg.save_rdf_graph(file_name="new_kidney", _format="ttl")
gg.visualize_rdf_graph(
    [
        "http://example.org/69fa1a0f-9839-4211-be06-7ff59f43bc7d",
    ],
    predicate=None,
    file_path="new_kidney.ttl",
)

@ubyndr ubyndr requested a review from dosumis August 11, 2023 16:19
@dosumis
Copy link
Contributor

dosumis commented Aug 17, 2023

Getting

ImportError: requires pygraphviz http://pygraphviz.github.io/

But having problems installing locally

Note: This error originates from the build backend, and is likely not a problem with poetry but with pygraphviz (1.11) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "pygraphviz (==1.11)"'.

Also - feel like the gg.visualize_rdf_graph needs pydoc. Not clear to me how we expect users to find IRIs for nodes.

@dosumis
Copy link
Contributor

dosumis commented Aug 17, 2023

Hard to details of PR. Seems to work apart from the import issue. Happy to merge if this is fixed. All other issues now in tickets which can be addressed in their own PRs. Will note which ones I think should be fixed for a release.

Copy link
Contributor

@dosumis dosumis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy for you to merge once imports fixed.

@ubyndr
Copy link
Collaborator Author

ubyndr commented Aug 24, 2023

Happy for you to merge once imports fixed.

I've added a script to install dependencies. It sets couple of env variables to resolve the graphics issue. Should I merge this as it is or should I wait for you to confirm whether the script resolves your issue or not.

Base automatically changed from 14-support-basic-metaschema-for-flagging-cell-type-fields to main August 24, 2023 14:12
@dosumis
Copy link
Contributor

dosumis commented Aug 24, 2023

I've added a script to install dependencies. It sets couple of env variables to resolve the graphics issue. Should I merge this as it is or should I wait for you to confirm whether the script resolves your issue or not.

As long as you are confident you can make a build for release with this, I'm happy to merge. It will probably still take some playing around for me to switch to doing poetry builds from Command Line. Currently using PyCharm built-in.

@ubyndr ubyndr force-pushed the 32-add-wrapper-object-that-initialises-and-contains-enricher-and-analyzer-objects branch from dabcbb5 to 8dc5255 Compare August 24, 2023 14:34
@ubyndr ubyndr mentioned this pull request Aug 24, 2023
@ubyndr ubyndr merged commit ee3f966 into main Aug 29, 2023
@ubyndr ubyndr deleted the 32-add-wrapper-object-that-initialises-and-contains-enricher-and-analyzer-objects branch August 29, 2023 08:42
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.

Add wrapper object that initialises and contains enricher and analyzer objects
2 participants