Learn R Programming

tepr (version 1.1.14)

checkexptab: Check Validity of Experiment Table

Description

The `checkexptab` function verifies the structure and content of an experiment table to ensure it meets specific formatting requirements. It checks for the presence of required columns, and validates that the `direction` and `strand` columns contain only allowable values.

Usage

checkexptab(exptab)

Value

If the experiment table is valid, the function returns `NULL`. If the table is invalid, the function throws an error specifying the issue.

Arguments

exptab

A data frame containing experiment data that should have columns named 'condition', 'replicate', 'strand', and 'path'.

Details

The function performs the following checks: - The column names of `exptab` must match exactly: `"condition"`, `"replicate"`, `"direction"`, and `"strand"`. - The `direction` column must contain only `"forward"` and `"reverse"`. - The `strand` column must contain only `"plus"` and `"minus"`.

Examples

Run this code
# Create a valid experiment table
exptab <- data.frame(
  condition = c("cond1", "cond2"),
  replicate = c(1, 1),
  direction = c("forward", "reverse"),
  strand = c("plus", "minus"),
  path = c("toto/", "toto/"))
checkexptab(exptab)  # Should pass without errors

# Invalid experiment table (wrong column names)
invalid_exptab <- data.frame(
    cond = c("cond1", "cond2"),
    rep = c(1, 1),
    dir = c("forward", "reverse"),
    str = c("+", "-"),
    paths = c("toto/", "toto/"))
try(checkexptab(invalid_exptab))

Run the code above in your browser using DataLab