Skip to contents

Run the TrackSOM algorithm. Will run Tracking by default with no merging allowed.

Usage

TrackSOM (inputFiles, colsToUse, maxMeta, ...)

Arguments

inputFiles

NO DEFAULT. Either a vector of filenames or a list of `data.table` objects or a `data.table` object. If a vector, each element should correspond to a file belonging to a timepoint. If a list, each element should correspond to a `data.table` object belonging to a timepoint. If a `data.table` object, make sure `timepoints` and `timepointCol` is not NULL. Make sure the vector or list is ordered such that the 1st element corresponds to the 1st time-point, the 2nd element corresponds to the 2nd time-point, etc.

colsToUse

NO DEFAULT. Vector of column names to be used to train SOM. One list which must be same for all time periods.

timepoints

DEFAULT NULL. A vector of time-points in order. Only used if inputFiles is a `data.table` object

timepointCol

DEFAULT NULL. A character denoting the column in inputFile that corresponds to the time-point each cell belongs to. Only used if inputFiles is a `data.table` object

tracking

DEFAULT TRUE. Whether to track cluster changes (TRUE), or just cluster (NULL).

noMerge

DEFAULT FALSE. Whether to allow meta-cluster merging (FALSE) or not (TRUE).

maxMeta

DEFAULT NULL. Numeric. Maximum number of meta clusters for all time point. TrackSOM use this to limit the number of meta clusters allowed when it is given the freedom to decide the optimum number of meta clusters.

nClus

DEFAULT NULL. Numeric or Vector of numbers. If single number, TrackSOM will produce same number of meta clusters per time point. Otherwise, it will use the entries in the vector. Number of meta clusters must be at least 3 for each time point.

seed

DEFAULT 42. Random seed number.

xdim

DEFAULT 10. SOM grid size.

ydim

DEFAULT 10. SOM grid size.

...

other parameters for FlowSOM functions ReadInput, BuildSOM and BuildMST. See FlowSOM vignette for specific parameter information

Value

A list containing the following elements: 1) FlowSOM: a list which is very similar to output of FlowSOM function. 2) Metaclustering: a list of two lists: 2.1) Metaclustering: contains the clustering levels for each node in grid for each time step. 2.2) mcPerCell: contains the clusering levels for each datapoint for each time step. 3) Tracking: a list of containing the unique IDs as determined by the tracking function for each time step

Examples


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
tracksom_res <- ExportClusteringDetailsOnly(tracksom_result)