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

Move reldepth calculations to its own module #188

Closed
dvklopfenstein opened this issue Nov 23, 2020 · 2 comments
Closed

Move reldepth calculations to its own module #188

dvklopfenstein opened this issue Nov 23, 2020 · 2 comments

Comments

@dvklopfenstein
Copy link
Collaborator

dvklopfenstein commented Nov 23, 2020

Sumary

  • Removed GOTerm data member, reldepth.
  • Added function, get_go2reldepth.
  • Doing this effectively moves the reldepth calculation from inside the GOTerm class to its own module

Description

The GOTerm data member, reldepth, which is the depth of a GOTerm if optional relationships are loaded as well as the required is_a edges. It only appears on a GOTerm if optional relationships are loaded.

The issue with GOTerm having a reldepth data member is that its value was calculated using all of the optional relationships, if optional relationships are requested, even if the researcher is only working with the part_of relationship.

The GODag is designed to parse the go-basic.obo and either read or not read optional relationships.
The partner class, GoSubDag is designed to use specific relationships (None, All, or Some) specified by the researcher and takes the GODag as an input argument.

Usage

To get reldepth value now, do this:

from goatools.godag.reldepth import get_go2reldepth
relationships = {'part_of',}
goterms = godag.values()
go2reldepth = get_go2reldepth(goterms, relationships)

Benefits

This change makes the reldepth calculation independent of other tasks, like parsing the go-basic.obo or using a subset of the GODag through GoSubDag or calculating semantic similarity values between two GO terms using Wang's semantic similarity. It also allows the researcher to have depth calculated using a subset of optional relationships.

@tanghaibao
Copy link
Owner

Yeah, @dvklopfenstein this sounds like a useful addition.

@dvklopfenstein
Copy link
Collaborator Author

The reldepth calculation functions have been moved to its own module, goatools.godag.reldepth, and all tests pass.

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

No branches or pull requests

2 participants