define_sample_order {proBatch} | R Documentation

## Defining sample order internally

### Description

Defining sample order internally

### Usage

    define_sample_order(order_col, sample_annotation, facet_col, batch_col,
      df_long, sample_id_col, color_by_batch)

### Arguments

`order_col` | column in `sample_annotation` that determines sample order. It is used for in initial assessment plots (plot_sample_mean_or_boxplot) and feature-level diagnostics (feature_level_diagnostics). Can be 'NULL' if sample order is irrelevant (e.g. in genomic experiments). For more details, order definition/inference, see define_sample_order and date_to_sample_order
`sample_annotation` | data frame with: `sample_id_col` (this can be repeated as row names) biological covariates technical covariates (batches etc) . See `help("example_sample_annotation")`
`facet_col` | column in `sample_annotation` with a batch factor to separate plots into facets; usually 2nd to `batch_col`. Most meaningful for multi-instrument MS experiments (where each instrument has its own order-associated effects (see `order_col`) or simultaneous examination of two batch factors (e.g. preparation day and measurement day). For single-instrument case should be set to 'NULL'
`batch_col` | column in `sample_annotation` that should be used for batch comparison (or other, non-batch factor to be mapped to color in plots).
`df_long` | data frame where each row is a single feature in a single sample. It minimally has a `sample_id_col`, a `feature_id_col` and a `measure_col`, but usually also an `m_score` (in OpenSWATH output result file). See `help("example_proteome")` for more details.
`sample_id_col` | name of the column in `sample_annotation` table, where the filenames (colnames of the `data_matrix` are found).
`color_by_batch` | (logical) whether to color points and connecting lines by batch factor as defined by `batch_col`.

### Value

list of two items: `order_col` new name and new `df_long`

### See Also

plot_sample_mean_or_boxplot, feature_level_diagnostics

### Examples

    sample_order = define_sample_order(order_col = 'order',
    sample_annotation = example_sample_annotation,
    facet_col = NULL, batch_col = 'MS_batch', df_long = example_proteome,
    sample_id_col = 'FullRunName', color_by_batch = TRUE)
    new_order_col = sample_order$order_col
    df_long = sample_order$df_long

[Package proBatch version 1.3.0 Index]