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

ia() and get_parents() #33

Merged
merged 3 commits into from
Jun 1, 2023
Merged

ia() and get_parents() #33

merged 3 commits into from
Jun 1, 2023

Conversation

nthiad
Copy link
Contributor

@nthiad nthiad commented May 30, 2023

This patch adds ia(term_type, graph) and get_parents(term_type, graph) for #28 based on https://www.kaggle.com/competitions/cafa-5-protein-function-prediction/discussion/405237 (as best as i could interpret this).

Here's what it looks like to use:

>>> from manas_cafa5.protein import Protein; p = Protein.from_file('p68510', 'data/p68510.xml'); g = Protein.build_graph('data/go-basic.obo')
>>> p.ia('go',g)
7.111309583204707

and this feature can be used for the analysis requested in #28:

>>> len(p.go_terms())
29
>>> p.ia('go',g) * len(p.go_terms())
206.2279779129365

This patch doesn't implement the jupyter notebook but should make that notebook easier and more clear to compose.

lambda terms, term: terms.union(
networkx.ancestors(graph, term['id'])
),
self.get_terms(term_type),
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we do not want the actual terms: we will use this function in order to compute candidate terms, the actual terms for a protein are not candidates, they are already assigned to the protein then they will give us no score in the predictions. We just want the ancestors.

Also, will be good to have a parameter distance like the descendants function where we compute the ancestors up to any specific degree.

Copy link
Contributor

@leandroradusky leandroradusky left a comment

Choose a reason for hiding this comment

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

Just one comment and then we're good to 🚀 :)

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