retain: Decides if a file should be retiained or removed based on its...

Description Usage Arguments Details Value See Also Examples

View source: R/retain.R

Description

Function to determine what files to retain and finally read from the flow cytometer FCS file.

Usage

1
2
retain(meta_files, make_decision = c("maxi", "mini", "unique"),
  Status = "Status", CellspML = "CellspML")

Arguments

meta_files

dataframe from meta file that has been preprocessed by the goodfcs function.

make_decision

decision to be made should more than one cells/μ L be good.

Status

column name in meta_files containing status obtained from the goodfcs function.

CellspML

column name in meta_files containing cells/μ L measurements.

Details

It is typically not known in advance which dilution level would result in the desired cells/μ L, therefore the samples are ran through the flow cytometer at two or more dilution levels. Out of these, one has to decide which to retain and finally use for further analysis. This function and goodfcs are to help you decide that. If more than one of the dilution levels are judged good, the option make_decision = "maxi" will give "Retain" to the row with the maximum cells/μ L while the opposite occurs for make_decision = "mini". make_decision = "unique" i there is only one measurement for that particular sample, while make_decision = "maxi" and make_decision = "mini" should be used for files with more than one measurement for the sample in question.

Value

a character vector with entries "Retain" for a file to be retained or "No!" for a file to be discarded.

See Also

goodfcs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
 metadata <- system.file("extdata", "2019-03-25_Rstarted.csv", package = "cyanoFilter",
              mustWork = TRUE)
 metafile <- read.csv(metadata, skip = 7, stringsAsFactors = FALSE,
                      check.names = TRUE, encoding = "UTF-8")
 metafile <- metafile[, 1:65] #first 65 columns contain useful information
 #extract the part of the Sample.ID that corresponds to BS4 or BS5
 metafile$Sample.ID2 <- stringr::str_extract(metafile$Sample.ID, "BS*[4-5]")
 #clean up the Cells.muL column
 names(metafile)[which(stringr::str_detect(names(metafile), "Cells."))] <- "CellspML"
 metafile$Status <- cyanoFilter::goodfcs(metafile = metafile, col_cpml = "CellspML",
                            mxd_cellpML = 1000, mnd_cellpML = 50)
 metafile$Retained <- NULL
 # first 3 rows contain BS4 measurements at 3 dilution levels
 metafile$Retained[1:3] <- cyanoFilter::retain(meta_files = metafile[1:3,], make_decision = "maxi",
                   Status = "Status", CellspML = "CellspML")
 # last 3 rows contain BS5 measurements at 3 dilution levels as well
 metafile$Retained[4:6] <- cyanoFilter::retain(meta_files = metafile[4:6,], make_decision = "maxi",
                   Status = "Status", CellspML = "CellspML")

cyanoFilter documentation built on Jan. 9, 2020, 5:08 p.m.