Main Luciernaga Function, normalized on individual cell level
Source:R/Luciernaga_QC.R
Luciernaga_QC.Rd
Main Luciernaga Function, normalized on individual cell level
Usage
Luciernaga_QC(
x,
subsets,
sample.name,
removestrings = NULL,
Verbose = FALSE,
experiment = NULL,
experiment.name = NULL,
condition = NULL,
condition.name = NULL,
AFOverlap,
unmixingcontroltype = "both",
Unstained = FALSE,
ratiopopcutoff = 0.01,
stats = "median",
Subtraction = "Internal",
desiredAF = NULL,
BeadAF = NULL,
BeadMainAF = NULL,
CellAF = NULL,
CellMainAF = NULL,
SignatureReturnNow = FALSE,
Increments,
LocalMaximaRatio = 0.15,
SecondaryPeaks = 2,
RetainedType = "normalized",
Brightness = FALSE,
ExportType,
minimalfcscutoff = 0.05,
SCData = "subtracted",
NegativeType = "default",
TotalNegatives = 500,
outpath
)
Arguments
- x
A Gating Set object (ex. gs or gs[[1]])
- subsets
The Gating Hierarchy level you will be sampling at
- sample.name
Keyword variable which samples are stored (ex. "GUID")
- removestrings
A string of character values to remove from sample.name
- Verbose
Whether to print outputs as you go.
- experiment
Provide directly experiment name (ex. "JAN2024")
- experiment.name
Keyword variable which experiment information is stored (ex. "TUBENAME")
- condition
Provide directly experiment name (ex. "JAN2024")
- condition.name
Keyword variable which experiment information is stored (ex. "TUBENAME")
- AFOverlap
A data.frame or a filepath to the CSV containing the Autofluorescence overlap of individual fluorophores for exclusion
- unmixingcontroltype
Whether your inputs are "cells", "beads" or "both"
- Unstained
Set to True when running unstained samples that don't have Unstained in the Name
- ratiopopcutoff
A numeric ratio for peak detector inclusion, default is set to 0.01 all startingcells
- stats
Whether to take "mean" or "median"
- Subtraction
Whether for single color controls to use "Internal", "Internal_General" or "External" autofluorescence
- desiredAF
Main Autofluorescence Detector (ex. "V7-A")
- BeadAF
A passed data.frame row containing the reference for bead unstained.
- BeadMainAF
The detector that corresponds to the "main" bead AF, albeit dim.
- CellAF
A passed data.frame row containing the reference for cell unstained.
- CellMainAF
The detector that corresponds to the "main" cell AF.
- SignatureReturnNow
Short circuits the function and returns signature for specified autofluorescence.
- Increments
Rounding parameter, default is set to 0.1
- LocalMaximaRatio
Height of peaks to proceed
- SecondaryPeaks
Number of Secondary Peaks, default is set to 2.
- RetainedType
Whether to return "raw" or "normalized" values for lineplots.
- Brightness
Whether sum of detectors should be returned.
- ExportType
Whether to return "fcs", "data"
- minimalfcscutoff
A ratio determining number cells needed for .fcs export
- SCData
Whether to return "subtracted" or "raw" data for single colors
- NegativeType
Whether to append a negative pop to .fcs file, "default", "artifical" or "samples"
- TotalNegatives
When setting NegativeType to "artificial" or "sample", how many events to add.
- outpath
Location where created .fcs and .csv files are sent
Examples
library(flowCore)
library(flowWorkspace)
library(openCyto)
library(data.table)
library(dplyr)
library(purrr)
library(stringr)
File_Location <- system.file("extdata", package = "Luciernaga")
FCS_Files <- list.files(path = File_Location, pattern = ".fcs",
full.names = TRUE)
CellSingleColorFiles <- FCS_Files[grep("Cells", FCS_Files)]
CellSingleColors <- CellSingleColorFiles[!str_detect("Unstained", CellSingleColorFiles)]
MyCytoSet <- load_cytoset_from_fcs(CellSingleColors[1:2],
truncate_max_range = FALSE,transformation = FALSE)
MyGatingSet <- GatingSet(MyCytoSet)
MyGates <- fread(file.path(path = File_Location, pattern = 'Gates.csv'))
MyGatingTemplate <- gatingTemplate(MyGates)
#> Adding population:singletsFSC
#> Adding population:singletsSSC
#> Adding population:singletsSSCB
#> Adding population:nonDebris
#> Adding population:lymphocytes
gt_gating(MyGatingTemplate, MyGatingSet)
#> 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.
#> finished.
removestrings <- c("DR_", "Cells", ".fcs", "-", " ")
StorageLocation <- file.path("C:", "Users", "JohnDoe", "Desktop")
FileLocation <- system.file("extdata", package = "Luciernaga")
pattern = "AutofluorescentOverlaps.csv"
AFOverlap <- list.files(path=FileLocation, pattern=pattern, full.names = TRUE)
SingleColor_Data <- map(.x=MyGatingSet[1:2], .f=Luciernaga_QC, subsets="lymphocytes",
removestrings=removestrings, sample.name="GUID", unmixingcontroltype = "cells",
Unstained = FALSE, ratiopopcutoff = 0.001, Verbose = FALSE, AFOverlap = AFOverlap,
stats = "median", ExportType = "data", SignatureReturnNow = FALSE,
outpath = TemporaryFolder, Increments=0.1, SecondaryPeaks=2,
experiment = "FirstExperiment", condition = "ILTPanel", Subtraction = "Internal",
CellAF=TheCellAF, SCData="subtracted", NegativeType="default") %>% bind_rows()