Skip to contents

Runs UMAP (uwot implementation)

Usage

Utility_UMAP(
  x,
  sample.name,
  removestrings,
  subset,
  columns = NULL,
  notcolumns = NULL,
  subsample = NULL,
  export = FALSE,
  outpath = NULL,
  metric = "euclidean",
  n_neighbors = 15,
  min_dist = 0.5,
  ...
)

Arguments

x

A gating set object

sample.name

Keyword for which sample name is stored

removestrings

A list of things to remove from sample.name

subset

The subset of interest from gating hierarchy

columns

Which columns to use. Not combinable with notcolumns, use one or other.

notcolumns

Which columns not to use. Not combinable with columns, use one or other.

subsample

If downsampling is wanted.

export

When set to TRUE returns fcs files to specified outpath.

outpath

Location to store new .fcs files

metric

umap Argument, default is set to "euclidean"

n_neighbors

umap Argument, default is set to 15

min_dist

umap Argument, default is set to 0.5

...

Other arguments to pass to umap()

Value

UMAP axes bound to a flowframe or fcs file

Examples


library(BiocGenerics)
library(flowCore)
library(flowWorkspace)
library(openCyto)
library(data.table)

File_Location <- system.file("extdata", package = "Luciernaga")
FCS_Files <- list.files(path = File_Location, pattern = ".fcs",
  full.names = TRUE)
Unmixed_FullStained <- FCS_Files[grep("Unmixed", FCS_Files)]
UnmixedFCSFiles <- Unmixed_FullStained[1]
UnmixedCytoSet <- load_cytoset_from_fcs(UnmixedFCSFiles[1],
  truncate_max_range = FALSE,transformation = FALSE)
UnmixedGatingSet <- GatingSet(UnmixedCytoSet)
Markers <- colnames(UnmixedCytoSet)
KeptMarkers <- Markers[-grep("Time|FS|SC|SS|Original|-W$|-H$|AF", Markers)]
MyBiexponentialTransform <- flowjo_biexp_trans(channelRange = 256,
  maxValue = 1000000,pos = 4.5, neg = 0, widthBasis = -1000)
TransformList <- transformerList(KeptMarkers, MyBiexponentialTransform)
UnmixedGatingSet <- flowWorkspace::transform(UnmixedGatingSet, TransformList)
FileLocation <- system.file("extdata", package = "Luciernaga")
UnmixedGates <- fread(file.path(path = FileLocation, pattern = 'GatesUnmixed.csv'))
UnmixedGating <- gatingTemplate(UnmixedGates)
#> Adding population:singletsFSC
#> Adding population:singletsSSC
#> Adding population:singletsSSCB
#> Adding population:nonDebris
#> Adding population:lymphocytes
#> Adding population:live
gt_gating(UnmixedGating, UnmixedGatingSet)
#> Gating for 'singletsFSC'
#> done!
#> done.
#> Gating for 'singletsSSC'
#> done!
#> done.
#> Gating for 'singletsSSCB'
#> done!
#> done.
#> Gating for 'nonDebris'
#> done!
#> done.
#> Gating for 'lymphocytes'
#> The prior specification has no effect when usePrior=no
#> Using the serial version of flowClust
#> done!
#> done.
#> Gating for 'live'
#> done!
#> done.
#> finished.

removestrings <-  c("DTR_", ".fcs")
StorageLocation <- file.path("C:", "Users", "JohnDoe", "Desktop")

Markers <- colnames(UnmixedCytoSet)
KeptMarkers <- Markers[-grep("Time|FS|SC|SS|Original|-W$|-H$|AF", Markers)]
SubsetMarkers <- c("BUV496-A", "BUV805-A", "Pacific Blue-A", "BV711-A",
  "BV786-A", "Spark Blue 550-A", "PE-A", "APC-Fire 750-A")

UMAP_Output <- Utility_UMAP(x=UnmixedGatingSet[[1]], sample.name="GUID",
  removestrings=c("_Cells", ".fcs"), subset="nonDebris",
  columns=KeptMarkers, export=FALSE)