check_sample_consistency {proBatch} | R Documentation

## Check if sample annotation is consistent with data matrix and join the two

### Description

Check if sample annotation is consistent with data matrix and join the two

### Usage

    check_sample_consistency(
      sample_annotation,
      sample_id_col,
      df_long,
      batch_col = NULL,
      order_col = NULL,
      facet_col = NULL,
      merge = TRUE
    )

### Arguments

`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")`
`sample_id_col` | name of the column in `sample_annotation` table, where the filenames (colnames of the `data_matrix` are found).
`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.
`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).
`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
`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'
`merge` | (logical) whether to merge `df_long` with `sample_annotation` or not

### Value

`df_long` format data frame, merged with sample_annotation using inner_join (samples represented in both)

### Examples

    df_test = check_sample_consistency(sample_annotation = example_sample_annotation,
    df_long = example_proteome, sample_id_col = 'FullRunName',
    batch_col = NULL, order_col = NULL, facet_col = NULL)

[Package proBatch version 1.11.0 Index]