diff --git a/DESCRIPTION b/DESCRIPTION index 3570321..5c99ce3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: LEEF.2.measurement.flowcytometer Type: Package Title: What the Package Does (Title Case) -Version: 0.9.5 +Version: 0.9.7 Authors@R: c( person(given = "Rainer M.", family = "Krug", email = "Rainer.Krug@uzh.ch", role = c("aut", "cre")), person("SNF Project 310030_188431", role = "fnd") diff --git a/NAMESPACE b/NAMESPACE index 980a123..56ee714 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,11 +1,16 @@ # Generated by roxygen2: do not edit by hand export(add_new_data) +export(calculate_gates) +export(calculate_gates_H) +export(dens) +export(dens_H) +export(extract_traits) export(extractor_flowcytometer) -export(extractor_flowcytometer_gating) +export(extractor_flowcytometer_density) export(extractor_flowcytometer_preparation) export(extractor_flowcytometer_traits) -export(gating) +export(extractor_traits) export(load_parameter) export(par_template) export(pre_processor_flowcytometer) diff --git a/R/dens.R b/R/dens.R index dee1c05..0f377db 100644 --- a/R/dens.R +++ b/R/dens.R @@ -26,7 +26,7 @@ dens <- function( # #----- HAVING A LOOK AT THE GATING -----# # i <- 1 - # flowViz::xyplot(`FL3-A` ~ `FL1-A`, data = fsa[[i]], filter = bacteria_gate) + # flowViz::xyplot(`FL3-A` ~ `FL1-A`, data = fsa[[i]], filter = gates$bacteria$bacteria_gate) # # fsa[[i]] # flowViz::densityplot(~ `FL1-A`, data = fsa[[i]], filter = rg_LNA) # # fsa[[i]] @@ -42,7 +42,7 @@ dens <- function( # applying filter to whole flowSet - result <- flowCore::filter(fsa, bacteria_gate) + result <- flowCore::filter(fsa, gates$bacteria$bacteria_gate) # extract absolute counts l <- lapply(result, flowCore::summary) @@ -63,12 +63,12 @@ dens <- function( flow.data <- flow.data[order(flow.data$date, flow.data$sample_letter, flow.data$sample_number), ] # subset data based on gate for bacteria - subset.bacteria <- flowCore::Subset(fsa, bacteria_gate) + subset.bacteria <- flowCore::Subset(fsa, gates$bacteria$bacteria_gate) # applying filter to bacteria to get the three bacteria populations - LNA <- flowCore::filter(subset.bacteria, rg_LNA) - MNA <- flowCore::filter(subset.bacteria, rg_MNA) - HNA <- flowCore::filter(subset.bacteria, rg_HNA) + LNA <- flowCore::filter(subset.bacteria, gates$bacteria$rg_LNA) + MNA <- flowCore::filter(subset.bacteria, gates$bacteria$rg_MNA) + HNA <- flowCore::filter(subset.bacteria, gates$bacteria$rg_HNA) # extract absolute counts l_LNA <- lapply(LNA, flowCore::summary) @@ -104,8 +104,8 @@ dens <- function( # get the algae algae <- flowCore::filter( - flowCore::Subset(fsa, !bacteria_gate), - algae_gate + flowCore::Subset(fsa, !gates$bacteria$bacteria_gate), + gates$algae$algae_gate ) # extract absolute counts diff --git a/R/dens_H.R b/R/dens_H.R index fd63875..dc457d0 100644 --- a/R/dens_H.R +++ b/R/dens_H.R @@ -26,7 +26,7 @@ dens_H <- function( # #----- HAVING A LOOK AT THE GATING -----# # i <- 1 - # flowViz::xyplot(`FL3-A` ~ `FL1-A`, data = fsa[[i]], filter = bacteria_gate) + # flowViz::xyplot(`FL3-A` ~ `FL1-A`, data = fsa[[i]], filter = gates$bacteria$bacteria_gate) # # fsa[[i]] # flowViz::densityplot(~ `FL1-A`, data = fsa[[i]], filter = rg_LNA) # # fsa[[i]] @@ -42,7 +42,7 @@ dens_H <- function( # applying filter to whole flowSet - result <- flowCore::filter(fsa, bacteria_gate) + result <- flowCore::filter(fsa, gates$bacteria$gates$bacteria$bacteria_gate) # extract absolute counts l <- lapply(result, flowCore::summary) @@ -63,7 +63,7 @@ dens_H <- function( flow.data <- flow.data[order(flow.data$date, flow.data$sample_letter, flow.data$sample_number), ] # subset data based on gate for bacteria - subset.bacteria <- flowCore::Subset(fsa, bacteria_gate) + subset.bacteria <- flowCore::Subset(fsa, gates$bacteria$bacteria_gate) # applying filter to bacteria to get the three bacteria populations LNA <- flowCore::filter(subset.bacteria, rg_LNA) @@ -104,7 +104,7 @@ dens_H <- function( # get the algae algae <- flowCore::filter( - flowCore::Subset(fsa, !bacteria_gate), + flowCore::Subset(fsa, !gates$bacteria$bacteria_gate), algae_gate ) diff --git a/R/extract_traits.R b/R/extract_traits.R new file mode 100644 index 0000000..5fb33fa --- /dev/null +++ b/R/extract_traits.R @@ -0,0 +1,190 @@ +#' Extract flowcytometer traits +#' +#' NOT USED IN PIPLELINE!!!! +#' This function is extracting data to be added to the database +#' (and therefore make accessible for further analysis and forecasting) +#' from \code{.fcs} files. +#' +#' @param input directory from which to read the data +#' @param metadata_flowcytometer the content of the file +#' \code{metadata_flowcytometer.csv} which will be linked into the traits +#' @param min_FSC.A numeric. If \code{!NULL}, \code{FSA.A <= min_FSC.A} will be fitered out by using +#' a rectangular filter +#' \code{flowCore::rectangleGate(filterId="filter_out_0", "FSC-A" = c(min_FSC.A, +Inf))} +#' @param use_H if \code{TRUE}, gating will be done using \code{height}, +#' otherwie \code{area} +#' @param timestamp timestamp. Default: read from \code{sample_metadata.yml} +#' @param fsa_p1 if \code{NULL}, \code{fsa_p1} will be read in, otherwise the +#' \code{fsa} +#' @param fsa_p2 if \code{NULL}, \code{fsa_p2} will be read in, otherwise the +#' \code{fsa} +#' @param gates_coordinates if \code{NULL}, \code{gates_coordinates} will be +#' read in, otherwise the \code{gates_coordinates} +#' @param wellid_keyword the kwyword which is used to identify the well ID. +#' Usually "$WELLID" (default), but for the EAWAG Flowcytometer it is "$SMNO". +#' +#' @return invisibly \code{TRUE} when completed successful +#' +#' @importFrom flowCore read.flowSet pData phenoData exprs logTransform truncateTransform transform +#' @importFrom flowCore rectangleGate polygonGate Subset +#' @importFrom yaml read_yaml +#' @importFrom stats setNames +#' @importFrom utils read.csv write.csv +#' @importFrom plyr join +#' @importFrom tidyr pivot_longer +#' @importFrom magrittr %>% +#' @import loggit +#' @export +#' +extract_traits <- function( + input = NULL, + particles = c("bacteria", "LNA", "MNA", "HNA", "algae"), + metadata_flowcytometer, + min_FSC.A = NULL, + use_H = FALSE, + timestamp = yaml::read_yaml(file.path(input, "sample_metadata.yml"))$timestamp, + fsa_p1 = NULL, + fsa_p2 = NULL, + gates_coordinates = NULL, + wellid_keyword = "$WELLID") { + message(" reading data ...") + + if (is.null(fsa_p1)) { + fsa_p1 <- readRDS(file = file.path(input, paste0("flowcytometer_fsa_ungated.p_1.rds"))) + } + + if (is.null(fsa_p2)) { + fsa_p2 <- readRDS(file = file.path(input, paste0("flowcytometer_fsa_ungated.p_1.rds"))) + } + + if (!is.null(min_FSC.A)) { + g0 <- flowCore::rectangleGate(filterId = "filter_out_0", "FSC-A" = c(min_FSC.A, +Inf)) + fsa_p1 <- flowCore::Subset(fsa_p1, g0) + fsa_p2 <- flowCore::Subset(fsa_p2, g0) + } + + if (is.null(gates_coordinates)) { + gates_coordinates <- utils::read.csv(file.path(input, "gates_coordinates.csv")) + } + + if (use_H) { + gates <- calculate_gates_H(gates_coordinates = gates_coordinates) + } else { + gates <- calculate_gates(gates_coordinates = gates_coordinates) + } + + + + # function to gate each plate --------------------------------------------- + + trait_plate <- function(plate_id, + fsa, + gates = gates, + wellid_keyword = wellid_keyword, + timestamp = timestamp) { + # extraction function ----------------------------------------------------- + + extr_traits <- function(pop, + wellid_keyword = wellid_keyword, + timestamp = timestamp) { + traits <- flowCore::fsApply( + pop, + function(p) { + result <- list() + result$sample <- unlist(flowCore::keyword(p, wellid_keyword)) + result$plate <- plate_id + x <- exprs(p) + if (nrow(x) > 0) { + result <- suppressWarnings( + data.frame( + result, + x + ) + ) + } else { + result <- NULL + } + return(result) + } + ) + + traits <- do.call(rbind, traits) + traits$timestamp <- timestamp + return(traits) + } + + traits <- list() + # The Bacteria ------------------------------------------------------------ + + bacteria_pop <- Subset(fsa, gates$bacteria$bacteria_gate) + + # LNA_pop <- Subset(bacteria_pop, gates$bacteria$rg_LNA) + # MNA_pop <- Subset(bacteria_pop, gates$bacteria$rg_MNA) + # HNA_pop <- Subset(bacteria_pop, gates$bacteria$rg_HNA) + + traits$bacteria <- extr_traits(bacteria_pop, wellid_keyword = wellid_keyword, timestamp = timestamp) + + # The Algae --------------------------------------------------------------- + + algae_pop <- Subset(fsa, gates$algae$algae_gate) + + traits$algae <- extr_traits(bacteria_pop, wellid_keyword = wellid_keyword, timestamp = timestamp) + + return(traits) + } + + + # Do the trait extraction for all plates -------------------------------------------- + + p1 <- trait_plate( + plate_id = "p_1", + fsa = fsa_p1, + gates = gates, + timestamp = timestamp, + wellid_keyword = wellid_keyword + ) + p2 <- trait_plate( + plate_id = "p_2", + fsa = fsa_p2, + gates = gates, + timestamp = timestamp, + wellid_keyword = wellid_keyword + ) + + traits <- list() + + traits$bacteria <- rbind( + p1$bacteria, + p2$bacteria + ) + traits$algae <- rbind( + p1$algae, + p2$algae + ) + + traits$bacteria <- merge( + traits$bacteria, + metadata_flowcytometer, + by.x = c("sample", "plate"), + by.y = c("sample", "plate"), + all.x = TRUE, + all.y = FALSE + ) + traits$algae <- merge( + traits$algae, + metadata_flowcytometer, + by.x = c("sample", "plate"), + by.y = c("sample", "plate"), + all.x = TRUE, + all.y = FALSE + ) + + + + # Finalize ---------------------------------------------------------------- + + message(" done") + message("########################################################") + + return(traits) +} diff --git a/R/extractor_flowcytometer_density.R b/R/extractor_flowcytometer_density.R index 24b1f10..0468d14 100644 --- a/R/extractor_flowcytometer_density.R +++ b/R/extractor_flowcytometer_density.R @@ -61,38 +61,45 @@ extractor_flowcytometer_density <- function( ############################################################# ############################################################# - if (is.null(gates_coordinates)) { - gates_coordinates <- utils::read.csv(file.path(input, "flowcytometer", "gates_coordinates.csv")) - } - if (is.null(fsa)) { - fsa <- readRDS(file.path(output, "flowcytometer", "flowcytometer_fsa_ungated.rds")) - } - if (is.null(flow.data)) { - flow.data <- utils::read.csv(file.path(output, "flowcytometer", "flowcytometer_ungated.csv")) - } ############################################################# ############################################################# # function to gate each plate --------------------------------------------- - gate_plate <- function(plate, - input, - output, - use_H) { + gate_plate <- function( + plate, + input, + output, + use_H, + gates_coordinates, + fsa = NULL, + flow.data = NULL) { + if (is.null(gates_coordinates)) { + gates_coordinates <- utils::read.csv(file.path(input, "flowcytometer", "gates_coordinates.csv")) + } + + if (is.null(fsa)) { + fsa <- readRDS(file.path(output, "flowcytometer", paste0("flowcytometer_fsa_ungated.", plate, ".rds"))) + } + + if (is.null(flow.data)) { + flow.data <- readRDS(file.path(output, "flowcytometer", paste0("flowcytometer_ungated.", plate, ".rds"))) + } + if (use_H) { gated <- dens_H( - gates_coordinates = utils::read.csv(file.path(input, "flowcytometer", "gates_coordinates.csv")), - fsa = file.path(file.path(output, "flowcytometer"), paste0("flowcytometer_fsa_ungated.", plate, ".rds")), - flow.data = file.path(file.path(output, "flowcytometer"), paste0("flowcytometer_ungated.", plate, ".rds")) + gates_coordinates = gates_coordinates, + fsa = fsa, + flow.data = flow.data ) } else { gated <- dens( - gates_coordinates = utils::read.csv(file.path(input, "flowcytometer", "gates_coordinates.csv")), - fsa = file.path(file.path(output, "flowcytometer"), paste0("flowcytometer_fsa_ungated.", plate, ".rds")), - flow.data = file.path(file.path(output, "flowcytometer"), paste0("flowcytometer_ungated.", plate, ".rds")) + gates_coordinates = gates_coordinates, + fsa = fsa, + flow.data = flow.data ) } # SAVE -------------------------------------------------------------------- @@ -133,7 +140,11 @@ extractor_flowcytometer_density <- function( plates, gate_plate, input = input, - output = output + output = output, + use_H = use_H, + gates_coordinates, + fsa = fsa, + flow.data = flow.data ) # Finalise ---------------------------------------------------------------- @@ -172,7 +183,12 @@ extractor_flowcytometer_density <- function( message("########################################################") if (dens_back) { - return(flow.data) + density <- NULL + for (plate in plates) { + fdp <- readRDS(file.path(add_path, paste0("flowcytometer_density.", plate, ".rds"))) + density <- rbind(density, fdp) + } + return(density) } else { invisible(TRUE) } diff --git a/R/extractor_traits.R b/R/extractor_traits.R index 06792cc..6eb7b9d 100644 --- a/R/extractor_traits.R +++ b/R/extractor_traits.R @@ -33,7 +33,6 @@ #' @importFrom plyr join #' @importFrom tidyr pivot_longer #' @importFrom magrittr %>% -#' @import loggit #' @export #' extractor_traits <- function(input = NULL, @@ -63,7 +62,7 @@ extractor_traits <- function(input = NULL, } if (is.null(gates_coordinates)) { - gates_coordinates <- utils::read.csv(file.path(input_dir, "gates_coordinates.csv")) + gates_coordinates <- utils::read.csv(file.path(input, "gates_coordinates.csv")) } if (use_H) { @@ -87,7 +86,7 @@ extractor_traits <- function(input = NULL, pop, function(p) { result <- list() - rresult$sample <- unlist(flowCore::keyword(p, wellid_keyword)) + result$sample <- unlist(flowCore::keyword(p, wellid_keyword)) result$plate <- plate_id x <- exprs(p) if (nrow(x) > 0) { diff --git a/R/pre_processor_flowcytometer_c6.R b/R/pre_processor_flowcytometer_c6.R index ce5ad1e..0d40a6b 100644 --- a/R/pre_processor_flowcytometer_c6.R +++ b/R/pre_processor_flowcytometer_c6.R @@ -18,7 +18,6 @@ pre_processor_flowcytometer_c6 <- function( ) { add_path <- file.path(output, "flowcytometer") dir.create(add_path, recursive = TRUE, showWarnings = FALSE) - loggit::set_logfile(file.path(add_path, "flowcytometer.log")) ## message("########################################################") diff --git a/codemeta.json b/codemeta.json index 5e6c4b5..23083b9 100644 --- a/codemeta.json +++ b/codemeta.json @@ -7,13 +7,13 @@ "codeRepository": "https://github.com/LEEF-UZH/LEEF.measurement.flowcytometer", "issueTracker": "https://github.com/LEEF-UZH/LEEF.measurement.flowcytometer/issues", "license": "https://spdx.org/licenses/MIT", - "version": "0.9.5", + "version": "0.9.7", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.2.2 (2022-10-31)", + "runtimePlatform": "R version 4.3.1 (2023-06-16)", "author": [ { "@type": "Person", @@ -168,6 +168,6 @@ }, "SystemRequirements": null }, - "fileSize": "82.183KB", + "fileSize": "0KB", "readme": "https://github.com/LEEF-UZH/LEEF.measurement.flowcytometer/blob/LEEF-2/Readme.md" } diff --git a/man/calculate_gates.Rd b/man/calculate_gates.Rd new file mode 100644 index 0000000..27c27f1 --- /dev/null +++ b/man/calculate_gates.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/calculate_gates.R +\name{calculate_gates} +\alias{calculate_gates} +\title{Calculate gates based on gate co-ordinates in csv file using \code{area}} +\usage{ +calculate_gates(input_dir = NULL, gates_coordinates = NULL) +} +\arguments{ +\item{input_dir}{directory which contains the file \code{gates_coordinates.csv}} + +\item{gates_coordinates}{contains gate co-ordinates. If \code{NULL} *default) +the gates cootdinates are read in from \code{input_dir}} +} +\value{ +\code{list} containing two objects: gates for bacteria and gates for algae +} +\description{ +Calculate gates based on gate co-ordinates in csv file using \code{area} +} diff --git a/man/calculate_gates_H.Rd b/man/calculate_gates_H.Rd new file mode 100644 index 0000000..6ef5342 --- /dev/null +++ b/man/calculate_gates_H.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/calculate_gates_H.R +\name{calculate_gates_H} +\alias{calculate_gates_H} +\title{Calculate gates based on gate co-ordinates in csv file using \code{area}} +\usage{ +calculate_gates_H(input_dir = NULL, gates_coordinates = NULL) +} +\arguments{ +\item{input_dir}{directory which contains the file \code{gates_coordinates.csv}} + +\item{gates_coordinates}{contains gate co-ordinates. If \code{NULL} *default) +the gates cootdinates are read in from \code{input_dir}} +} +\value{ +\code{list} containing two objects: gates for bacteria and gates for algae +} +\description{ +Calculate gates based on gate co-ordinates in csv file using \code{area} +} diff --git a/man/dens.Rd b/man/dens.Rd new file mode 100644 index 0000000..529e508 --- /dev/null +++ b/man/dens.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dens.R +\name{dens} +\alias{dens} +\title{Get density using \code{area} for gating} +\usage{ +dens(gates_coordinates, fsa, flow.data, min_FSC.A = 1e-10) +} +\arguments{ +\item{gates_coordinates}{gates co-ordinates as read from the file \code{gates_coordinates.csv}} + +\item{fsa}{as read from \code{flowcytometer_fsa_ungated.rds}} + +\item{flow.data}{as read from \code{flowcytometer_ungated.csv}} + +\item{min_FSC.A}{numeric. If \code{!NULL}, \code{FSA.A <= min_FSC.A} will be fitered out by using +a rectangular filter +\code{flowCore::rectangleGate(filterId="filter_out_0", "FSC-A" = c(min_FSC.A, +Inf))}} +} +\value{ +gated \code{flow.data} density as saved in \code{flowcytometer_density.csv} and actual gates used +} +\description{ +Get density using \code{area} for gating +} diff --git a/man/dens_H.Rd b/man/dens_H.Rd new file mode 100644 index 0000000..99462f1 --- /dev/null +++ b/man/dens_H.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/dens_H.R +\name{dens_H} +\alias{dens_H} +\title{Get density using \code{height} for gating} +\usage{ +dens_H(gates_coordinates, fsa, flow.data, min_FSC.A = 1e-10) +} +\arguments{ +\item{gates_coordinates}{gates co-ordinates as read from the file \code{gates_coordinates.csv}} + +\item{fsa}{as read from \code{flowcytometer_fsa_ungated.rds}} + +\item{flow.data}{as read from \code{flowcytometer_ungated.csv}} + +\item{min_FSC.A}{numeric. If \code{!NULL}, \code{FSA.A <= min_FSC.A} will be fitered out by using +a rectangular filter +\code{flowCore::rectangleGate(filterId="filter_out_0", "FSC-A" = c(min_FSC.A, +Inf))}} +} +\value{ +gated \code{flow.data} density as saved in \code{flowcytometer_density.csv} and actual gates used +} +\description{ +Get density using \code{height} for gating +} diff --git a/man/extract_traits.Rd b/man/extract_traits.Rd new file mode 100644 index 0000000..7a225c7 --- /dev/null +++ b/man/extract_traits.Rd @@ -0,0 +1,55 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/extract_traits.R +\name{extract_traits} +\alias{extract_traits} +\title{Extract flowcytometer traits} +\usage{ +extract_traits( + input = NULL, + particles = c("bacteria", "LNA", "MNA", "HNA", "algae"), + metadata_flowcytometer, + min_FSC.A = NULL, + use_H = FALSE, + timestamp = yaml::read_yaml(file.path(input, "sample_metadata.yml"))$timestamp, + fsa_p1 = NULL, + fsa_p2 = NULL, + gates_coordinates = NULL, + wellid_keyword = "$WELLID" +) +} +\arguments{ +\item{input}{directory from which to read the data} + +\item{metadata_flowcytometer}{the content of the file +\code{metadata_flowcytometer.csv} which will be linked into the traits} + +\item{min_FSC.A}{numeric. If \code{!NULL}, \code{FSA.A <= min_FSC.A} will be fitered out by using +a rectangular filter +\code{flowCore::rectangleGate(filterId="filter_out_0", "FSC-A" = c(min_FSC.A, +Inf))}} + +\item{use_H}{if \code{TRUE}, gating will be done using \code{height}, +otherwie \code{area}} + +\item{timestamp}{timestamp. Default: read from \code{sample_metadata.yml}} + +\item{fsa_p1}{if \code{NULL}, \code{fsa_p1} will be read in, otherwise the +\code{fsa}} + +\item{fsa_p2}{if \code{NULL}, \code{fsa_p2} will be read in, otherwise the +\code{fsa}} + +\item{gates_coordinates}{if \code{NULL}, \code{gates_coordinates} will be +read in, otherwise the \code{gates_coordinates}} + +\item{wellid_keyword}{the kwyword which is used to identify the well ID. +Usually "$WELLID" (default), but for the EAWAG Flowcytometer it is "$SMNO".} +} +\value{ +invisibly \code{TRUE} when completed successful +} +\description{ +NOT USED IN PIPLELINE!!!! +This function is extracting data to be added to the database +(and therefore make accessible for further analysis and forecasting) +from \code{.fcs} files. +} diff --git a/man/extractor_flowcytometer_gating.Rd b/man/extractor_flowcytometer_density.Rd similarity index 57% rename from man/extractor_flowcytometer_gating.Rd rename to man/extractor_flowcytometer_density.Rd index 3603391..b417c3c 100644 --- a/man/extractor_flowcytometer_gating.Rd +++ b/man/extractor_flowcytometer_density.Rd @@ -1,10 +1,19 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/extractor_flowcytometer_gating.R -\name{extractor_flowcytometer_gating} -\alias{extractor_flowcytometer_gating} +% Please edit documentation in R/extractor_flowcytometer_density.R +\name{extractor_flowcytometer_density} +\alias{extractor_flowcytometer_density} \title{Extractor flowcytometer data} \usage{ -extractor_flowcytometer_gating(input, output) +extractor_flowcytometer_density( + input = NA, + output = ".", + min_FSC.A = NULL, + use_H = FALSE, + gates_coordinates = NULL, + fsa = NULL, + flow.data = NULL, + dens_back = FALSE +) } \arguments{ \item{input}{directory from which to read the data} diff --git a/man/extractor_traits.Rd b/man/extractor_traits.Rd new file mode 100644 index 0000000..b278ec1 --- /dev/null +++ b/man/extractor_traits.Rd @@ -0,0 +1,54 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/extractor_traits.R +\name{extractor_traits} +\alias{extractor_traits} +\title{Extractor flowcytometer data} +\usage{ +extractor_traits( + input = NULL, + particles = c("bacteria", "LNA", "MNA", "HNA", "algae"), + metadata_flowcytometer, + min_FSC.A = NULL, + use_H = FALSE, + timestamp = yaml::read_yaml(file.path(input, "sample_metadata.yml"))$timestamp, + fsa_p1 = NULL, + fsa_p2 = NULL, + gates_coordinates = NULL, + wellid_keyword = "$WELLID" +) +} +\arguments{ +\item{input}{directory from which to read the data} + +\item{metadata_flowcytometer}{the content of the file +\code{metadata_flowcytometer.csv} which will be linked into the traits} + +\item{min_FSC.A}{numeric. If \code{!NULL}, \code{FSA.A <= min_FSC.A} will be fitered out by using +a rectangular filter +\code{flowCore::rectangleGate(filterId="filter_out_0", "FSC-A" = c(min_FSC.A, +Inf))}} + +\item{use_H}{if \code{TRUE}, gating will be done using \code{height}, +otherwie \code{area}} + +\item{timestamp}{timestamp. Default: read from \code{sample_metadata.yml}} + +\item{fsa_p1}{if \code{NULL}, \code{fsa_p1} will be read in, otherwise the +\code{fsa}} + +\item{fsa_p2}{if \code{NULL}, \code{fsa_p2} will be read in, otherwise the +\code{fsa}} + +\item{gates_coordinates}{if \code{NULL}, \code{gates_coordinates} will be +read in, otherwise the \code{gates_coordinates}} + +\item{wellid_keyword}{the kwyword which is used to identify the well ID. +Usually "$WELLID" (default), but for the EAWAG Flowcytometer it is "$SMNO".} +} +\value{ +invisibly \code{TRUE} when completed successful +} +\description{ +This function is extracting data to be added to the database +(and therefore make accessible for further analysis and forecasting) +from \code{.fcs} files. +} diff --git a/man/gating.Rd b/man/gating.Rd deleted file mode 100644 index 7b29b03..0000000 --- a/man/gating.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/gating.R -\name{gating} -\alias{gating} -\title{Do the gating} -\usage{ -gating(gates_coordinates, fsa, flow.data) -} -\arguments{ -\item{gates_coordinates}{gates co-ordinates as read from the file \code{gates_coordinates.csv}} - -\item{fsa}{as read from \code{flowcytometer_fsa_ungated.rds}} - -\item{flow.data}{as read from \code{flowcytometer_ungated.csv}} -} -\value{ -gated \code{flow.data} density as saved in \code{flowcytometer_density.csv} and actual gates used -} -\description{ -Do the gating -}