Skip to contents

Select candidate Luciernaga output .fcs files for future use in unmixing.

Usage

Luciernaga_Tree(BrightnessFilePath, PanelPath)

Arguments

BrightnessFilePath

A path to the folder the individual brightness files are in.

PanelPath

A path to the .csv file containing the panel information. It should include only the fluorophores captured by the BrightnessFiles

Value

A data.frame listing the candidate .fcs files for future unmixing use.

Examples


library(flowCore)
library(flowWorkspace)
library(openCyto)
library(data.table)
library(dplyr)
library(purrr)
library(stringr)

StorageLocation <- file.path(tempdir(), "LuciernagaTreeExample")
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.

UnstainedFCSFiles <- FCS_Files[grep("Unstained", FCS_Files)]
UnstainedCells <- UnstainedFCSFiles[-grep("Beads", UnstainedFCSFiles)]
MyUnstainedCytoSet <- load_cytoset_from_fcs(UnstainedCells[1],
  truncate_max_range = FALSE,transformation = FALSE)
MyUnstainedGatingSet <- GatingSet(MyUnstainedCytoSet)
gt_gating(MyGatingTemplate, MyUnstainedGatingSet)
#> 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.
#> 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")

Unstained_Data  <- map(.x=MyUnstainedGatingSet[1], .f=Luciernaga_QC,
 subsets="nonDebris", removestrings=removestrings, sample.name="GUID",
 unmixingcontroltype = "cells", Unstained = TRUE, 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", minimalfcscutoff=0.01)

PanelPath <- file.path(File_Location, "UnmixingPanel.csv")
MoveThese <- Luciernaga_Tree(BrightnessFilePath = StorageLocation,
 PanelPath = PanelPath)