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

Do you have plans to allow parsing of part_of and other relationships as parent-children connections? #92

Closed
Melnorme1984 opened this issue Jan 22, 2018 · 7 comments

Comments

@Melnorme1984
Copy link

The current "nested structure" implementation for relationships doesn't allow one to use update_association to propagate on them.

@Melnorme1984
Copy link
Author

Melnorme1984 commented Jan 22, 2018

I deal with this right now by replacing GOTerm's get_all_parents method with a customized version:

def get_all_parents(self):
    """Return all parent GO IDs."""
    all_parents = set()
    for parent in itertools.chain(self.parents, getattr(self, "relationship", collections.defaultdict(set))["part_of"]):
        all_parents.add(parent.id)
        all_parents |= parent.get_all_parents()
    return all_parents

@dvklopfenstein
Copy link
Collaborator

Hello Melnorme1984,

Thank you for your interest in GOATOOLS and thank you for contacting us.

We do plan to update this function to use new code (currently in an alpha repo, but will be released upon the publication of our GOATOOLS manuscript). Your request had not been in our immediate plans, but with user interest it makes sense to do it.

Could you provide a short test(s) demonstrating how you would use this in one of your scripts? With the test, we could be sure that we are both thinking the same way and have not missed anything.

Thank you again for your interest and GOATOOLS and for providing us with this information and your current customize version.

@Melnorme1984
Copy link
Author

Melnorme1984 commented Jan 25, 2018

I can give you some of the context for this code.

Reading the ontology:

return goatools.obo_parser.GODag(DATA_DIRECTORY + GENEONTOLOGY_BASE_FILENAME, optional_attrs=["relationship"])

Setting the new get_all_parents method and calling update_association (which uses get_all_parents) to get a propagated gene-to-term association map using both is_a and part_of relationships:

goatools.obo_parser.GOTerm.get_all_parents = get_all_parents
ontology.update_association(association)

@dvklopfenstein
Copy link
Collaborator

FYI, I am working on supporting the 'part_of' relationship now as I need it currently in my own research. I'll post back with links to tests where part_of is used. Thank you for taking the time to contact us and express your interest in the part_of relationship .

@dvklopfenstein
Copy link
Collaborator

Thank you very much for your interest in GOATOOLS and taking the time to express interest in this important functionality.

BRAND NEW are the functions:

  • get_all_upper()
  • get_all_lower()

which traverse both the get_all_parents/get_all_children as well as the relationships and reverse relationships: (tests/test_i92_relationship_parentchild.py)

It is planned to use these new functions in "propagate_counts".
We will update the code for the version of "propagate_counts" that you need once our manuscript (and related code) is out.

Please open a new request for propagate_counts using relationships. In the meantime, please use the new functions, get_all_upper() and get_all_lower() in place of your modified get_all_parents() and get_all_children().

I am closing this issue. Please re-open if there are any issues with the NEW get_all_upper() and get_all_lower().

@dgpinheiro
Copy link

Sorry, but I used these functions without success. I also interested in an implementation considering relationships, such as part_of, to propagate counts on them.

@dvklopfenstein
Copy link
Collaborator

Thank you for your interest in GOATOOLS and taking the time to write to us.

I will take a look at propagate_counts allowing the use of othre relationships shortly. Issue #117 is now being used to track this request.

Thank you again for expressing user priorities.

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

3 participants