Skip to contents

Given a TrackSOM object and a DataFrame containing cells from all time points, extract all the meta clusters, clusters, and tracking id and combine them with the cell information.

Usage

ConcatenateClusteringDetails(tracksom.result, dat, timepoint.col, timepoints)

Arguments

tracksom.result

TrackSOM object as generated by TrackSOM

dat

Dataframe containing all cells from all time points

divide.by

Character showing column name of the dataframe that indicate the time point of each cell

Value

Dataframe containing the meta cluster, cluster, and tracking ids for all the cells

Examples


library(data.table)
data_files <- sapply(c(0:4), function(i) {
  system.file("extdata", paste0("synthetic_d", i, ".fcs"), package="TrackSOM")
})
use_cols <- c("x", "y", "z")
tracksom_result <- TrackSOM(inputFiles = data_files,
                            colsToUse = use_cols,
                            nClus = 10,
                            dataFileType = ".fcs"
)
#> Reading file /home/runner/work/_temp/Library/TrackSOM/extdata/synthetic_d0.fcs
#> Reading file /home/runner/work/_temp/Library/TrackSOM/extdata/synthetic_d1.fcs
#> Reading file /home/runner/work/_temp/Library/TrackSOM/extdata/synthetic_d2.fcs
#> Reading file /home/runner/work/_temp/Library/TrackSOM/extdata/synthetic_d3.fcs
#> Reading file /home/runner/work/_temp/Library/TrackSOM/extdata/synthetic_d4.fcs
#> Building SOM
#> Mapping data to SOM
#> Building MST
#> Extracting SOM nodes for each time point
#> Running meta clustering
#> Meta clustering time point 1 with 83 SOM nodes
#> Meta clustering time point 2 with 90 SOM nodes
#> Meta clustering time point 3 with 93 SOM nodes
#> Meta clustering time point 4 with 95 SOM nodes
#> Meta clustering time point 5 with 93 SOM nodes

data <- lapply(c(0:4), function(i) {
  fread(system.file("extdata", paste0("synthetic_d", i, ".csv"), package="TrackSOM"))
})
data <- rbindlist(data)
tracksom_res <- ConcatenateClusteringDetails(
  tracksom.result = tracksom_result,
  dat = data,
  timepoint.col = 'timepoint',
  timepoints = c("Mock", "SYN-1", "SYN-2", "SYN-3", "SYN-4")
)