Skip to contents

Concatenate a gs based on subset and optional subsample

Usage

Utility_Concatinate(
  gs,
  sample.name,
  removestrings,
  subsets,
  subsample = NULL,
  ReturnType,
  newName,
  outpath = NULL,
  export = FALSE,
  inverse.transform = FALSE
)

Arguments

gs

A gating set object

sample.name

Keyword specifying sample name

removestrings

Value to be removed from sample name

subsets

The gating hierarchy subset you want to include

subsample

Default is set to NULL. If down-sample is desired, Total number of events to subsample from each specimen

ReturnType

Whether to return as a "data.frame", a "flow.frame", or export to an "fcs" file to the outpath location

newName

File Name for the Concatenate File

outpath

Location to store the concatenated file

export

Whether to export as a .fcs file.

inverse.transform

Whether to reverse the GatingSet Transform on the data, default is set to FALSE.

Value

A concatenated data.frame, flow.frame or fcs file, with reference .csv for the specimen information

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:2]
UnmixedCytoSet <- load_cytoset_from_fcs(UnmixedFCSFiles[1:2],
  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
#> 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")

ConcatinatedReturn <- Utility_Concatinate(gs=UnmixedGatingSet,
  sample.name = "GROUPNAME", removestrings=removestrings,
  subsets="live", subsample = 2000, ReturnType = "flow.frame",
  newName = "MyConcatinatedFile", outpath = StorageLocation, export = FALSE)
#> INF071 has been processed
#> INF149 has been processed