Skip to contents

Runs tSNE (Rtsne implementation)

Usage

Utility_tSNE(
  x,
  sample.name,
  removestrings,
  subset,
  columns = NULL,
  notcolumns = NULL,
  subsample = NULL,
  export = FALSE,
  outpath = NULL,
  max_iter = 1000,
  perplexity = 30,
  ...
)

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 as fcs files to specified outpath.

outpath

Location to store new .fcs files

max_iter

Rtsne argument, default is set to 1000

perplexity

Rtsne argument, default is set to 30

...

Other Arguments to pass to Rtsne

Value

tSNE 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")

tSNE_Output <- Utility_tSNE(x=UnmixedGatingSet[[1]], sample.name = "TUBENAME",
 removestrings=removestrings, subset = "live", columns=SubsetMarkers, export=FALSE)