Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fixed plotCluster
  • Loading branch information
hyb13001 committed Aug 1, 2020
1 parent 3d98755 commit 2674f98
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .Rproj.user/43F9182D/pcs/source-pane.pper
@@ -1,3 +1,3 @@
{
"activeTab": 1
"activeTab": 3
}
4 changes: 2 additions & 2 deletions .Rproj.user/43F9182D/pcs/workbench-pane.pper
@@ -1,5 +1,5 @@
{
"TabSet1": 0,
"TabSet2": 0,
"TabSet1": 3,
"TabSet2": 1,
"TabZoom": {}
}
2 changes: 1 addition & 1 deletion .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\":\"\"}"
Expand Down
5 changes: 3 additions & 2 deletions .Rproj.user/43F9182D/sources/prop/08EF61B6
@@ -1,4 +1,5 @@
{
"cursorPosition": "3,22",
"scrollLine": "0"
"cursorPosition": "328,64",
"scrollLine": "326",
"last_setup_crc32": ""
}
2 changes: 1 addition & 1 deletion .Rproj.user/43F9182D/sources/prop/73839B89
@@ -1,4 +1,4 @@
{
"cursorPosition": "13,29",
"cursorPosition": "3,14",
"scrollLine": "0"
}
4 changes: 2 additions & 2 deletions .Rproj.user/43F9182D/sources/prop/8F178DC0
@@ -1,4 +1,4 @@
{
"cursorPosition": "428,28",
"scrollLine": "0"
"cursorPosition": "639,0",
"scrollLine": "625"
}
1 change: 1 addition & 0 deletions .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"
2 changes: 1 addition & 1 deletion 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 <haim.bar@uconn.edu>
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.
Expand Down
19 changes: 12 additions & 7 deletions R/edgefinder.R
Expand Up @@ -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{
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Binary file removed edgefinder_0.1.5.tar.gz
Binary file not shown.
4 changes: 3 additions & 1 deletion man/plotCluster.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified vignettes/SIMcluster1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/WTcluster5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/WTcluster9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion vignettes/edgefinder.Rmd
Expand Up @@ -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
Expand Down
Binary file modified vignettes/edgefinder.pdf
Binary file not shown.

0 comments on commit 2674f98

Please sign in to comment.