cytoscape / RCy3

New version of RCy3, redesigned and collaboratively maintained by Cytoscape developer community
MIT License
48 stars 20 forks source link

Missing functions and Importing problems #86

Closed Skourtis closed 1 year ago

Skourtis commented 4 years ago

Hi I am trying to add new nodes surrounding pre-existing nodes, on the Metabolic KEGG pathways (imported to Cytoscape using KEGGscape). The idea is to get the all pre-existing nodes and their position, add new nodes for each one with similar positions and then put them in Cytoscape. For some reason I get an error for:

createIgraphFromNetwork() [1] "Warning: Requested column has missing values. Returning single column without row.names..." Error in strsplit(cyedges$name, " \(.*\) ") : non-character argument

although it works for simpler Networks.

Also getNodePosition() which exists in the documentation no longer exists and neither does CytoscapeWindow(). Also I am unsure what the list of named lists for addNodes should look like for as I also get an error when I try to add a single node.

node_names <- setNames(as.list(c(1, 2)), c("foo", "bar")) addCyNodes(+ node_names,

  • skip.duplicate.names = FALSE,
  • network = "Metabolic pathways",
  • base.url = .defaultBaseUrl
  • ) Error in print.default("NET TITLE: ", title) : invalid 'digits' argument In addition: Warning message: In print.default("NET TITLE: ", title) : NAs introduced by coercion

If you have a better idea of how I should go about this or if I'm doing something wrong with calling the functions let me know.

Thank you

Skourtis commented 4 years ago

Hi,

I stil l an error as the function doesn't exist.

cw <- CytoscapeWindow('network', graph=make_graphnel()) Error in CytoscapeWindow("network", graph = make_graphnel()) : could not find function "CytoscapeWindow"

And whatever network from Cytoscape I try to import I get this error

KEGG <- createGraphFromNetwork() Error in names(x) <- value : 'names' attribute [2] must be the same length as the vector [1]

Skourtis commented 4 years ago

Also I've been trying it today and "setNodeposition" also seems to not exist

setNodePosition() Error in setNodePosition() : could not find function "setNodePosition"

AlexanderPico commented 4 years ago

Sorry for delayed response. The RCy3 package was completely rewritten a couple years ago at version 2.0. This included staging deprecated and then defunct functions like the ones you are looking for. This was described in the README, and NEWS.

I would point you to the recently published article on RCy3 for an introduction to the new package and to the vignette on upgrade old scripts.

If you need any particular help upgrading your old script, please feel free to share code snippets and intents.

Skourtis commented 4 years ago

Dear Alexander,

Thank you for taking the time to respond to. In terms of using copycat layout to replace setnodeposition, as well as addcynodes not exisiting I don't think it's possible to place new nodes at specified positions.

What I am trying to do, is add mutliple nodes (without edges), surrounding all preexisting nodes on my network. How would I do this with the new tool kit?

Apologies if this seems really easy, I've been trying for a week now and can't seem to find the right way to do it.

Thank you, Savvas


From: Alexander Pico notifications@github.com Sent: Monday, December 9, 2019 8:35:08 PM To: cytoscape/RCy3 RCy3@noreply.github.com Cc: Savvas Kourtis kourtissavvas@gmail.com; Author author@noreply.github.com Subject: Re: [cytoscape/RCy3] Missing functions and Importing problems (#86)

Sorry for delayed response. The RCy3 package was completely rewritten a couple years ago at version 2.0. This included staging deprecated and then defunct functions like the ones you are looking for. This was described in the READMEhttps://github.com/cytoscape/RCy3/blob/master/README.md, and NEWShttps://github.com/cytoscape/RCy3/blob/master/NEWS.

I would point you to the recently published article on RCy3https://f1000research.com/articles/8-1774/v3 for an introduction to the new package and to the vignette on upgrade old scriptshttps://bioconductor.org/packages/release/bioc/vignettes/RCy3/inst/doc/Upgrading-existing-scripts.html.

If you need any particular help upgrading your old script, please feel free to share code snippets and intents.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/cytoscape/RCy3/issues/86?email_source=notifications&email_token=AMK3IOMU7UC4SN3C5L3OD5TQX2MWXA5CNFSM4JV2DKRKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGKMOIQ#issuecomment-563398434, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMK3IOJBUM54O42R6SMLVTLQX2MWXANCNFSM4JV2DKRA.

Skourtis commented 4 years ago

Thank you for the advice and resources! solved my issue!

tskmur commented 3 years ago

I got a same error when creating network from Cytoscape as below:

ig <- createIgraphFromNetwork() Error in names(x) <- value : 'names' attribute [2] must be the same length as the vector [1]

I would like to know how did you solve this?

Thank you.

AlexanderPico commented 3 years ago

This function appears to be working fine. Here are the steps to use it:

  1. Open a network in Cytoscape
  2. library(RCy3)
  3. ig <- createIgraphFromNetwork()

Can you provide the steps to reproduce the error you are seeing?

tskmur commented 3 years ago

I open a network (made by CoNet app in Cytoscape) and did same step you show me, but the same error occurred.

AlexanderPico commented 3 years ago

In order to reproduce your error, I need the same network and set of steps. I do not see this error with multiple sample networks I have in hand.

tskmur commented 3 years ago

How should I send you my network file? This platform does not support .cys file.

tskmur commented 3 years ago

I followed the steps of the instruction of CoNet Demo here I attached. My data format was a txt file obtained from biom file and I did not use mapping file. CoNetDemo.pdf

AlexanderPico commented 3 years ago

Yikes. That's long tutorial. I'm sorry I don't have time to reproduce those steps. If you can send a CYS file, I'd be happy to troubleshoot RCy3, but I'm not familiar enough with CoNet to be able to quickly repeat that demo.

grace-cagle commented 1 year ago

Hi @AlexanderPico,

I'm getting the same error as @tskmur described using the CoNet app. I've made a network using the CoNet app in Cytoscape and I'm attempting to load it into R using the commands createGraphFromNetwork() or createIgraphFromNetwork()

I've compressed the .cys file into a .zip file attached here.

ps2Top-Spearman-Pearson.cys.zip

bdemchak commented 1 year ago

I looked at this using py4cytoscape, which has the same structure and strategy as RCy3 (i.e., for Python instead of R)

In py4cytoscape, failure occurs when trying to figure out the source and target for each edge, assuming that the edge name is built as a source node name + interaction + target node name. Specifically, we assume that a blank separates the source name from the interaction, and a blank separates the interaction from the target name.

For example, with a Cytoscape-built network like the Yeast Perturbation sample, an edge might look like:

YDR277C (pp) YDL194W

In this ps2Top-Spearman-Pearson network, an edge looks like:

"b13b2f2f3a0aba18fd82655653a92904"->"df3e11a2dea797be38778cc561a8a7f2"=correl_pearson

Considering that node names for this network look like:

"05101301deed2f555c572f464249d2e3"

I'm guessing that Cytoscape wants to see an edge name like:

"b13b2f2f3a0aba18fd82655653a92904" (->) "df3e11a2dea797be38778cc561a8a7f2"

Note the blanks and parentheses delimiting the -> interaction, and notice that for this discussion, I dropped the =correll-pearson, as it would confuse this parsing.

I don't know why this network was constructed using the edge names it was, nor do I have a charter to identify a different policy for parsing edge names, so I'll stop here and wait for Alex to weigh in.

Note, too, that the interaction column is empty, which may be troublesome to Cytoscape processing at some point. With this network, I'd expect it to be:

->

AlexanderPico commented 1 year ago

Thanks, Barry! Indeed, if an app is creating atypical edge names, then critical automation functions relying on such conventions will fail.

I note that the CoNet app does not support automation (https://apps.cytoscape.org/apps/conet) and hasn't been updated in over 6 years. So it is unlikely to be updated to support automation.

@grace-cagle At this point, I would recommend either replacing CoNet or writing a custom import function in R.

AlexanderPico commented 1 year ago

All our code it 100% open source, so feel free to reuse any parts of our import functions, e.g., https://github.com/cytoscape/RCy3/blob/master/R/Networks.R#L919

bdemchak commented 1 year ago

Could this be solved by updating this function to accept a new parameter? I'm thinking of a user passing in the edge parsing function of choice, which would override the standard edge parsing function. This gets over the assumption regarding the format of the edge name. However, it still leaves an open question of what other issues could arise because of dodgy edge name formatting or missing interaction column values.

Comment?

AlexanderPico commented 1 year ago

Yeah, seems a bit too far outside normal operation. Much easier to address the source than propagate support throughout Cytoscape for something as fundamental as edge names.