Closed methornton closed 5 years ago
Thanks for the thorough bug report. Yes, you've correctly identified the problem: CyREST (and therefore RCy3) does not handle node attributes of type list
at this time. The current function appears to choke on this case (which I neglected to test). I should be able to update the function to at least render the list as a string (stay tuned for pending fix...).
In the meantime, you could remove the attribute prior to running the function as a workaround. I don't know how to do this with GraphNELs, but I do with igraphs... and the first step in createNetworkFromGraph is to convert it to igraph :) So...
library(igraph)
ig<-igraph.from.graphNEL(a1)
ig<-delete_vertex_attr(ig, 'geneIds')
ig<-delete_vertex_attr(ig, 'condGeneIds')
#note: there is also a problem with a mix of strings (i.e., "Infinity") in the oddsRatio column, which is otherwise handled as floats. So we have to remove that for now as well...
ig<-delete_vertex_attr(ig, 'oddsRatio')
RCy3::createNetworkFromIgraph(ig)
Ok. I'm pushing a fix to this repo now. I tested it with an example adapted from the GOstats vignette below. Note that the removal of oddsRatio
is still required due to the lack of support for "Infinity" in CyREST. Not sure how to handle this one yet...
To test with your own data, first install the dev version of RCy3:
install.packages("devtools")
library(devtools)
install_github('cytoscape/RCy3', build_vignettes=TRUE)
#If installation fails due to package 'XXX' not found,
# then run install.packages("XXX") and then try install_github('cytoscape/RCy3') again
library(RCy3)
Please try this example first and let me know:
library(GOstats)
library(org.Hs.eg.db)
library(GSEABase)
frame = toTable(org.Hs.egGO)
goframeData = data.frame(frame$go_id, frame$Evidence, frame$gene_id)
goFrame=GOFrame(goframeData,organism="Homo sapiens")
goAllFrame=GOAllFrame(goFrame)
gsc <- GeneSetCollection(goAllFrame, setType = GOCollection())
universe = Lkeys(org.Hs.egGO)
genes = universe[1:500]
params <- GSEAGOHyperGParams(name="My Custom GSEA based annot Params",
geneSetCollection=gsc,
geneIds = genes,
universeGeneIds = universe,
ontology = "MF",
pvalueCutoff = 0.05,
conditional = FALSE,
testDirection = "over")
hgOver1 <- hyperGTest(params)
y1 = termGraphs(hgOver1, use.terms=FALSE, pvalue=0.05)
a1 <- y1$`1`
library(igraph)
ig<-igraph.from.graphNEL(a1)
ig<-delete_vertex_attr(ig, "oddsRatio")
createNetworkFromIgraph(ig)
Hello! I am trying to subset and import a graphNEL of GO terms made using the 'GOstats' package into Cytoscape using the 'RCy3' package and it isn't working. The data comes from the output of the 'termGraphs' function of GOstats
I've got to truncate this for space
...
So now I want to subset the graphNEL
I can plot the subset, but then export into Cytoscape with 'RCy3' it fails
Even if I try to import the whole thing it fails also.
However, if I use the simple example from the vignette, it works.
'g' doesn't look too different than 'a1' or even 'sub'
If the issue is the genes, it would be nice to be able to include it, or is there even an easy way to get rid of that data that would help. I was able to get this to work previously. I'm stuck now though. Any advice or assistance is greatly appreciated!