View source: R/01_prepare_data.R
convert_flowset | R Documentation |
Use this function to convert a flowSet into the tibble
object that the remaining functions in cyCombine relies on.
A tibble is a Tidyverse implementation of a data.frame and can be treated as a such.
The majority of arguments revolves adding relevant info from the metadata file/object.
The panel argument is included to adjust the output column names using a panel with channel and antigen columns.
Bear in mind the column names will be altered with the following:
stringr::str_remove_all("^\d+[A-Za-z]+_") %>% stringr::str_remove_all("[ _-]")
.
convert_flowset(
flowset,
metadata = NULL,
filename_col = "filename",
sample_ids = NULL,
batch_ids = NULL,
condition = NULL,
anchor = NULL,
down_sample = TRUE,
sample_size = 5e+05,
sampling_type = "random",
seed = 473,
clean_colnames = TRUE,
panel = NULL,
panel_channel = "fcs_colname",
panel_antigen = "antigen"
)
flowset |
The flowset to convert |
metadata |
Optional: Can be either a filename or data.frame of the metadata file. Please give the full path from working directory to metadata file |
filename_col |
Optional: The column in the metadata containing the fcs filenames. Needed if metadata is given, but sample_ids is not |
sample_ids |
Optional: If a character, it should be the sample column in the metadata. If its a vector, it should have the same length as the total flowset. If NULL, sample ids will be the file names. If a single value, all rows will be assigned this value. |
batch_ids |
Optional: If a character, it should be the column in the metadata containing the batch ids. If its a vector, it should have the same length as the total flowset. If a single value, all rows will be assigned this value. |
condition |
Optional: The column in the metadata containing the condition. Will be used as the covariate in ComBat, but can be specified later. You may use this to add a different column of choice, in case you want to use a custom column in the ComBat model matrix. |
anchor |
Experimental: The column in the metadata referencing the anchor samples (control references). Will be used as a covariate in ComBat, if specified. Please be aware that this column may be confounded with the condition column. You may use this to add a different column of choice, in case you want to use a custom column in the ComBat model matrix. You may use a custom column name, but it is good practice to add the name to the 'non_markers' object exported by cyCombine, to reduce the risk of unexpected errors. |
down_sample |
If TRUE, the output will be down-sampled to size sample_size |
sample_size |
The size to down-sample to. If a non-random sampling type is used and a group contains fewer cells than the sample_size, all cells of that group will be used. |
sampling_type |
The type of down-sampling to use. "random" to randomly select cells across the entire dataset, "batch_ids" to sample evenly (sample_size) from each batch, or "sample_ids" sample evenly (sample_size) from each sample. |
seed |
The seed to use for down-sampling |
clean_colnames |
(Default: TRUE). A logical defining whether column names should be cleaned or not. Cleaning involves removing isotope tags, spaces, dashes, underscores, and all bracket types. |
panel |
Optional: Panel as a filename or data.frame. Is used to define colnames from the panel_antigen column |
panel_channel |
Optional: Only used if panel is given. It is the column name in the panel data.frame that contains the channel names |
panel_antigen |
Optional: Only used if panel is given. It is the column name in the panel data.frame that contains the antigen names |
Other dataprep:
compile_fcs()
,
prepare_data()
,
transform_asinh()
## Not run:
df <- convert_flowset(flowset = flowset,
metadata = file.path(data_dir, "metadata.csv"),
filename_col = "FCS_files",
sample_ids = "sample_id",
batch_ids = "batch_ids",
down_sample = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.