Skip to contents

The output files will be created alongside their corresponding input files, preserving the directory structure of the input directory unless the flatten_output_dir parameter is set to TRUE.

Usage

process_dir(
  input_dir,
  output_dir = NULL,
  recurse = FALSE,
  flatten_output_dir = FALSE,
  layout_filepath = NULL,
  format = NULL,
  normalisation_types = c("RAU", "nMFI"),
  generate_reports = FALSE,
  merge_outputs = FALSE,
  column_collision_strategy = "intersection",
  return_plates = FALSE,
  dry_run = FALSE,
  verbose = TRUE,
  ...
)

Arguments

input_dir

(character(1)) The directory containing the input files. It may be nested.

output_dir

(character(1)) Optional overwrite directory where the output files should be saved. The default is NULL. By default, the output directory is the same as the input directory.

recurse

(logical(1)) If TRUE, the function will search for files recursively in the input directory. The default is FALSE.

flatten_output_dir

(logical(1)) If TRUE, the output files will be saved in the output directory directly. The default is FALSE.

layout_filepath

(character(1)) The path to the layout file. The default is NULL, and the layout file will have to be determined automatically based on the file name.

format

(character(1)) The format of the Luminex data. The default is NULL, and the format will have to be determined automatically based on the file name. Available options are xPONENT and INTELLIFLEX.

normalisation_types

(character()) A vector of normalisation types to use. The default is c("RAU", "nMFI").

generate_reports

(logical(1)) If TRUE, generate quality control reports for each file. The default is FALSE.

merge_outputs

(logical(1)) If TRUE, merge the outputs of all plates into a single CSV file for each normalisation type. The resulting file will be saved in the output directory with the name merged_{normalisation_type}_{timestamp}.csv. Example: merged_nMFI_20250115_230735.csv.

column_collision_strategy

(character(1)) A method for handling missing or additional columns when merging outputs. Possible options are union and intersection. The default is intersection.

return_plates

(logical(1)) If TRUE, return a list of processed plates. The default is FALSE.

dry_run

(logical(1)) If TRUE, the function will not process any files but will print the information about the files that would be processed. The default is FALSE.

verbose

(logical(1)) Print additional information. The default is TRUE.

...

Additional arguments to for the process_file function.

Value

If the return_plates parameter is set to TRUE the function returns a list of plates sorted by the plate_datetime (The time of the experiment noted in the csv file) in increasing order (oldest plates first). If the return_plates parameters is set to FALSE the function returns NULL.

Examples

# Select input directory to process
dir <- system.file("extdata", "multiplate_lite", package = "PvSTATEM", mustWork = TRUE)

# Select output directory
output_dir <- tempdir(check = TRUE)

# Process input directory and return plates
plates <- process_dir(dir, return_plates = TRUE, output_dir = output_dir)
#> Reading Luminex data from: /home/runner/work/_temp/Library/PvSTATEM/extdata/multiplate_lite/CovidOISExPONTENT.csv
#> using format xPONENT
#> 
#> New plate object has been created with name: CovidOISExPONTENT!
#> 
#> Processing plate 'CovidOISExPONTENT'
#> Fitting the models and predicting RAU for each analyte
#> Warning: High dose hook detected.
#>         Removing samples with dilutions above the high dose threshold.
#> Adding the raw MFI values to the output dataframe
#> Saving the computed RAU values to a CSV file located in: '/tmp/RtmpFPTjFr/CovidOISExPONTENT_RAU.csv'
#> Computing nMFI values for each analyte
#> Adding the raw MFI values to the output dataframe
#> Saving the computed nMFI values to a CSV file located in: '/tmp/RtmpFPTjFr/CovidOISExPONTENT_nMFI.csv'