run.chronoclust: Run the ChronoClust algorithm

Description Usage Arguments Author(s) See Also Examples

View source: R/run.chronoclust.R

Description

Method to run ChronoClust clustering algorithm. For this to work properly, a Python session must already be embedded within the currently running R session. This is because ChronoClust is originally written in Python 3. Spectre includes a function run.prepare.chronoclust that uses Reticulate to prepare and embed Python session within R session.

Usage

1
run.chronoclust(dat, timepoint.col, use.cols, config=NULL, clust.name = "ChronoClust_cluster")

Arguments

dat

NO DEFAULT. Data.frame. Data to be clustered.

timepoint.col

NO DEFAULT. Column name which represents the time point of each cell (data point) in dat.

timepoints

NO DEFAULT. The time points (in order).

use.cols

NO DEFAULT. Vector of column names to use for clustering.

config

DEFAULT = NULL. A named numeric list. List containing the value of ChronoClust's hyper-parameter. The name of the element must correspond to one of ChronoClust's parameter name such as epsilon, upsilon, etc. The numeric value must correspond to the value assigned for the corresponding parameter. Only include parameters that you want to override. Those you prefer to set to default value need not be included in the list.

clust.name

DEFAULT = "ChronoClust_cluster". Character. Name of the resulting 'cluster'

clean.up

DEFAULT = FALSE. Whether to remove the files chronoclust produces

Author(s)

Givanna Putri, givanna.haryonoputri@sydney.edu.au

See Also

https://github.com/ghar1821/Chronoclust for ChronoClust's Python implementation.

run.prepare.chronoclust for how to embed Python session within R session.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Read data
data.list <- Spectre::read.files(file.loc = PrimaryDirectory, file.type = ".csv", do.embed.file.names = TRUE)
cell.dat <- Spectre::do.merge.files(dat = data.list)

# Specify clustering column
cluster.cols <- names(cell.dat)[c(1:8,10:20)]

# Specify time point column
timepoint.col <- "Group"
timepoints <- c("Mock", "WNV-01", "WNV-02", "WNV-03", "WNV-04", "WNV-05")

# Prepare Python session
run.prepare.chronoclust(environment_name = "chronoclust-R",
                        create_environment = TRUE,
                        install_dependencies = TRUE)


# Specify the parameters that need to be overriden
config <- list(beta = 0.2,
               delta = 0.05,
               epsilon = 0.03,
               mu = 0.01)

cell.dat <- Spectre::run.chronoclust(dat=cell.dat,
                                     timepoint.col=timepoint.col,
                                     timepoints=timepoints,
                                     use.cols=cluster.cols,
                                     config=config)

sydneycytometry/Spectre documentation built on March 20, 2021, 2:15 a.m.