From 3cebca6d45525e1771f45bebb7ccf9a60bc27e6a Mon Sep 17 00:00:00 2001 From: Elizabeth Purdom Date: Tue, 1 Dec 2015 22:00:04 -0800 Subject: [PATCH 1/2] fixed error in findSharedClusters when samples have no non -1 in common --- R/compareChoices.R | 11 +++++++++-- R/findSharedClusters.R | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/R/compareChoices.R b/R/compareChoices.R index 03f71ea1..1791c166 100644 --- a/R/compareChoices.R +++ b/R/compareChoices.R @@ -57,7 +57,7 @@ #' system.time(clusterTrack<-compareChoices(simData, ks=2:15, #' alphas=c(0.1,0.2,0.3), findBestK=c(TRUE,FALSE),sequential=c(FALSE), #' subsample=c(FALSE),removeSil=c(TRUE), clusterMethod="pam", -#' clusterArgs = list(minSize = 5,kRange=2:15),ncores=1,random.seed=48120)) +#' clusterDArgs = list(minSize = 5,kRange=2:15),ncores=1,random.seed=48120)) #' } #' @@ -97,11 +97,18 @@ removeSil=FALSE, subsample=FALSE,silCutoff=0, #also deals with just in case the user gave duplicated values of something by mistake. typeK<-which(param[,"clusterMethod"] %in% c("pam")) if(length(typeK)>0){ - param[typeK,"alpha"]<-0.01 #just a nothing value + param[typeK,"alpha"]<-NA #just a nothing value whFindBestK<-which(param[,"findBestK"]) if(length(whFindBestK)>0){ #remove 'k' and see if same if(!"kRange" %in% names(clusterDArgs)) clusterDArgs[["kRange"]]<-ks + #if findBestK=TRUE, and sequential=FALSE, then user needs to set k via subsampleArgs param[whFindBestK,"k"]<-NA + whNoSeq<-which(!param[,"sequential"]) + if(length(intersect(whFindBestK,whNoSeq))>0){ + if(is.null(subsampleArgs[["k"]])) stop("must provide k in subsampleArgs for those with findBestK=TRUE and sequential=FALSE") + # else param[intersect(whFindBestK,whNoSeq),"k"]<-subsampleArgs[["k"]] + } + } } type01<-which(param[,"clusterMethod"] %in% c("hierarchical","tight")) diff --git a/R/findSharedClusters.R b/R/findSharedClusters.R index 00126896..d42b1926 100644 --- a/R/findSharedClusters.R +++ b/R/findSharedClusters.R @@ -43,7 +43,8 @@ findSharedClusters<-function(clusterMat,proportion=1,clusterFunction="hierarchic ##Make clusterMat character, just in case clusterMat<-apply(clusterMat,2,as.character) clusterMat[clusterMat== "-1"]<-NA - sharedPerct<-.hammingdist(t(clusterMat)) #works on columns. gives a nsample x nsample matrix back + sharedPerct<-.hammingdist(t(clusterMat)) #works on columns. gives a nsample x nsample matrix back. + sharedPerct[is.na(sharedPerct)|is.nan(sharedPerct)]<-0 #have no clusterings for which they are both not '-1' cl<-clusterD(D=sharedPerct,clusterFunction=clusterFunction,alpha = 1-proportion, minSize=minSize, format="vector",clusterArgs=list(evalClusterMethod=c("average"))) if(plot && require(NMF)) NMF::aheatmap(sharedPerct,annCol=data.frame("Cluster"=factor(cl)),Colv="Rowv",annColors=list(bigPalette)) From b305b8bfee6fc573f8490e104a2fd300c33fb65e Mon Sep 17 00:00:00 2001 From: Elizabeth Purdom Date: Tue, 1 Dec 2015 22:01:18 -0800 Subject: [PATCH 2/2] update description: version number --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index e7a78d4e..5ceca4bd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: clusterCells Title: Compare clusterings for single-cell sequencing -Version: 0.0.0.9000 +Version: 0.0.0.9002 Description: This package provides functions for running and comparing many different clusterings of single-cell sequencing data. Authors@R: c(person("Elizabeth", "Purdom", email = "epurdom@stat.berkeley.edu", role = c("aut", "cre", "cph")),