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

Getting is_a and part_of relationships in GO tree #126

Closed
risserlin opened this issue Apr 8, 2019 · 5 comments
Closed

Getting is_a and part_of relationships in GO tree #126

risserlin opened this issue Apr 8, 2019 · 5 comments

Comments

@risserlin
Copy link

I want to get the GO ontology using is_a and part_of and I have figured out how to get is_a (default) and I have also used get_all_upper() to get all the parents using all relationships but is there a way to return the go tree with just is_a and part_of excluding the regulation type terms?

Thanks,
Ruth

@gudeqing
Copy link

I checked the current scripts,and found that the author only defines a node as parent using ‘is_a'

dvklopfenstein added a commit that referenced this issue May 16, 2019
dvklopfenstein added a commit that referenced this issue Jul 16, 2019
dvklopfenstein added a commit that referenced this issue Jul 16, 2019
dvklopfenstein added a commit that referenced this issue Jul 16, 2019
dvklopfenstein added a commit that referenced this issue Jul 16, 2019
GO DAG using is_a and user-specified optional relationships.
#126
dvklopfenstein added a commit that referenced this issue Jul 16, 2019
GO DAG using is_a and user-specified optional relationships.
#126
@dvklopfenstein
Copy link
Collaborator

dvklopfenstein commented Jul 16, 2019

Hello @risserlin ,

Thank you for your patience and interest in GOATOOLS. I have implemented the functionality that you requested:

New Functionality:

  1. Traverse a user-specified subset of optional relationships (includes the required is_a)
  2. Plot specific subsets of relationships using go_plot.py's new arg, --relationships=<rel1,rel2>
  3. Added --go_color_file=<file.txt> argument to go_plot.py

Items 2 and 3 were added to facilitate testing and documentation of item 1, but will certainly be useful in their own right.

1) Traverse a user-specified subset of optional relationship

To traverse ancestors or descendants of a GO term using the is_a standard relationships plus a user-specified subset of the optional relationships, like part_of, regulate, etc., check out the new Python notebook, https://github.com/tanghaibao/goatools/blob/master/notebooks/get_isa_and_partof.ipynb.

To get the ancestor or descendant GO IDs:

  • Use GoSubDag's rcntobj (recursive count) data member:
    • gosubdag.rcntobj.go2parents contains the ancestors for each GO ID key.
    • gosubdag.rcntobj.go2descendants contsint the descendants for each GO ID key

Getting all ancestors and descendants using the GOTerm functions like get_all_parents, get_all_upper, get_all_children, and get_all_lower works well for a single GO ID, but becomes time-consuming for a group of GO IDs. Instead, the GoSubDag object manages a smaller user-provided GO subset and will calculate all the sets of ancestors and descendants faster than the using GOTerm functions one GO term at a time.

2) Added --relationships argument to the go_plot.py script

New argument function
N -r Causes all relationships to be plotted
Y --relationships=rel1,rel2 Causes user-specified relationships to be plotted

Examples of values for --relationships include:

  • --relationships=part_of
  • --relationships=regulates,negatively_regulates

3) Added -go_color_file=<file.txt> argument to go_plot.py

The script searches for both a GO ID and 6 digit hex number preceded by a '#' on each line of the text "go color file", creating a go2color dictionary using the captured GO ID and color hex string. The dictionary may contain many more GO IDs than you will plot. Any unused GO IDs in go2color will be ignored.

Finally, you can override the background GO colors in the go_color_file by specifiying a single GO on the command line and following it with a color hex string (#d8dcd6 = grey), like this:

$ go_plot.py -r GO:0019222#d8dcd6 GO:0060150 --go_color_file=viral_gene_silence.txt

go_plot

@risserlin
Copy link
Author

Amazing! Thanks. I will give it a try.

@dvklopfenstein
Copy link
Collaborator

Great! Please let me know what you think.

@dvklopfenstein
Copy link
Collaborator

The code revisions address should your request. If they do not or if you would like some different functionality, please open a new issue.

I am going to close this issue.

Thank you very much for your interest in GOATOOLS and taking your time to request this very important, popular, and useful functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants