Skip to content

Commit

Permalink
Merge branch 'hotfix/1'
Browse files Browse the repository at this point in the history
  • Loading branch information
epurdom committed Dec 2, 2015
2 parents e0dd421 + b305b8b commit e0d2247
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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")),
Expand Down
11 changes: 9 additions & 2 deletions R/compareChoices.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
#' }
#'

Expand Down Expand Up @@ -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"))
Expand Down
3 changes: 2 additions & 1 deletion R/findSharedClusters.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit e0d2247

Please sign in to comment.