Skip to content
glycoversePublic

About

Statistical analysis for glycomics and glycoproteomics data.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

glystats

Lifecycle: experimental R-universe version R-CMD-check Codecov test coverage

The goal of glystats is to perform statistical analysis on glycoproteomics and glycomics data. It works seamlessly with the glyexp package.

Installation

Install glycoverse

We recommend installing the meta-package glycoverse, which includes this package and other core glycoverse packages.

Install glystats alone

If you don’t want to install all glycoverse packages, you can only install glystats.

You can install the latest release of glystats from r-universe (recommended):

# install.packages("pak")
pak::repo_add(glycoverse = "https://glycoverse.r-universe.dev")
pak::pkg_install("glystats")

Or from GitHub:

pak::pkg_install("glycoverse/glystats@*release")

Or install the development version (NOT recommended):

pak::pkg_install("glycoverse/glystats")

Note: Tips and troubleshooting for the meta-package glycoverse are also applicable here: Installation of glycoverse.

SE identities and annotations

Analysis uses the object’s row/column axes, not ordinary rowData$variable or colData$sample columns. Non-empty unique axis names remain result IDs. Unnamed, duplicated, or empty-name axes use unique input-position IDs without changing the experiment. Every SE result includes identifiers, mapping those IDs to input positions and the original labels (also with add_info = FALSE). Metadata are attached by position; colliding annotation columns are preserved with an _metadata suffix rather than overwriting result fields.

For position-keyed variables, pass the same unmodified input to filter_sig_vars(). Re-run analysis after reordering or changing it; position IDs are not persistent IDs across different inputs. See ?gly_identity for the full contract and how to recover original labels.

Control log transformation

All expression-analysis functions default to log_transform = NULL. Record the supplied abundance scale in S4Vectors::metadata(exp)$scale: "raw", "log" (natural logarithm), "log2", "log10", or "logx". Known logged values are used unchanged. Raw values and old objects without scale metadata retain each method’s previous default; Cox, ROC, and fold change continue to use unlogged values by default. Use TRUE to request the method’s log transformation for raw values, or FALSE to use supplied values unchanged. If the recorded scale is already log, log2, log10, or logx, TRUE warns and is ignored: no second logarithm is applied. Setting metadata never transforms the data.

# Data already transformed using log10:
S4Vectors::metadata(exp)$scale <- "log10"
pca <- gly_pca(exp)
pca$preprocessing
# This warns and still uses the supplied log10 values unchanged:
cox <- gly_cox(exp, log_transform = TRUE)

PCA, PLS-DA, OPLS-DA, t-SNE, and UMAP retain log(x + 1); other methods use log2(x + 1e-6) when enabled. Set construction and inference share the same choice. Results retain input metadata in meta_data and record input/analysis scales and the actual transformation in preprocessing. Model estimates, standard errors, intervals, and raw fits stay in analysis units.

For raw inputs, differential-test fold changes remain log2 ratios of arithmetic means. For ordinary logged inputs, they are differences of group means converted to log2 units (geometric mean ratios). Natural-log differences are divided by log(2); base-10 differences are multiplied by log2(10). Limma contrasts follow the same change of base; raw-scale contrasts are returned as estimate with NA log2fc. filter_sig_vars() uses significance-only filtering for raw-scale limma results and rejects explicit fold-change cutoffs. For raw input, gly_fold_change(log_transform = TRUE) uses newly logged values, including the original pseudo-count. See ?gly_scale for the full contract.

"logx" identifies transformed coordinates such as CLR, ALR, or VSN output. All analyses except gly_fold_change() can use these coordinates unchanged, including negative and zero values. log_transform = TRUE warns and is ignored for logx, just as for ordinary logged scales. The method’s statistical assumptions still need to be appropriate for the chosen coordinates; the label does not make these transformations equivalent.

Original-abundance fold changes cannot be inferred from logx. gly_fold_change() therefore rejects it. Differential tests retain native estimates and effect sizes but return NA in log2fc; limma reports its native contrast in estimate. filter_sig_vars() uses significance-only filtering for logx, even for glycoproteomics; a non-NULL fold-change cutoff warns and is ignored. Explicit fc_cutoff = NULL disables fold-change filtering on every scale. Omitting the argument retains the default cutoff of 2 for glycoproteomics comparisons with available fold changes. Use a separate experiment on a known abundance scale when fold changes are needed; relabeling logx coordinates does not recover abundances.

Older development objects labeled "log" must be relabeled if their actual base was 2 or 10. The package never guesses the base. Result extraction and significance-filtering utilities do not transform expression.

Documentation

  • 🚀 Get started: Here
  • 📚 Reference: Here

Role in glycoverse

glystats is the downstream analysis package in the glycoverse ecosystem. It provides statistical analysis functions for glyexp::GlycomicSE and glyexp::GlycoproteomicSE objects. A common workflow is to use glyread to import data, glyclean to preprocess data, and then glystats to perform statistical analysis.

Example

Say we already have a preprocessed glycomics or glycoproteomics container called exp:

# Two-sample t-test
ttest_res <- gly_ttest(exp)

# PCA analysis
pca_res <- gly_pca(exp)

# ROC analysis
roc_res <- gly_roc(exp)

That’s it! These functions use glycoverse column conventions to load needed data and perform analysis. All functions start with gly_ to leverage the auto-completion in RStudio. They accept a glyexp::GlycomicSE or glyexp::GlycoproteomicSE object, and return analysis result as a tibble or a list of tibbles. See documentation for each function for more details.

SE result identity columns are .variable and .sample, while ordinary metadata variable and sample remain annotation columns. Check result$identifiers$columns to distinguish this output contract from older results. Correlation endpoints use .variable1/.variable2 or .sample1/.sample2. This is an output API change, including for fully named unique inputs; plotting consumers require adaptation.

About

Statistical analysis for glycomics and glycoproteomics data.

Topics

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages