checkexptab: Check Validity of Experiment Table

View source: R/utils.R

checkexptabR Documentation

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)

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"'.

Value

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

Examples

# 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))


tepr documentation built on June 8, 2025, 10:46 a.m.