diff --git a/.Rproj.user/43F9182D/pcs/source-pane.pper b/.Rproj.user/43F9182D/pcs/source-pane.pper index b074a4f..28a3c2e 100644 --- a/.Rproj.user/43F9182D/pcs/source-pane.pper +++ b/.Rproj.user/43F9182D/pcs/source-pane.pper @@ -1,3 +1,3 @@ { - "activeTab": 1 + "activeTab": 3 } \ No newline at end of file diff --git a/.Rproj.user/43F9182D/pcs/workbench-pane.pper b/.Rproj.user/43F9182D/pcs/workbench-pane.pper index 75e70e9..1893013 100644 --- a/.Rproj.user/43F9182D/pcs/workbench-pane.pper +++ b/.Rproj.user/43F9182D/pcs/workbench-pane.pper @@ -1,5 +1,5 @@ { - "TabSet1": 0, - "TabSet2": 0, + "TabSet1": 3, + "TabSet2": 1, "TabZoom": {} } \ No newline at end of file diff --git a/.Rproj.user/43F9182D/persistent-state b/.Rproj.user/43F9182D/persistent-state index 82465a3..e9fde1f 100644 --- a/.Rproj.user/43F9182D/persistent-state +++ b/.Rproj.user/43F9182D/persistent-state @@ -1,6 +1,6 @@ build-last-errors="[]" build-last-errors-base-dir="~/Dropbox/Packages/edgefinder/" -build-last-outputs="[{\"type\":0,\"output\":\"==> devtools::document(roclets = c('rd', 'collate', 'namespace', 'vignette'))\\n\\n\"},{\"type\":2,\"output\":\"Updating edgefinder documentation\\n\"},{\"type\":2,\"output\":\"Loading edgefinder\\n\"},{\"type\":1,\"output\":\"Writing NAMESPACE\\n\"},{\"type\":1,\"output\":\"Writing NAMESPACE\\n\"},{\"type\":2,\"output\":\"Updating vignettes\\n\"},{\"type\":1,\"output\":\"Documentation completed\\n\\n\"},{\"type\":0,\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source edgefinder\\n\\n\"},{\"type\":1,\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’\\n\"},{\"type\":1,\"output\":\"* installing *source* package ‘edgefinder’ ...\\n\"},{\"type\":1,\"output\":\"** using staged installation\\n\"},{\"type\":1,\"output\":\"** R\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** data\\n\"},{\"type\":1,\"output\":\"*** moving datasets to lazyload DB\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** byte-compile and prepare package for lazy loading\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** help\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"*** installing help indices\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** building package indices\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** installing vignettes\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package can be loaded from temporary location\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package can be loaded from final location\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\"},{\"type\":1,\"output\":\"* DONE (edgefinder)\\n\"},{\"type\":1,\"output\":\"\"}]" +build-last-outputs="[{\"type\":0,\"output\":\"==> devtools::document(roclets = c('rd', 'collate', 'namespace', 'vignette'))\\n\\n\"},{\"type\":2,\"output\":\"Updating edgefinder documentation\\n\"},{\"type\":2,\"output\":\"Loading edgefinder\\n\"},{\"type\":1,\"output\":\"Writing NAMESPACE\\n\"},{\"type\":1,\"output\":\"Writing NAMESPACE\\n\"},{\"type\":2,\"output\":\"Updating vignettes\\n\"},{\"type\":1,\"output\":\"Documentation completed\\n\\n\"},{\"type\":0,\"output\":\"==> R CMD INSTALL --no-multiarch --with-keep.source edgefinder\\n\\n\"},{\"type\":1,\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library’\\n\"},{\"type\":1,\"output\":\"* installing *source* package ‘edgefinder’ ...\\n\"},{\"type\":1,\"output\":\"** using staged installation\\n\"},{\"type\":1,\"output\":\"** R\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** data\\n\"},{\"type\":1,\"output\":\"*** moving datasets to lazyload DB\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** byte-compile and prepare package for lazy loading\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** help\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"*** installing help indices\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** building package indices\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** installing vignettes\\n\"},{\"type\":1,\"output\":\"** testing if installed package can be loaded from temporary location\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package can be loaded from final location\\n\"},{\"type\":1,\"output\":\"\"},{\"type\":1,\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\"},{\"type\":1,\"output\":\"* DONE (edgefinder)\\n\"},{\"type\":1,\"output\":\"\"}]" compile_pdf_state="{\"tab_visible\":false,\"running\":false,\"target_file\":\"\",\"output\":\"\",\"errors\":[]}" files.monitored-path="" find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":false,\"ignoreCase\":false,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOn\":[],\"matchOff\":[],\"replaceMatchOn\":[],\"replaceMatchOff\":[]},\"running\":false,\"replace\":false,\"preview\":false,\"gitFlag\":false,\"replacePattern\":\"\"}" diff --git a/.Rproj.user/43F9182D/sources/prop/08EF61B6 b/.Rproj.user/43F9182D/sources/prop/08EF61B6 index 48b1b22..97a9276 100644 --- a/.Rproj.user/43F9182D/sources/prop/08EF61B6 +++ b/.Rproj.user/43F9182D/sources/prop/08EF61B6 @@ -1,4 +1,5 @@ { - "cursorPosition": "3,22", - "scrollLine": "0" + "cursorPosition": "328,64", + "scrollLine": "326", + "last_setup_crc32": "" } \ No newline at end of file diff --git a/.Rproj.user/43F9182D/sources/prop/73839B89 b/.Rproj.user/43F9182D/sources/prop/73839B89 index 128e931..a1be1af 100644 --- a/.Rproj.user/43F9182D/sources/prop/73839B89 +++ b/.Rproj.user/43F9182D/sources/prop/73839B89 @@ -1,4 +1,4 @@ { - "cursorPosition": "13,29", + "cursorPosition": "3,14", "scrollLine": "0" } \ No newline at end of file diff --git a/.Rproj.user/43F9182D/sources/prop/8F178DC0 b/.Rproj.user/43F9182D/sources/prop/8F178DC0 index 32e8647..d085d65 100644 --- a/.Rproj.user/43F9182D/sources/prop/8F178DC0 +++ b/.Rproj.user/43F9182D/sources/prop/8F178DC0 @@ -1,4 +1,4 @@ { - "cursorPosition": "428,28", - "scrollLine": "0" + "cursorPosition": "639,0", + "scrollLine": "625" } \ No newline at end of file diff --git a/.Rproj.user/shared/notebooks/paths b/.Rproj.user/shared/notebooks/paths index 5a20786..51dc0e0 100644 --- a/.Rproj.user/shared/notebooks/paths +++ b/.Rproj.user/shared/notebooks/paths @@ -1 +1,2 @@ +/Users/haim/Dropbox/Packages/edgefinder/vignettes/edgefinder.Rmd="248C74FE" /Users/haim/Dropbox/Projects/DIADEM/newres.R="FD8D0F70" diff --git a/DESCRIPTION b/DESCRIPTION index c13a239..4d07f67 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: edgefinder Type: Package Title: Detect Edges in Sparse Co-expression Graphs -Version: 0.1.5 +Version: 0.1.6 Author: Haim Bar and Seojin Bang Maintainer: Haim Bar Description: Finding edges in co-expression graphs, based on "A Mixture Model to Detect Edges in Sparse Co-expression Graphs", Haim Bar and Seojin Bang. See more details in the vignettes. diff --git a/R/edgefinder.R b/R/edgefinder.R index fe1c191..c64b0b9 100644 --- a/R/edgefinder.R +++ b/R/edgefinder.R @@ -586,6 +586,7 @@ plotBitmapCC <- function(AdjMat, clusterInfo=NULL, orderByCluster=FALSE, showMin #' @param AdjMat An adjacency Matrix (0/1). #' @param clustNo The chosen cluster. #' @param clusterInfo Obtained from graphComponents. +#' @param labels If set to TRUE, show node names (default=FALSE). #' @export #' @examples #' \donttest{ @@ -594,7 +595,7 @@ plotBitmapCC <- function(AdjMat, clusterInfo=NULL, orderByCluster=FALSE, showMin #' WTComp <- graphComponents(WTres$AdjMat) #' plotCluster(WTres$AdjMat, 5, WTComp) #' } -plotCluster <- function(AdjMat, clustNo, clusterInfo=NULL) { +plotCluster <- function(AdjMat, clustNo, clusterInfo=NULL, labels=FALSE) { if(is.null(clusterInfo)) clusterInfo <- graphComponents(AdjMat) ids <- which(clusterInfo$clustNo == clustNo) @@ -613,16 +614,20 @@ plotCluster <- function(AdjMat, clustNo, clusterInfo=NULL) { opacity <- opacity/max(opacity) plot(rads*cos(thetas), rads*sin(thetas),cex=sizes*3, pch=19,axes=F, xlab="",ylab="",col=rgb(red = 0, green = 0, blue = 1, alpha = opacity)) - for (i in 1:(ncol(tmpA)-1)) { - nbrs <- which(tmpA[i,i:ncol(tmpA)] == 1) - for (j in i:ncol(tmpA)) { - lines(c(rads[i]*cos(thetas[i]), rads[j]*cos(thetas[j])), - c(rads[i]*sin(thetas[i]), rads[j]*sin(thetas[j])), - col="grey88", lwd=0.5) + for (i in 1:ncol(tmpA)) { + nbrs <- setdiff(which(tmpA[i,] == 1), 1:i) + if(length(nbrs) > 0) { + for (j in nbrs) { + lines(c(rads[i]*cos(thetas[i]), rads[j]*cos(thetas[j])), + c(rads[i]*sin(thetas[i]), rads[j]*sin(thetas[j])), + col="grey88", lwd=0.5) + } } } points(rads*cos(thetas), rads*sin(thetas),cex=sizes*3, pch=19, col=rgb(red = 0, green = 0, blue = 1, alpha = opacity)) + if (labels) + text(rads*cos(thetas), rads*sin(thetas), tmpclusterInfo$labels, pos=3) ctr <- which(tmpclusterInfo$iscenter==1) points(rads[ctr]*cos(thetas[ctr]), rads[ctr]*sin(thetas[ctr]),pch=21, cex=sizes[ctr]*3, col="black",lwd=2) diff --git a/edgefinder_0.1.5.tar.gz b/edgefinder_0.1.5.tar.gz deleted file mode 100644 index ff029fb..0000000 Binary files a/edgefinder_0.1.5.tar.gz and /dev/null differ diff --git a/man/plotCluster.Rd b/man/plotCluster.Rd index b1c949b..4e596e6 100644 --- a/man/plotCluster.Rd +++ b/man/plotCluster.Rd @@ -4,7 +4,7 @@ \alias{plotCluster} \title{Plot cluster network} \usage{ -plotCluster(AdjMat, clustNo, clusterInfo = NULL) +plotCluster(AdjMat, clustNo, clusterInfo = NULL, labels = FALSE) } \arguments{ \item{AdjMat}{An adjacency Matrix (0/1).} @@ -12,6 +12,8 @@ plotCluster(AdjMat, clustNo, clusterInfo = NULL) \item{clustNo}{The chosen cluster.} \item{clusterInfo}{Obtained from graphComponents.} + +\item{labels}{If set to TRUE, show node names (default=FALSE).} } \description{ Plot a cluster network with all the nodes and edges - the central node is marked by a black circle. The radius of each point corresponds to its degree. The opacity corresponds to the percentage of edges from the node that is in the cluster (the darker it is, the larger the percentage of edges is within the cluster.) The distance from the center corresponds to the relative dissimilarity with the central node. This is computed as the number of neighbors the node and the central node do not have in common. diff --git a/vignettes/SIMcluster1.png b/vignettes/SIMcluster1.png index 3ae598e..4f6b2d3 100644 Binary files a/vignettes/SIMcluster1.png and b/vignettes/SIMcluster1.png differ diff --git a/vignettes/WTcluster5.png b/vignettes/WTcluster5.png index 7c878d9..3ea34e9 100644 Binary files a/vignettes/WTcluster5.png and b/vignettes/WTcluster5.png differ diff --git a/vignettes/WTcluster9.png b/vignettes/WTcluster9.png index 8efb0e6..606df47 100644 Binary files a/vignettes/WTcluster9.png and b/vignettes/WTcluster9.png differ diff --git a/vignettes/edgefinder.Rmd b/vignettes/edgefinder.Rmd index 5a302c3..9925b32 100644 --- a/vignettes/edgefinder.Rmd +++ b/vignettes/edgefinder.Rmd @@ -174,7 +174,7 @@ clusters 5 and 9 we use the following syntax: ``` plotCluster(WTres$AdjMat,5,WTComp) -plotCluster(WTres$AdjMat,5,WTComp) +plotCluster(WTres$AdjMat,9,WTComp) ``` The central node is marked by a black circle. The radius of each point corresponds diff --git a/vignettes/edgefinder.pdf b/vignettes/edgefinder.pdf index a24ed99..77b150b 100644 Binary files a/vignettes/edgefinder.pdf and b/vignettes/edgefinder.pdf differ