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

basic module to write nxo features for efo #1

Merged
merged 6 commits into from
Jul 12, 2023

Conversation

dhimmel
Copy link
Member

@dhimmel dhimmel commented Jul 11, 2023

This PR provides some basic code to features describing each ontology node (i.e. term/class). Currently includes only features that are provided by nxontology.

Comment on lines 9 to 11
class NodeFeatures:
def __init__(self, info: Node_Info[T_Node]) -> None:
self.info = info
Copy link
Member Author

Choose a reason for hiding this comment

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

Instead of a separate NodeFeatures class that embeds a node info object, I think a subclass of Node_Info could be nice. This would make it really easy for us to promote methods from nxontology_ml to nxontology, and it would allow us to benefit from the caching infrastructure provided by nxontology.

Basic approach in related-sciences/nxontology#26, but timeline on getting that working with typing and reviewing its desirability is TBD.

@dhimmel
Copy link
Member Author

dhimmel commented Jul 11, 2023

As of 208bee7, generated features look like:

identifier name depth n_ancestors n_descendants intrinsic_ic intrinsic_ic_scaled intrinsic_ic_sanchez intrinsic_ic_sanchez_scaled n_parents n_children n_roots n_leaves prefix is_gwas_trait xref__doid__count xref__gard__count xref__icd10__count xref__icd9__count xref__meddra__count xref__mesh__count xref__mondo__count xref__ncit__count xref__omim__count xref__omimps__count xref__orphanet__count xref__snomedct__count xref__umls__count
DOID:7551 gonorrhea 3 10 1 10.12883 1.00000 9.75609 0.99033 2 0 2 1 doid False 0 1 0 4 0 1 1 1 0 0 1 3 2
EFO:0000094 B-cell acute lymphoblastic leukemia 3 33 2 9.43568 0.93157 9.82155 0.99697 2 1 5 1 efo True 2 0 0 0 0 0 1 1 0 0 0 1 0
EFO:0000095 chronic lymphocytic leukemia 4 36 2 9.43568 0.93157 9.82401 0.99722 4 1 5 1 efo True 1 1 2 1 1 1 1 1 1 0 1 0 2
EFO:0000096 neoplasm of mature B-cells 3 18 38 6.49124 0.64087 8.89163 0.90257 1 8 4 29 efo True 1 0 0 1 0 0 1 2 0 0 0 1 1

@eric-czech soft review request. Will add more features and move to a more disciplined feature naming convention in future PRs, but any feedback on whether this is what you have in mind is helpful.

@dhimmel
Copy link
Member Author

dhimmel commented Jul 12, 2023

Will merge now rather than continuing to make this PR larger. Review still welcome.

@dhimmel dhimmel merged commit a8b2bbe into main Jul 12, 2023
2 checks passed
Copy link

@eric-czech eric-czech left a comment

Choose a reason for hiding this comment

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

Looks great to me 👍

# https://python-poetry.org/docs/versions/
[tool.poetry.dependencies]
bioregistry = "^0.8.3"
fire = "^0.5.0"
ipykernel = "^6.24.0"

Choose a reason for hiding this comment

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

Should the jupyter libs be tool.poetry.dev-dependencies?

@dhimmel dhimmel deleted the dsh-nxo-node-info-features branch July 13, 2023 13:26
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