| Title: | Structural-Absence and Conditional-Abundance Testing |
|---|---|
| Description: | Provides depth-aware taxon-level inference for microbiome count data. SACAT separates group differences in structural-absence probability from differences in mean log relative abundance among samples in which a taxon is present. It accounts for finite-depth nondetection, centers abundance effects against a target-excluded cross-taxon reference, reports component-specific and omnibus tests, and visualizes statistical evidence, observed detection, estimated zero sources, and abundance distributions. |
| Authors: | Yiqian Zhang [aut, cre] (ORCID: <https://orcid.org/0009-0004-0296-912X>) |
| Maintainer: | Yiqian Zhang <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.99.2 |
| Built: | 2026-11-15 02:12:48 UTC |
| Source: | https://github.com/BiocStaging/SACAT |
Stool 16S rRNA gene counts from diarrhea-free control children in the Global Enteric Multicenter Study (GEMS), reported by Pop et al. (2014).
data(gems_microbiome)data(gems_microbiome)
A SummarizedExperiment::SummarizedExperiment with
41 bacterial genera in rows and 328 children in columns.
The counts assay contains raw genus-level read counts.
Sample metadata in colData() contain:
groupAge group: Infant (1–11 months, 191 children)
or Older (24–58 months, 137 children).
age_monthsAge in months.
countryStudy country: Bangladesh, The Gambia, Kenya or Mali.
readsTotal reads for the sample in the original count table, before genus aggregation and filtering.
The example includes controls younger than 12 months or at least 24
months old. Counts were summed across features with the same bacterial
genus name. Genera detected in at least 20% of the selected children
were retained. The preparation script is installed under
scripts/prepare_gems_microbiome.R.
Counts and sample annotations were adapted from the Bioconductor data
package msd16s (version 1.32.0) by Joseph N. Paulson, Hector Corrada
Bravo, and Mihai Pop (doi:10.18129/B9.bioc.msd16s). The source package
is distributed under the Artistic License 2.0.
Pop M, Walker AW, Paulson JN, et al. (2014). Diarrhea in young children from low-income countries leads to large-scale alterations in intestinal microbiota composition. Genome Biology, 15, R76. doi:10.1186/gb-2014-15-6-r76.
data("gems_microbiome") dim(gems_microbiome) table(gems_microbiome$group, gems_microbiome$country)data("gems_microbiome") dim(gems_microbiome) table(gems_microbiome$group, gems_microbiome$country)
Aligns component evidence, observed detection with estimated zero sources, and observed and fitted abundance for selected taxa.
## S3 method for class 'sacat' plot( x, features = NULL, selection = c("significant", "top", "all"), max_features = 24L, alpha = 0.05, group_colors = c("#4C78A8", "#E45756"), zero_colors = c("#6A9DC0", "#E5A36C", "#E9E9E9"), file = NULL, width = NULL, height = NULL, dpi = 300, group_labels = NULL, show_component_guides = TRUE, ... )## S3 method for class 'sacat' plot( x, features = NULL, selection = c("significant", "top", "all"), max_features = 24L, alpha = 0.05, group_colors = c("#4C78A8", "#E45756"), zero_colors = c("#6A9DC0", "#E5A36C", "#E9E9E9"), file = NULL, width = NULL, height = NULL, dpi = 300, group_labels = NULL, show_component_guides = TRUE, ... )
x |
A |
features |
Optional unique taxon names, displayed in the supplied order. |
selection |
Select omnibus-significant taxa, the top-ranked taxa,
or all eligible taxa. Ignored when |
max_features |
Maximum number of automatically selected taxa.
Ignored for |
alpha |
Adjusted-p threshold for selection and component markers. |
group_colors |
Two colors, in reference/comparison order, for observed abundance distributions. |
zero_colors |
Three colors for detected samples, estimated SA, and estimated ND, respectively. |
file |
Optional PDF, PNG, or SVG filename. Without it, draw on the current graphics device. |
width, height
|
Output dimensions in inches when |
dpi |
Resolution of PNG output. |
group_labels |
Optional reference/comparison labels for display. |
show_component_guides |
Show BH component discovery boundaries when
|
... |
Reserved for graphical extensions. |
Panel A shows the structural-absence (SA) score statistic and the signed
square root of the adjusted relative-abundance (RA) likelihood-ratio
statistic. Positive values indicate higher SA or reference-corrected RA
in the comparison group. Filled circles mark component adjusted p-values
at or below alpha; open circles mark values above it. Dashed lines show
component-specific BH discovery boundaries computed from the complete
retained families. Taxon superscripts summarize omnibus adjusted p-values.
Panel B shows each group's observed detection fraction and estimated
contributions of structural absence and nondetection (ND) to observed zeros.
For each zero, the SA contribution is its posterior SA probability from the
group-inclusive structural plotting fit; the ND contribution is its
complement. Positive counts contribute to detected samples. These quantities
are averaged within the observed groups and sum to one. An undivided,
unfilled zero segment marked -- denotes an unavailable zero-source fit.
Panel C shows positive observed relative abundances as points and boxplots, with library sizes from the fitted analysis. Boxplots summarize log10 relative abundance: the box spans the quartiles, the line marks the median, and whiskers extend to observations within 1.5 interquartile ranges. Diamonds show the exponentiated mean fitted log relative abundance conditional on presence, standardized over all observed covariate profiles. Both are displayed as percentages on a log scale. The raw abundance contrast is the natural log of the ratio of the comparison-group diamond to the reference-group diamond. The RA test in Panel A subtracts the estimated cross-taxon reference from this contrast.
Plotting uses data prepared by sacat() with store_plot_data = TRUE.
It does not refit the model or change statistical results.
Invisibly, a list containing the displayed data and graphical settings.
example("sacat", echo = FALSE) plot(fit, features = c("Haemophilus", "Lactobacillus", "Faecalibacterium"), group_labels = c("1-11 mo", "24-58 mo"))example("sacat", echo = FALSE) plot(fit, features = c("Haemophilus", "Lactobacillus", "Faecalibacterium"), group_labels = c("1-11 mo", "24-58 mo"))
Fits SACAT to microbiome count data and tests a binary group contrast in structural-absence probability, relative abundance conditional on presence, or both. Sequencing depth enters the latent-state count model so that an observed zero can receive different posterior support for structural absence and nondetection across samples.
sacat( counts, metadata, formula, group, library_size, taxa_are_rows = TRUE, reference = NULL, p_adjust_method = "BH", component = c("all", "structural_absence", "relative_abundance"), full_output = FALSE, min_positive_samples = 3L, min_reference_taxa = 4L, structural_quadrature_points = 1001L, workers = 1L, verbose = FALSE, abundance_quadrature_points = 41L, store_plot_data = FALSE )sacat( counts, metadata, formula, group, library_size, taxa_are_rows = TRUE, reference = NULL, p_adjust_method = "BH", component = c("all", "structural_absence", "relative_abundance"), full_output = FALSE, min_positive_samples = 3L, min_reference_taxa = 4L, structural_quadrature_points = 1001L, workers = 1L, verbose = FALSE, abundance_quadrature_points = 41L, store_plot_data = FALSE )
counts |
Raw non-negative integer counts in a matrix or data frame. |
metadata |
Sample metadata in a data frame. Row names must contain all
sample names in |
formula |
A one-sided formula with an intercept, an additive main
effect for |
group |
Name of the binary metadata variable to test. |
library_size |
Either the name of a numeric column in |
taxa_are_rows |
Logical. If |
reference |
Optional reference value for |
p_adjust_method |
Method passed to |
component |
Analysis to run.
|
full_output |
Logical. If |
min_positive_samples |
Minimum number of samples with a positive count
required to retain a taxon before fitting. The default is |
min_reference_taxa |
Minimum number of eligible target-excluded taxa
required to form an abundance reference. The default is |
structural_quadrature_points |
Number of Gauss-Hermite nodes used by the
structural arm to refine the conditional-present fit and evaluate the
structural-absence model. The default is |
workers |
Number of parallel worker processes. The default |
verbose |
Logical. If |
abundance_quadrature_points |
Number of Gauss-Hermite nodes used by the
shared five-start conditional-present search and by subsequent
relative-abundance refinement and inference. When the structural component
is requested, this search supplies the starting point for refinement at
|
store_plot_data |
Logical. If |
The structural-absence component estimates the conditional-present count
distribution from positive counts, estimates structural-absence nuisance
parameters from the detection indicators, and evaluates a
nuisance-orthogonalized estimating-function statistic for the group effect
with a matching empirical sandwich variance. Positive
z_structural_absence values indicate greater structural absence in the
comparison group.
The relative-abundance component estimates a covariate-standardized comparison-minus-reference difference in mean log relative abundance conditional on taxon presence. Every taxon is fitted with the same zero-truncated conditional-mark likelihood. Conditioning on a positive count removes the structural-presence probability from this likelihood. Zero counts have zero mark score, and all samples contribute their covariate values to sample standardization.
Taxon-specific effects are centered against a target-excluded cross-taxon
reference. The standard error uses centered, sample-aligned
influence contributions. A sandwich-adjusted profile likelihood-ratio test
compares the fitted likelihood with a constrained fit whose raw abundance
contrast equals the estimated reference. The likelihood-ratio statistic is
multiplied by the raw contrast's inverse-information variance divided by
the reference-corrected sandwich variance and compared with a chi-squared
distribution with one degree of freedom. z_relative_abundance is its
signed square root, with the sign of the reference-corrected effect.
A positive estimate_relative_abundance indicates that the target taxon's
present-conditional contrast exceeds the shared compositional background.
With full_output = TRUE, the detailed abundance table records the raw
taxon estimate and the reference quantities used to construct the reported
contrast.
Taxa with positive counts in fewer than min_positive_samples samples are
excluded before component fitting and omitted from the multiple-testing
families. Every retained taxon remains in each requested family. If a
component cannot be formed, an operational value of one retains the taxon in
that family; the formation indicator and reason identify values assigned to
unavailable component tests.
Abundance-component availability is the proportion of retained taxa with
formed_relative_abundance = TRUE. The diagnostics record positive-count
support and the reason for each unavailable test.
Two structural outcomes are nonregular. A taxon with no observed zeros has
no variation in its detection indicator (no_observed_zeros). An
intercept-only structural nuisance fit at zero absence probability is
recorded as structural_absence_boundary_at_zero. Both nonregular statuses
use an operational p-value of one in the primary family
and are excluded from the Cauchy sensitivity combination; their signed
statistic is undefined.
structural_absence_nonoptimal_nuisance_fit identifies a finite nuisance
fit whose detection objective exceeds the exact zero-limit objective. An
otherwise supported all-positive taxon can still enter the
abundance conditional-mark fit because that fit has no structural nuisance
parameter. The component-use columns record the components entering each
omnibus calculation.
Requested components return lightweight warning codes even when
full_output = FALSE. Structural analyses include
warning_structural_absence and nonregular_structural_absence; abundance
analyses include warning_relative_abundance. Setting full_output = TRUE
additionally retains detailed fitted objects and reference diagnostics.
An object of class sacat with elements:
A taxon-level table for the requested analyses. Adjusted
p-values use the p_adj_ prefix and the method recorded in
settings$p_adjust_method.
Taxon retention, support counts, component-formation status and reason codes, and numerical warnings.
The fitted contrast and analysis settings.
The matched function call.
Observed abundances and fitted plotting summaries when
store_plot_data = TRUE.
Detailed component fits when full_output = TRUE.
data("gems_microbiome") fit <- sacat( counts = SummarizedExperiment::assay(gems_microbiome, "counts"), metadata = as.data.frame(SummarizedExperiment::colData(gems_microbiome)), formula = ~ country + group, group = "group", reference = "Infant", library_size = "reads", store_plot_data = TRUE ) genera <- c("Haemophilus", "Lactobacillus", "Faecalibacterium") fit$results[match(genera, fit$results$taxon), c("taxon", "p_adj_structural_absence", "p_adj_relative_abundance", "p_adj_omnibus")]data("gems_microbiome") fit <- sacat( counts = SummarizedExperiment::assay(gems_microbiome, "counts"), metadata = as.data.frame(SummarizedExperiment::colData(gems_microbiome)), formula = ~ country + group, group = "group", reference = "Infant", library_size = "reads", store_plot_data = TRUE ) genera <- c("Haemophilus", "Lactobacillus", "Faecalibacterium") fit$results[match(genera, fit$results$taxon), c("taxon", "p_adj_structural_absence", "p_adj_relative_abundance", "p_adj_omnibus")]
Extracts a count assay and sample metadata from a
SummarizedExperiment::SummarizedExperiment and passes them to sacat().
Rows represent taxa and columns represent samples. The statistical model,
input validation, and analysis options are those of sacat().
sacat_se(object, formula, group, library_size, assay = "counts", ...)sacat_se(object, formula, group, library_size, assay = "counts", ...)
object |
A SummarizedExperiment::SummarizedExperiment or a subclass, with raw non-negative integer counts in the selected assay. Taxon row names and sample column names must be unique and non-empty. |
formula |
A one-sided formula using columns of |
group |
Name of the binary variable in |
library_size |
Name of a numeric column in |
assay |
Name or positive integer index of the count assay.
Defaults to |
... |
Additional arguments passed unchanged to |
Original sequencing depths must be supplied explicitly. They are never
calculated from assay column sums, which may omit taxa removed before the
analysis. The selected assay is converted to a dense matrix by sacat();
allow sufficient memory when using a sparse or delayed assay.
A sacat object, as returned by sacat().
sacat(), SummarizedExperiment::SummarizedExperiment
data("gems_microbiome") genera <- c("Haemophilus", "Lactobacillus", "Faecalibacterium") fit <- sacat_se( gems_microbiome[genera, ], ~ country + group, group = "group", reference = "Infant", library_size = "reads", component = "structural_absence" ) fit$results[, c("taxon", "p_structural_absence")]data("gems_microbiome") genera <- c("Haemophilus", "Lactobacillus", "Faecalibacterium") fit <- sacat_se( gems_microbiome[genera, ], ~ country + group, group = "group", reference = "Infant", library_size = "reads", component = "structural_absence" ) fit$results[, c("taxon", "p_structural_absence")]