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

[builder] cellxgene_ontology_guide integration #1094

Merged
merged 4 commits into from
Apr 16, 2024
Merged

Conversation

ebezzi
Copy link
Member

@ebezzi ebezzi commented Apr 5, 2024

Integrate cellxgene_ontology_guide in place of the old TissueMapper.

self._cached_tissues: dict[str, str] = {}
self._cached_labels: dict[str, str] = {}
self._uberon = owlready2.get_ontology(CXG_UBERON_ONTOLOGY_URL).load()
self.ontology_parser = OntologyParser()
Copy link
Contributor

Choose a reason for hiding this comment

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

you might want to pin to a particular schema version OntologyParser("v5.0.0") since the builder pins the version when it fetches the datasets from the index endpoint

Copy link
Member Author

Choose a reason for hiding this comment

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

Does the version match the DP schema?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, with a "v" prefix

@@ -1,117 +1,16 @@
"""NOTE: In the future, this code will be part of an ontology service library."""
Copy link
Contributor

Choose a reason for hiding this comment

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

remove this?

Copy link

codecov bot commented Apr 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.12%. Comparing base (07d0f43) to head (cbf7187).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1094   +/-   ##
=======================================
  Coverage   91.12%   91.12%           
=======================================
  Files          77       77           
  Lines        5913     5857   -56     
=======================================
- Hits         5388     5337   -51     
+ Misses        525      520    -5     
Flag Coverage Δ
unittests 91.12% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@nayib-jose-gloria nayib-jose-gloria left a comment

Choose a reason for hiding this comment

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

LGTM

tools/cellxgene_census_builder/pyproject.toml Outdated Show resolved Hide resolved
branch_ancestors = self._list_ancestors(is_a, branch_ancestors)

# Include this branch of ancestors is under anatomical structure
if self.ANATOMICAL_STRUCTURE_NAME in branch_ancestors:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this functionality covered by COG?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure?

Copy link
Contributor

Choose a reason for hiding this comment

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

this will not affect functionality. This is subsetting the ontology graph being built, but COG pre-builds the ontology graph and packages it in the library so it's not necessary, and is a superset of this graph. Census only matches terms to one of the terms in the curated list of tissue general terms anyway, so there isn't a concern around over-listing ancestors to users.

elif self._is_entity(entity) and not self._is_and_object(entity):
# Entity is a superclass, check for is_a relationships

if entity.name in self.DENY_LIST:
Copy link
Collaborator

Choose a reason for hiding this comment

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

COG doesn't have a deny list filter. Is this a problem?

Copy link
Member Author

Choose a reason for hiding this comment

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

Most likely. I was expecting this function to be fully replaceable by get_high_level_terms, if it's not then I think we're not ready for using it in the Census.

Copy link
Contributor

@nayib-jose-gloria nayib-jose-gloria Apr 9, 2024

Choose a reason for hiding this comment

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

we already filter out non-UBERON terms. I don't foresee issues with the two UBERON terms in the deny list, since they are high-level terms closer to the root node than anything in the curated tissue general list, so skipping fetching their ancestors will not affect traversing the graph used for mapping to one of the curated tissue general terms. I believe this would only become an issue if a term higher-level than "material anatomical entity" or "anatomical entity" is added to the curated tissue list--which doesn't fit the use-case of the list, and further wouldn't make sense if the goal is actually to filter out ancestor terms of these terms

Copy link
Collaborator

@Bento007 Bento007 left a comment

Choose a reason for hiding this comment

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

COG should also be able to replace ontology_mappy.py

Copy link
Collaborator

@Bento007 Bento007 left a comment

Choose a reason for hiding this comment

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

See comments

@ebezzi
Copy link
Member Author

ebezzi commented Apr 9, 2024

COG should also be able to replace ontology_mappy.py

Are its functionalities covered by COG? This is only used by Geneformer, which isn't part of core Census, so I wouldn't be too worried about it.

@Bento007
Copy link
Collaborator

Bento007 commented Apr 10, 2024

COG should also be able to replace ontology_mappy.py

Are its functionalities covered by COG? This is only used by Geneformer, which isn't part of core Census, so I wouldn't be too worried about it.

It's functionality is covered. I created a ticket to do this as future work.

Copy link
Collaborator

@Bento007 Bento007 left a comment

Choose a reason for hiding this comment

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

Update to COG 0.6.1 and this PR is good to go.

@Bento007 Bento007 self-requested a review April 10, 2024 19:33
@ebezzi ebezzi merged commit 5acaf9e into main Apr 16, 2024
13 checks passed
@ebezzi ebezzi deleted the ebezzi/cog-integration branch April 16, 2024 16:20
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.

4 participants