Closed m-grimes closed 5 years ago
Here's a toy example that works. Careful running this, however, as it will open a new session and close your current one (unsaved).
openSession()
edgevalues <- getTableColumns('edge',c('name','EdgeBetweenness'))
edgevalues['EdgeBetweenness']<-abs(edgevalues['EdgeBetweenness'])
edgevalues['EdgeBetweenness']<-lapply(edgevalues['EdgeBetweenness'], function(x) x / 2000)
setEdgeLineWidthBypass(edgevalues[['name']], edgevalues[['EdgeBetweenness']])
If this works for you, then we can suspect something particular about your network. Can you share it or a sample from it?
Thanks Alex. But
Error in commandsPOST(paste0("session open ", type, "=\"",
file.location, : File 'Yeast Perturbation.cys' not found:
Mark
Mark Grimes Division of Biological Sciences University of Montana Missoula, Montana 59812-4824 Grimes lab website Office Telephone: (406) 243-4977 Fax Number: (406) 243-4184 E-mail: Mark.Grimes@mso.umt.edu
On 25 Feb 2019, at 16:20, Alexander Pico wrote:
Here's a toy example that works. Careful running this, however, as it will open a new session and close your current one (unsaved).
openSession() edgevalues <- getTableColumns('edge',c('name','EdgeBetweenness')) edgevalues['EdgeBetweenness']<-abs(edgevalues['EdgeBetweenness']) edgevalues['EdgeBetweenness']<-lapply(edgevalues['EdgeBetweenness'], function(x) x / 2000) setEdgeLineWidthBypass(edgevalues[['name']], edgevalues[['EdgeBetweenness']])
If this works for you, then we can suspect something particular about your network. Can you share it or a sample from it?
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/cytoscape/RCy3/issues/45#issuecomment-467224858
Here's how I would do it:
edgevalues <- getTableColumns('edge',c('Weight'))
edgevalues['Weight']<-abs(edgevalues['Weight'])
edgevalues['Weight']<-lapply(edgevalues['Weight'], function(x) x * 5)
names(edgevalues)<-c('Width')
loadTableData(edgevalues, table = 'edge', table.key.column = 'SUID')
setEdgeLineWidthMapping('Width', mapping.type = 'passthrough', style.name = 'Crizotinib PTM Style')
Try to avoid using Bypasses whenever possible. They are slow; they are not saved with a style; they stick to a particular network view. I only recommend them for a handful of things that you really must override. But you can almost always simply create a new column and make a mapping instead.
Thanks Alex. This is a new function that appears to replace setEdgeLineWidthRule(net.w, edge.attribute.name="Weight", attribute.values=net.edges$Weight, line.widths=net.edges$Weight)
Your code did not give the same error, but did not change the edge witdths, just turned all the edges white (which I'd set as default previously). See screenshot.
Note that I got your code to work with a small network, just not the large one. Not sure why. I'll try plotting the large network from scratch again.
I going to close this for now until I can figure out the issue with the big network.
Alex I've been using code you sent to me previously to set edge line widths according to values in the data as shown below. Something is not working that I don't understand. Thanks, Mark
edgevalues <- getTableColumns('edge',c('name','Weight')) edgevalues['Weight']<-abs(edgevalues['Weight']) edgevalues['Weight']<-lapply(edgevalues['Weight'], function(x) x * 5) setEdgeLineWidthBypass(edgevalues[['name']], edgevalues[['Weight']])
Errors:
RCy3::cyrestPUT, HTTP Error Code: 500 url=http://localhost:1234/v1/networks/60252/views/90343/edges?bypass=TRUE body=[ { "SUID": 65537, "view": [ { "visualProperty": "EDGE_WIDTH", "value": 0.003550924 } ] }, { "SUID": 65536, "view": [ { "visualProperty": "EDGE_WIDTH", "value": 1.38 } ] }, { "SUID": 65539, "view": [ { "visualProperty": "EDGE_WIDTH", "value": 0.002013419 } ] }, ...
Goes on and on