Closed AoifeHughes closed 3 weeks ago
@SirSharpest
Thank you. This will be a great contribution.
We do have some similar graph capabilities at this point. Would you mind taking a look at obo_parser.GODag.make_graph_pydot
and .make_graph_pygraphviz
, and see if you could add your method along with those?
Otherwise, please feel free to just create a pull request ... and we'll try to merge this in.
@SirSharpest
Just noticed that your method is on GODagSmall
so my previous suggestion (to modify GODag
) doesn't apply. cc @dvklopfenstein to see what the best approach is here but it feels like we can extract your graph conversion as a method on GODagSmall
.
Hello @SirSharpest ,
Returning a networkx graph object containing significant GO terms is a great idea.
Rather than using the OboToGoDagSmall, which only accounts for connections up the is_a relationship, use GoSugDag, which will make it easier to expand in the future. It would look like this:
from goatools.gosubdag.gosubdag import GoSubDag
from goatools.gosubdag.go_edges import get_edgesobj
goids = [o.GO for o in goea_results if o.p_fdr_bh <= sig]
gosubdag = GoSubDag(goids, godag)
objedges = get_edgesobj(gosubdag)
edges = [(parent, child) for child, parent in objedges.edges]
The godag
is a GODag object, which would need to be a new argument ot your function, GOs_to_nx
.
To ensure a successful experience for people using your code, please:
goatools/gosubdag/plot
And if users have questions on your new code, you are willing to support it?
Thanks so much for the good idea and for the code.
Hi,
I made a quick and dirty edit to allow for this: https://github.com/SirSharpest/goatools/commit/40be859be38f1d58978ebf454bf30006f7530840
For analysis and plotting of graphs networkx is often used, I beleive it would be useful for goatools to have the ability built in to export to and from networkx.
Perhaps this functionality is already possible, I was not able to find it in documentation.
Either way, I would be happy to integrate this properly and make a pull request if it would be of interest.