calc_mean_sd_capture_all: Calculate the mean and the standard deviation for the stained...

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/calc_mean_sd_functions.R

Description

This methods performs the calc_mean_sd_capture function on a list of FCS files, list of scatter channel pairs, list of detectors and a list of dyes, and collates the results. The order of the arguments in the input lists matters, i.e., the first FCS file will be matched with the first pair of FSC/SSC channel names, the first detector name and the first dye name.

Usage

1
2
    calc_mean_sd_capture_all(fcs_file_path_list, scatter_channels_list,
    detector_list, dye_list)

Arguments

fcs_file_path_list

A list of n FCS files, one for each detector.

scatter_channels_list

A list of n pairs of forward and side scatter channel names.

detector_list

A list of n detector names; those shall correspond to specific detector in the n specified FCS files.

dye_list

A list of n dye names; those will be used to name the columns of the resulting data frame.

Details

This method assumes that each of the FCS files have useful data only in the specified channel. Therefore, we perform the calc_mean_sd_capture on all these FCS files separatelly and then put the results together into a single data frame.

Value

The result is a data frame with n columns, the headings of the columns correspond to the values in the list provided by the dye_list argument. The rows include the total number of events, the number of events in the FSC/SSC ellipse gate, the number of events in the high peak gate and low peak gate, the stained mean and stained standard deviation (based on the high peak gate), and finally the unstained mean and unstained standard deviation (based on the low peak gate).

Author(s)

Josef Spidlen, Wayne Moore, Faysal El Khettabi

See Also

calc_mean_sd_capture

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    library(flowCore)
    library(flowQBData)

    file_directory <- system.file("extdata", "SSFF_LSRII", "SU_2B", 
        package="flowQBData")
    fcs_file_path_list <- as.list(file.path(
        file_directory, c("933723.fcs","933725.fcs")))
    scatter_channels_list <- list(c("FSC-A", "SSC-A"), c("FSC-A", "SSC-A"))
    detector_list <- list("APC-A", "APC-Cy7-A")
    dye_list <- list("APC", "APC-Cy7")
    
    results <- calc_mean_sd_capture_all(
        fcs_file_path_list, 
        scatter_channels_list, 
        detector_list, 
        dye_list
    )
    
    ## Now the same thing again, but we will show how to extract information
    ## from the spreadsheet and run the appropriate calculations
    library(xlsx)
    xls_path <- system.file("extdata", "140126_InstEval_Stanford_LSRIIA2.xlsx",
        package="flowQBData")
    xls <- read.xlsx(xls_path, 1, headers=FALSE, stringsAsFactors=FALSE)
    insfolder <- instrument.folder <- xls[[2]][[9]]

    dyes <- list()
    detectors <- list()
    filepaths <- list()
    scatters <- list()

    for (i in 1:10)
    {
        folder <- xls[[i+2]][[14]]
        filename <- xls[[i+2]][[15]]

        if (is.na(filename)) next
        filepath <- system.file("extdata", insfolder, folder, filename, 
            package="flowQBData")
        ## Spreadsheet may describe additional FCS files not included
        ## with the library, so skip if file doesn't exist
        if (nchar(filepath) == 0) next

        filepaths <- c(filepaths, filepath)
        dyes <- c(dyes, xls[[i+2]][[11]])
        detectors <- c(detectors, xls[[i+2]][[13]])
        scatters[[length(scatters)+1]] <- c(xls[[i+2]][[16]], xls[[i+2]][[17]])
    }

    results2 <- calc_mean_sd_capture_all(filepaths, scatters, detectors, dyes)

flowQB documentation built on May 6, 2019, 3:05 a.m.