Skip to contents

Setup and differential analysis for CATaDa chromatin accessibility experiments using NOISeq. Accepts output from load_data_peaks, prepares count matrix, performs NOISeq analysis, and returns differentially-accessible loci.

Usage

differential_accessibility(
  data_list,
  cond,
  cond_names = NULL,
  norm = "n",
  q = 0.8
)

Arguments

data_list

List. Output from load_data_peaks.

cond

Vector (character). Two strings identifying the two conditions to compare. The order matters: `cond[1]` is used as Condition 1, `cond[2]` as Condition 2.

cond_names

Vector (character, optional). Custom display names for the two conditions in outputs/plots. Order maps to `cond`.

norm

Normalisation method passed to NOISeq. Defaults to "n" (no normalisation), but "uqua" (upper quantile) or "tmm" (trimmed mean of M) are options if needed

q

Numeric. Q-value threshold for NOISeq significance (default 0.8).

Value

A `DamIDResults` object containing the results. Access slots using the `@` accessor (e.g., `results@analysis`). The object includes:

upCond1

data.frame of regions enriched in condition 1

upCond2

data.frame of regions enriched in condition 2

analysis

data.frame of full results for all tested regions

cond

A named character vector mapping display names to internal condition names

data

The original `data_list` input

Examples

# NOTE: This example uses mock counts data, as the package's sample
# data is in log2-ratio format.

# Create a mock data_list with plausible count data
mock_occupancy_counts <- data.frame(
    name = c("peak1", "peak2", "peak3"),
    gene_names = c("GeneA", "GeneB", "GeneC"),
    gene_ids = c("ID_A", "ID_B", "ID_C"),
    GroupA_rep1 = c(100, 20, 50), GroupA_rep2 = c(110, 25, 45),
    GroupB_rep1 = c(10, 200, 55), GroupB_rep2 = c(15, 220, 60),
    row.names = c("peak1", "peak2", "peak3")
)

mock_data_list <- list(
    occupancy = mock_occupancy_counts,
    test_category = "accessible"
)

# Run differential accessibility analysis
diff_access_results <- differential_accessibility(
    mock_data_list,
    cond = c("GroupA", "GroupB")
)
#> Differential analysis setup:
#> Condition 1: 'GroupA' (display as 'GroupA')
#>   Found 2 replicates:
#>     GroupA_rep1
#>     GroupA_rep2
#> Condition 2: 'GroupB' (display as 'GroupB')
#>   Found 2 replicates:
#>     GroupB_rep1
#>     GroupB_rep2
#> [1] "1 differentially expressed features (up in first condition)"
#> [1] "1 differentially expressed features (down in first condition)"
#> 
#> 1 loci enriched in GroupA
#> Highest-ranked genes:
#> GeneA
#> 
#> 1 loci enriched in GroupB
#> Highest-ranked genes:
#> GeneB

# View the results summary
diff_access_results
#> An object of class 'DamIDResults'
#> Differentially accessible regions
#> Comparison: 'GroupA' vs 'GroupB'
#> - 1 regions enriched in GroupA
#> - 1 regions enriched in GroupB
#> - 3 total regions tested
#> 
#> Access results with accessor functions like analysisTable(object).