R/clusterFCSbyCIPHE.R

Defines functions clusterFCSbyCIPHE

clusterFCSbyCIPHE <- function(flow.frame, args=list(200), markers=NULL, methodes="K-means"){
  if(is.null(flow.frames)){return(NULL)}
  if(is.null(NULL)){markers <- colnames(flow.frame)}
  if(is.null(methodes)){methodes <- "K-means"}
  if(methodes == "K-means" && length(args)==1){
    data <- exprs(flow.frames)[,markers]
    cluster <- kmeans(data,centers=args[[1]],iter.max = 1000)$cluster
    return(cluster)
  }
  if(methodes == "CLARA" && length(args)==2){
    data <- exprs(flow.frames)[,markers]
    cluster <- clara(data,k=args[[1]],samples=args[[2]])$cluster
    return(cluster)
  }
  if(methodes == "FlowSOM" && length(args)==2){
    fcs <- flow.frames[,markers]
    BuildSOM(ReadInput(fcs,compensate = F,transform = F),
             xdim=args[[1]], ydim=args[[2]], colsToUse=c(1:dim(fcs)[2]))
    mst <- BuildMST(fs)
    cluster <- mst$map$mapping[,1]
    return(cluster)
  }
}
Selkie-13/Jarvis documentation built on May 1, 2020, 4:12 a.m.