Runs Coereba for Dichotomized Gating Annotation
Usage
Utility_Coereba(
x,
subsets,
sample.name,
subsample = NULL,
columns = NULL,
notcolumns = NULL,
reference,
starter,
inverse.transform = TRUE
)
Arguments
- x
A Gating Set object
- subsets
The desired GatingHierarchy subset
- sample.name
Keyword for sample name
- subsample
An optional downsample, doesn't work with inverse.transform=TRUE
- columns
An optional way to select columns to keep.
- notcolumns
An optional way to remove select columns.
- reference
The external data.frame or path to the .csv with the specified gate split points by specimen and marker.
- starter
The column name to start the splits with
- inverse.transform
Whether to reverse the data transform after Coereba cluster is calculated, Default is set to TRUE to allow for .fcs export.
Examples
library(flowCore)
library(flowWorkspace)
library(openCyto)
library(data.table)
File_Location <- system.file("extdata", package = "Coereba")
TheCSV <- file.path(File_Location, "GateCutoffsForNKs.csv")
FCS_Files <- list.files(path = File_Location, pattern = ".fcs", full.names = TRUE)
UnmixedFCSFiles <- FCS_Files[1]
UnmixedCytoSet <- load_cytoset_from_fcs(UnmixedFCSFiles,
truncate_max_range = FALSE, transformation = FALSE)
UnmixedGatingSet <- GatingSet(UnmixedCytoSet)
Markers <- colnames(UnmixedCytoSet[[1]])
KeptMarkers <- Markers[-grep("Time|FS|SC|SS|Original|-W$|-H$|AF", Markers)]
biex_transform <- flowjo_biexp_trans(channelRange = 256, maxValue = 1000000,
pos = 4.5, neg = 0, widthBasis = -1000)
TransformList <- transformerList(KeptMarkers, biex_transform)
flowWorkspace::transform(UnmixedGatingSet, TransformList)
#> A GatingSet with 1 samples
UnmixedGates <- fread(file.path(path = File_Location,
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.
CoerebaIDs <- Utility_Coereba(x=UnmixedGatingSet[1], subsets="live",
sample.name="GROUPNAME", reference=TheCSV, starter="Spark Blue 550-A")
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `My.Data[[starter]] < New[New[[sample.name]] == name, starter]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.
#> Warning: There were 2 warnings in `mutate()`.
#> The first warning was:
#> ℹ In argument: `Cluster = case_when(...)`.
#> Caused by warning in `MyNewestData[[i]] < New[New[[sample.name]] == name, i]`:
#> ! longer object length is not a multiple of shorter object length
#> ℹ Run `dplyr::last_dplyr_warnings()` to see the 1 remaining warning.