tmuetze / Bioconductor_RCy3_the_new_RCytoscape

Update RCytoscape to work for Cytoscape 3.0 and higher using CyREST
16 stars 10 forks source link

setEdgeLineWidthRule, setEdgeColorRule, copyVisualStyle don't work #20

Closed m-grimes closed 8 years ago

m-grimes commented 8 years ago

Similar to the issue setting node color rule, the two functions to set edge witdth and color say "successfully set rule" but don't actually. copyVisualStyle returns an error.

  setEdgeLineWidthRule(windowname, "Weight", attribute.values=as.character(edgefile$Weight), line.widths, default.width=1.2)

Successfully set rule. setEdgeColorRule(windowname, 'edgeType', edgeTypes, corredgecolors, mode='lookup', default.color='#FDF8FF') # defalult zinc white Successfully set rule.

screen shot 2015-11-05 at 1 40 16 pm copyVisualStyle (windowname, "default", add.style.name) Error in file(con, "r") : cannot open the connection

I have a function to set the viz props: corr.edges.style.3 <- function(windowname, edgefile) {

Set up Cytoscape to make positive correlation yellow, negative blue

    edgeTypes <- c("negative correlation", "positive correlation", "peptide")
    corredgecolors = c('#0000FF', "#FCD116", '#000000') 
        #   blue; sign yellow; black; 
    myarrows <- c ('No Arrow', 'No Arrow', "No Arrow")
    setDefaultBackgroundColor(cy,'#888888', 'default' )
    # set up (have to make a graph first)
    setEdgeTargetArrowRule(windowname, 'edgeType', edgeTypes, myarrows, default='No Arrow')
    #'below' or 'above' colors must be specified  
     # setEdgeTargetArrowColorRule(windowname, "edgeType",  edgeTypes, c('#888888',corredgecolors,'#888888'), default.color='#FF0000')  # RCY3 error  
    setEdgeColorRule(windowname, 'edgeType', edgeTypes, corredgecolors, mode='lookup', default.color='#FDF8FF')     # defalult zinc white
    line.widths <- 4.5*abs(as.numeric(edgefile$Weight))
    setEdgeLineWidthRule(windowname, "Weight", attribute.values=as.character(edgefile$Weight), line.widths, default.width=1.2)  # broken
    alledges <- getAllEdges(windowname)
    proteinedges <- alledges[grep("peptide", alledges, fixed=TRUE)]
    if (any(proteinedges) {
    setEdgeLineWidthDirect(windowname, edge.names=proteinedges, new.value=1.2)}
    redraw(windowname)
    add.style.name <- paste("Corr Edges Style",length(getWindowList(cy)))
    if (!(add.style.name %in% getVisualStyleNames(cy))) { copyVisualStyle (windowname, "default", add.style.name) } # broken
    hidePanel(cy, "Results")

}

sessionInfo() R version 3.2.2 (2015-08-14) Platform: x86_64-apple-darwin13.4.0 (64-bit) Running under: OS X 10.10.5 (Yosemite)

locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages: [1] parallel stats4 grid stats graphics grDevices utils datasets [9] methods base

other attached packages: [1] RCy3_0.99.25 RJSONIO_1.3-0 rgl_0.95.1367
[4] RefNet_1.6.0 shiny_0.12.2 RCurl_1.95-4.7
[7] bitops_1.0-6 AnnotationHub_2.2.1 PSICQUIC_1.8.1
[10] httr_1.0.0 biomaRt_2.26.0 Biostrings_2.38.0
[13] XVector_0.10.0 GOstats_2.36.0 graph_1.48.0
[16] Category_2.36.0 GO.db_3.2.2 org.Hs.eg.db_3.2.3
[19] RSQLite_1.0.0 DBI_0.3.1 AnnotationDbi_1.32.0 [22] IRanges_2.4.1 S4Vectors_0.8.0 Biobase_2.30.0
[25] BiocGenerics_0.16.0 PMA_1.0.9 plyr_1.8.3
[28] impute_1.44.0 genlasso_1.3 Matrix_1.2-2
[31] MASS_7.3-44 igraph_1.0.1 devtools_1.9.1
[34] gplots_2.17.0 Rtsne_0.10 tsne_0.1-2
[37] vegan_2.3-1 permute_0.8-4 RUnit_0.4.30
[40] cluster_2.0.3 Hmisc_3.17-0 ggplot2_1.0.1
[43] Formula_1.2-1 survival_2.38-3 lattice_0.20-33
[46] stringr_1.0.0 sos_1.3-8 brew_1.0-6
[49] fdrtool_1.2.15 qgraph_1.3.1

loaded via a namespace (and not attached): [1] minqa_1.2.4 colorspace_1.2-6
[3] rjson_0.2.15 corpcor_1.6.8
[5] rstudioapi_0.3.1 lavaan_0.5-19
[7] interactiveDisplayBase_1.8.0 splines_3.2.2
[9] mnormt_1.5-3 glasso_1.8
[11] jsonlite_0.9.17 nloptr_1.0.4
[13] annotate_1.48.0 png_0.1-7
[15] DiagrammeR_0.8.1 acepack_1.3-3.3
[17] visNetwork_0.1.2 htmltools_0.2.6
[19] tools_3.2.2 coda_0.18-1
[21] gtable_0.1.2 reshape2_1.4.1
[23] Rcpp_0.12.1 gdata_2.17.0
[25] nlme_3.1-122 psych_1.5.8
[27] proto_0.3-10 lme4_1.1-10
[29] mime_0.4 ggm_2.3
[31] gtools_3.5.0 XML_3.98-1.3
[33] zlibbioc_1.16.0 scales_0.3.0
[35] BiocInstaller_1.20.0 RBGL_1.46.0
[37] huge_1.2.7 RColorBrewer_1.1-2
[39] curl_0.9.3 memoise_0.2.1
[41] gridExtra_2.0.0 rpart_4.1-10
[43] latticeExtra_0.6-26 stringi_1.0-1
[45] genefilter_1.52.0 sem_3.1-6
[47] caTools_1.17.1 boot_1.3-17
[49] d3Network_0.5.2.1 arm_1.8-6
[51] htmlwidgets_0.5 GSEABase_1.32.0
[53] AnnotationForge_1.12.0 magrittr_1.5
[55] R6_2.1.1 sna_2.3-2
[57] whisker_0.3-2 foreign_0.8-66
[59] mgcv_1.8-9 abind_1.4-3
[61] nnet_7.3-11 KernSmooth_2.23-15
[63] ellipse_0.3-8 jpeg_0.1-8
[65] pbivnorm_0.6.0 matrixcalc_1.0-3
[67] digest_0.6.8 xtable_1.8-0
[69] mi_1.0 httpuv_1.3.3
[71] munsell_0.4.2 tcltk_3.2.2
[73] quadprog_1.5-5

Cytoscape 3.2.1 cyREST 2.02 java 1.80_45 (from Cytoscape window)

I will try updating java.

m-grimes commented 8 years ago

Question: is jdk-8u65-nb-8_1-macosx-x64.dmg required? I have java 1.80_45 (from Cytoscape window), jdk1.8.0_45.jdk/ but my java control panel is now java 8 update 65.