Visualize cosine similarity of raw .fcs files to evaluate single color controls.
Source:R/Luciernaga_FCSToReport.R
Luciernaga_FCSToReport.Rd
Visualize cosine similarity of raw .fcs files to evaluate single color controls.
Usage
Luciernaga_FCSToReport(
path,
reference,
stats = "median",
LinePlots = TRUE,
CosinePlots = TRUE,
StackedBarPlots = TRUE,
HeatmapPlots = TRUE,
RetainedType,
experiment,
condition,
TheSummary = TRUE
)
Arguments
- path
The location to the folder where the Luciernaga .fcs files are stored
- reference
A path to a .csv file or a dataframe containing Fluorophore and Detector column information for the panel.
- stats
Whether to use the median or mean for fluorescent intensity.
- LinePlots
Return this kind of plot, default is set to TRUE
- CosinePlots
Return this kind of plot, default is set to TRUE
- StackedBarPlots
Return this kind of plot, default is set to TRUE
- HeatmapPlots
Return this kind of plot, default is set to TRUE
- RetainedType
Whether the data.frame contains "raw" or "normalized" values
- experiment
Provide directly experiment name (ex. "JAN2024")
- condition
Provide directly experiment name (ex. "JAN2024")
- TheSummary
Whether summarized (TRUE) or individual cells (FALSE).
Examples
library(flowCore)
library(flowWorkspace)
library(openCyto)
library(data.table)
library(dplyr)
#>
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:data.table’:
#>
#> between, first, last
#> The following object is masked from ‘package:flowCore’:
#>
#> filter
#> The following objects are masked from ‘package:stats’:
#>
#> filter, lag
#> The following objects are masked from ‘package:base’:
#>
#> intersect, setdiff, setequal, union
library(purrr)
#>
#> Attaching package: ‘purrr’
#> The following object is masked from ‘package:data.table’:
#>
#> transpose
library(stringr)
StorageLocation <- file.path(tempdir(), "LuciernagaFCSToReportExample")
if (!dir.exists(StorageLocation)) {dir.create(StorageLocation)}
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(".fcs", "(", ")", "Cells")
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 = "fcs",
Brightness=TRUE, SignatureReturnNow = FALSE,outpath = StorageLocation,
Increments=0.1, SecondaryPeaks=2, experiment = "FirstExperiment",
condition = "ILTPanel", Subtraction = "Internal", CellAF=TheCellAF,
SCData="subtracted",NegativeType="default")
TheLuciernagaOutputs_FCS <- list.files(StorageLocation, pattern="fcs", full.names = TRUE)
TheLuciernagaOutputs_CSV <- list.files(StorageLocation, pattern="csv", full.names = TRUE)
PanelPath <- file.path(File_Location, "Panel.csv")
ReportOutput <- Luciernaga_FCSToReport(path=StorageLocation, reference=PanelPath,
stats="median", RetainedType = "normalized", experiment="FirstExperiment",
condition="ILTExperiment", TheSummary = TRUE)