Skip to contents

Targets for pre-treatment of spectral processed data.

Usage

tar_pre_treatment(
  name,
  spectral_processed = NULL,
  parameters = NULL,
  cls = "class",
  QCidx = "QC",
  verbose = TRUE,
  plots = c("PCA", "LDA", "unsupervised_RF", "supervised_RF"),
  export_path = "exports/pre-treated"
)

Arguments

name

Symbol. The name for the collection of targets. This serves as a prefix for target names.

spectral_processed

S4 object of class Binalysis or MetaboProfile. If NULL, target input will be expected from an existing target. See details.

parameters

An object of S4 class AnalysisParameters containing pre-treatment parameters or a symbol containing the name of a target to use for input parameters. If NULL, metaboMisc::detectPretreatmentParameters() will be used to detect the pre-treatment parameters based on the cls argument.

cls

The name of the sample information table column containing the sample class information for parameter detection and plotting. Ignored for parameters if argument parameters is not NULL.

QCidx

QC sample class label. Ignored if argument parameters is not NULL.

verbose

Show pre-treatment console output.

plots

A character vector of plot types. Set to NULL to skip all plots.

export_path

Destination path of export files. Set to NULL to skip exports.

Value

A list of target objects for processing mzML data files using spectral binning.

Details

Specifying argument spectral_processed as NULL enables the use additional target factories outputing spectrally processed data. See the examples below.

Examples

if (FALSE) {
## Perform pre-treatment by specifying the spectrally processed data directly
targets::tar_dir({
    targets::tar_script({
        library(hrmtargets)
        file_paths <- metaboData::filePaths('FIE-HRMS','UrineTechnical',
                                            ask = FALSE)
        sample_info <- metaboData::runinfo('FIE-HRMS','UrineTechnical',
                                           ask = FALSE)
        spectral_processed <- binneR::binneRlyse(file_paths,
                                                 sample_info,
                                                 binneR::detectParameters(file_paths))
        
        list(
            tar_pre_treatment(example,
                              spectral_processed = spectral_processed)
        )
    })
    targets::tar_make()
    targets::tar_read(example_results_pre_treatment)
    targets::tar_read(example_plot_PCA)
})

## Perform pre-treatment by combining the use of 
## `tar_input_piggyback()` and `tar_spectral_binning()` 
targets::tar_dir({
    targets::tar_script({
        library(hrmtargets)
        name <- rlang::expr(example)
        
        list(
            tar_input_piggyback(!!name,
                                'FIE-HRMS_BdistachyonTechnical',
                                repo = 'jasenfinch/metaboData'),
            tar_spectral_binning(!!name),
            tar_pre_treatment(!!name)
        )
    })
    targets::tar_make()
    targets::tar_read(example_results_pre_treatment)
    targets::tar_read(example_plot_PCA)
})
}