View source: R/files_aggregation.R
aggregate_files | R Documentation |
Performs aggregation of debarcoded files, assigning user defined name to each file.
aggregate_files( fcs_files, md, barcode_column, batch_column, cores = 1, channels_to_keep = NULL, maxcells = NULL, write_agg_file = TRUE, out_dir = NULL )
fcs_files |
Character, full path to the fcs_files. |
md |
Metadata. Must contain the following columns: batch_column: defines to which batch each file belongs; barcode_name: defines to which barcode each file belongs fcs_new_name: a name for the fcs file that will be given after deconvolution and aggregation. |
cores |
Number of cores to be used. |
channels_to_keep |
Character vector with channel names to be kept. Default NULL. |
maxcells |
Numeric, maximum cells to randomly aggregate from each file, default is set to NULL, which means that all the cells will be aggregated. |
write_agg_file |
Logical, if the fcs files should be saved, if TRUE files will be saved in out_dir. Default set to TRUE. |
out_dir |
Character, pathway to where the files should be saved, if NULL (default) files will be saved to file.path(getwd(), Aggregated). |
List of the pathways to aggregated files.
# Set input directory debarcode_dir <- file.path(dir, "Debarcoded") # Define files for debarcoding files <- list.files(debarcode_dir, pattern = "_debarcoded.fcs$", full.names = TRUE, recursive = T) # Define out_dir for aggregated files aggregate_dir <- file.path(dir, "Aggregated") # Bring metadata md <- utils::read.csv(file.path(dir, "RawFiles", "meta_data.csv")) # Assign barcodes names md$barcode_name <- paste0(rownames(CATALYST::sample_key)[md$BARCODE]) # Assign new sample names specifying patient id and its batch name md$fcs_new_name <- paste0(md$ID, "_", md$STIM, "_", md$BATCH, ".fcs") # Aggregate and deconvolute file names aggregate_files(fcs_files = files, md, barcode_column = "barcode_name", batch_column = "BATCH", cores = 1, out_dir = aggregate_dir, write_agg_file = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.