| Title: | Glycoproteomics and Glycomics Experiments |
|---|---|
| Description: | Provides a tidy data framework for managing glycoproteomics and glycomics experimental data. The 'GlycomicSE' and 'GlycoproteomicSE' classes extend 'SummarizedExperiment' with validated glycomics and glycoproteomics schemas. The package provides dplyr-style data manipulation functions (filter, mutate, select, arrange, slice, join) for seamless data wrangling. As the data core of the 'glycoverse' ecosystem, it provides consistent interfaces for data exchange and analysis workflows. |
| Authors: | Bin Fu [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-8567-2997>) |
| Maintainer: | Bin Fu <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.16.0 |
| Built: | 2026-07-21 05:15:13 UTC |
| Source: | https://github.com/glycoverse/glyexp |
Arrange the sample or variable information of an experiment() or
SummarizedExperiment.
The same syntax as dplyr::arrange() is used.
For example, to arrange samples by the "group" column,
use arrange_col(exp, group).
This actually calls dplyr::arrange() on the sample information tibble
with the group column,
and then updates the expression matrix accordingly to match the new order.
arrange_col(exp, ...) arrange_row(exp, ...)arrange_col(exp, ...) arrange_row(exp, ...)
exp |
An |
... |
< |
An object of the same class as exp.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
library(SummarizedExperiment) # Add a variable annotation to a bundled experiment exp <- real_experiment |> mutate_row(type = "glycopeptide") # Arrange samples by group column arranged_exp <- arrange_col(exp, group) colData(arranged_exp) assay(arranged_exp) # Arrange variables by type column arranged_exp <- arrange_row(exp, type) rowData(arranged_exp) assay(arranged_exp) # Arrange by multiple columns arrange_col(exp, group, .sample)library(SummarizedExperiment) # Add a variable annotation to a bundled experiment exp <- real_experiment |> mutate_row(type = "glycopeptide") # Arrange samples by group column arranged_exp <- arrange_col(exp, group) colData(arranged_exp) assay(arranged_exp) # Arrange variables by type column arranged_exp <- arrange_row(exp, type) rowData(arranged_exp) assay(arranged_exp) # Arrange by multiple columns arrange_col(exp, group, .sample)
as_glycomic_se() converts supported objects to a GlycomicSE object.
Existing GlycomicSE objects are returned unchanged. experiment() objects
are first converted with as_se(), and SummarizedExperiment objects are
reclassified after GlycomicSE validity checks pass.
is_glycomic_se() checks whether an object inherits from GlycomicSE.
as_glycomic_se(x) is_glycomic_se(x)as_glycomic_se(x) is_glycomic_se(x)
x |
An object to coerce or check. |
as_glycomic_se() returns a GlycomicSE object.
is_glycomic_se() returns a logical value.
as_glycoproteomic_se() converts supported objects to a
GlycoproteomicSE object. Existing GlycoproteomicSE objects are returned
unchanged. experiment() objects are first converted with as_se(), and
SummarizedExperiment objects are reclassified after GlycoproteomicSE
validity checks pass.
is_glycoproteomic_se() checks whether an object inherits from
GlycoproteomicSE.
as_glycoproteomic_se(x) is_glycoproteomic_se(x)as_glycoproteomic_se(x) is_glycoproteomic_se(x)
x |
An object to coerce or check. |
as_glycoproteomic_se() returns a GlycoproteomicSE object.
is_glycoproteomic_se() returns a logical value.
Transforms a glycoproteomics-type experiment into a glycomics-type experiment by aggregating expression values by glycan structure (if available) or glycan composition.
This function implements the "pseudo-glycome" method described in doi:10.1038/s41467-026-68579-x, which aggregates glycoproteomic data by glycans to simulate glycome data when real glycome is unavailable.
as_pseudo_glycome(exp, aggr_method = c("sum", "mean", "median"))as_pseudo_glycome(exp, aggr_method = c("sum", "mean", "median"))
exp |
A glycoproteomics |
aggr_method |
Aggregation method to use. One of "sum", "mean", or "median". Default is "sum". Note that glycopeptides can have different ionization efficiencies, so none of these methods are technically rigorous. |
Aggregation behavior:
If glycan_structure column exists in var_info, aggregation is done
by glycan structure (more specific)
Otherwise, aggregation is done by glycan_composition
Expression values are aggregated within each glycan group using the
specified aggr_method
Limitation: Glycopeptides can have different ionization efficiencies, so the aggregation operation is not technically rigorous regardless of the method used. Use results with caution.
If exp is an experiment(), a glycomics-type experiment() with
aggregated expression values.
If exp is a GlycoproteomicSE(), a GlycomicSE() with aggregated
expression values.
The variable metadata will contain only glycan_composition and
glycan_structure (if present in input) columns.
library(glyrepr) as_pseudo_glycome(real_experiment)library(glyrepr) as_pseudo_glycome(real_experiment)
Getting a subset of an experiment() or SummarizedExperiment by filtering
samples or variables.
The same syntax as dplyr::filter() is used.
For example, to get a subset of an experiment keeping only "HC" samples,
use filter_col(exp, group == "HC").
This actually calls dplyr::filter() on the sample information tibble
with condition group == "HC",
and then updates the expression matrix accordingly.
filter_col(exp, ..., .drop_levels = FALSE) filter_row(exp, ..., .drop_levels = FALSE)filter_col(exp, ..., .drop_levels = FALSE) filter_row(exp, ..., .drop_levels = FALSE)
exp |
An |
... |
< |
.drop_levels |
Logical. If |
One difference between filter_col() or filter_row() and dplyr::filter is that,
when filtering on factor columns, unused levels can be dropped by setting
.drop_levels to TRUE.
An object of the same class as exp.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
library(SummarizedExperiment) # Add a variable annotation to a bundled experiment exp <- real_experiment |> mutate_row(type = "glycopeptide") # Filter samples sub_exp_1 <- filter_col(exp, group == "H") colData(sub_exp_1) # Filter variables sub_exp_2 <- filter_row(exp, type == "glycopeptide") rowData(sub_exp_2) # Use pipe sub_exp_3 <- exp |> filter_col(group == "H") |> filter_row(type == "glycopeptide") sub_exp_3library(SummarizedExperiment) # Add a variable annotation to a bundled experiment exp <- real_experiment |> mutate_row(type = "glycopeptide") # Filter samples sub_exp_1 <- filter_col(exp, group == "H") colData(sub_exp_1) # Filter variables sub_exp_2 <- filter_row(exp, type == "glycopeptide") rowData(sub_exp_2) # Use pipe sub_exp_3 <- exp |> filter_col(group == "H") |> filter_row(type == "glycopeptide") sub_exp_3
GlycomicSE() creates a single-assay
SummarizedExperiment::SummarizedExperiment() subclass for glycomics data.
It is a thin wrapper around SummarizedExperiment() with additional
Glycoverse validation:
Exactly one assay is allowed. Extra assays are rejected to avoid ambiguous glycomics measurements.
The assay must contain only non-negative values. Raw glycomics abundance data are non-negative; log transformation should be handled by downstream Glycoverse packages.
rowData must contain a glycan_composition column, and that column must
be a glyrepr::glycan_composition() vector. A glycan_structure column is
optional, but if present it must be a glyrepr::glycan_structure() vector.
metadata must contain a glycan_type field.
This container is experimental and is not recognized by all Glycoverse
packages yet. It is intended to become a recommended entry point as package
contracts migrate toward SummarizedExperiment-based containers.
GlycomicSE(abundance, ...)GlycomicSE(abundance, ...)
abundance |
A numeric abundance matrix with glycans as rows and samples as columns. |
... |
Arguments passed to
|
A GlycomicSE object.
GlycomicSE is an S4 class that extends
SummarizedExperiment::SummarizedExperiment().
GlycoproteomicSE() creates a single-assay
SummarizedExperiment::SummarizedExperiment() subclass for
glycoproteomics data. It is a thin wrapper around SummarizedExperiment()
with additional Glycoverse validation:
Exactly one assay is allowed. Extra assays are rejected to avoid ambiguous glycoproteomics measurements.
The assay must contain only non-negative values. Raw glycoproteomics abundance data are non-negative; log transformation should be handled by downstream Glycoverse packages.
rowData must contain protein, protein_site, and
glycan_composition columns. The protein column must be character,
protein_site must be integer-like, and glycan_composition must be a
glyrepr::glycan_composition() vector. A glycan_structure column is
optional, but if present it must be a glyrepr::glycan_structure() vector.
metadata must contain a glycan_type field.
This container is experimental and is not recognized by all Glycoverse
packages yet. It is intended to become a recommended entry point as package
contracts migrate toward SummarizedExperiment-based containers.
GlycoproteomicSE(abundance, ...)GlycoproteomicSE(abundance, ...)
abundance |
A numeric abundance matrix with glycopeptides or glycoforms as rows and samples as columns. |
... |
Arguments passed to
|
A GlycoproteomicSE object.
GlycoproteomicSE is an S4 class that extends
SummarizedExperiment::SummarizedExperiment().
These functions allow you to join additional data to the sample information
or variable information of an experiment() or SummarizedExperiment.
They work similarly to
dplyr::left_join(), dplyr::inner_join(), dplyr::semi_join(), and
dplyr::anti_join(), while keeping assay dimensions synchronized with the
joined metadata.
After joining, the assay dimensions are automatically updated to reflect any changes in the number of samples or variables.
Important Notes:
The relationship parameter is locked to "many-to-one" to ensure that
the number of observations never increases, which would violate the
experiment object assumptions.
right_join() and full_join() are not supported as they could add
new observations to the experiment.
left_join_col(exp, y, by = NULL, ...) inner_join_col(exp, y, by = NULL, ...) semi_join_col(exp, y, by = NULL, ...) anti_join_col(exp, y, by = NULL, ...) left_join_row(exp, y, by = NULL, ...) inner_join_row(exp, y, by = NULL, ...) semi_join_row(exp, y, by = NULL, ...) anti_join_row(exp, y, by = NULL, ...)left_join_col(exp, y, by = NULL, ...) inner_join_col(exp, y, by = NULL, ...) semi_join_col(exp, y, by = NULL, ...) anti_join_col(exp, y, by = NULL, ...) left_join_row(exp, y, by = NULL, ...) inner_join_row(exp, y, by = NULL, ...) semi_join_row(exp, y, by = NULL, ...) anti_join_row(exp, y, by = NULL, ...)
exp |
An |
y |
A data frame to join to |
by |
A join specification created with |
... |
Other arguments passed to the underlying dplyr join function,
except |
An object of the same class as exp, with updated sample or variable
information.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
Mutate the sample or variable information of an experiment() or
SummarizedExperiment.
The same syntax as dplyr::mutate() is used.
For example, to add a new column to the sample information tibble,
use mutate_col(exp, new_column = value).
This actually calls dplyr::mutate() on the sample information tibble
with new_column = value.
If an identifier column is modified, its new values must be unique; otherwise, an error is thrown. The assay column names or row names will be updated accordingly.
mutate_col(exp, ...) mutate_row(exp, ...)mutate_col(exp, ...) mutate_row(exp, ...)
exp |
An |
... |
< |
An object of the same class as exp.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
library(SummarizedExperiment) # Add metadata to a bundled experiment exp <- real_experiment |> mutate_row(type = "glycopeptide") # Add a new column to sample information tibble or variable information tibble exp |> mutate_col(new_column = 1) |> colData() exp |> mutate_row(new_column = "A") |> rowData() # Modify existing columns exp |> mutate_col(group = dplyr::if_else(group == "H", "healthy", "other")) |> colData() exp |> mutate_row(type = dplyr::if_else(type == "glycopeptide", "good", "bad")) |> rowData() # SummarizedExperiment identifiers use virtual dot-prefixed columns mutate_col(exp, .sample = paste0("new_", .sample)) mutate_row(exp, .variable = paste0("new_", .variable))library(SummarizedExperiment) # Add metadata to a bundled experiment exp <- real_experiment |> mutate_row(type = "glycopeptide") # Add a new column to sample information tibble or variable information tibble exp |> mutate_col(new_column = 1) |> colData() exp |> mutate_row(new_column = "A") |> rowData() # Modify existing columns exp |> mutate_col(group = dplyr::if_else(group == "H", "healthy", "other")) |> colData() exp |> mutate_row(type = dplyr::if_else(type == "glycopeptide", "good", "bad")) |> rowData() # SummarizedExperiment identifiers use virtual dot-prefixed columns mutate_col(exp, .sample = paste0("new_", .sample)) mutate_row(exp, .variable = paste0("new_", .variable))
A real glycoproteomics experiment object.
This dataset is derived from the unpublished ProteomeXchange dataset PXD063749.
It contains serum N-glycoproteome profiles from 12 patients with different liver conditions:
healthy (H), hepatitis (M), cirrhosis (Y), and hepatocellular carcinoma (C).
Glycopeptide identification and annotation were performed using pGlyco3
(https://github.com/pFindStudio/pGlyco3), and quantification was carried out with pGlycoQuant
(https://github.com/Power-Quant/pGlycoQuant).
The raw data were imported with glyread::read_pglyco3_pglycoquant().
real_experimentreal_experiment
A GlycoproteomicSE() object with 4262 variables and 12 samples.
peptide: peptide sequence
peptide_site: site position on the peptide
protein: protein accession
protein_site: site position on the protein
gene: gene symbol
glycan_composition: glycan composition (glyrepr::glycan_composition())
glycan_structure: glycan structure (glyrepr::glycan_structure())
group: disease group, one of "H" (healthy), "M" (hepatitis), "Y" (cirrhosis), and "C" (hepatocellular carcinoma)
A real glycomics experiment object. This dataset is derived from the unpublished glycoPOST dataset GPST000313. It contains serum N-glycome profiles from 144 samples with different liver conditions: healthy (H), hepatitis (M), cirrhosis (Y), and hepatocellular carcinoma (C).
real_experiment2real_experiment2
An GlycomicSE() object with 67 variables and 144 samples.
glycan_composition: glycan composition (glyrepr::glycan_composition())
glycan_structure: glycan structure (glyrepr::glycan_structure())
group: disease group, one of "H" (healthy), "M" (hepatitis), "Y" (cirrhosis), and "C" (hepatocellular carcinoma)
These two functions provide a way to rename columns in the sample or variable
information of an experiment() or SummarizedExperiment.
The same syntax as dplyr::rename() is used.
For example, to rename the "group" column in the sample information tibble to "condition",
use rename_col(exp, condition = group).
Note that you can't rename the "sample" column in the sample information tibble,
as well as the "variable" column in the variable information tibble.
These two columns are used to link the sample or variable information tibble
to the expression matrix.
rename_col(exp, ...) rename_row(exp, ...)rename_col(exp, ...) rename_row(exp, ...)
exp |
An |
... |
< |
An object of the same class as exp.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
toy_exp <- real_experiment toy_exp # Rename columns in sample information tibble rename_col(toy_exp, condition = group) # Rename columns in variable information tibble rename_row(toy_exp, composition = glycan_composition)toy_exp <- real_experiment toy_exp # Rename columns in sample information tibble rename_col(toy_exp, condition = group) # Rename columns in variable information tibble rename_row(toy_exp, composition = glycan_composition)
These two functions provide a way to trimming down the sample or variable information tibble
of an experiment() or SummarizedExperiment to only the columns of
interest.
The same syntax as dplyr::select() is used.
For example, to get a new experiment() with only the "sample" and "group"
columns in the sample information tibble,
use select_col(exp, group).
Note that you don't need to (and you can't) explicitly select or deselect the
sample column in sample_info.
The same applies to the variable column in var_info.
Whatever the selection expression is, the sample or variable column will always be kept.
select_col(exp, ...) select_row(exp, ...)select_col(exp, ...) select_row(exp, ...)
exp |
An |
... |
< |
An object of the same class as exp.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
toy_exp <- real_experiment toy_exp_2 <- toy_exp |> select_col(group) |> select_row(protein, peptide) toy_exp_2toy_exp <- real_experiment toy_exp_2 <- toy_exp |> select_col(group) |> select_row(protein, peptide) toy_exp_2
Slice the sample or variable information of an experiment() or
SummarizedExperiment.
These functions provide row-wise slicing operations similar to dplyr's slice functions. They select rows by position or based on values in specified columns, and update the expression matrix accordingly to match the new selection.
slice_col() and slice_row(): Select rows by position
slice_head_col() and slice_head_row(): Select first n rows
slice_tail_col() and slice_tail_row(): Select last n rows
slice_sample_col() and slice_sample_row(): Select random n rows
slice_max_col() and slice_max_row(): Select rows with highest values
slice_min_col() and slice_min_row(): Select rows with lowest values
slice_col(exp, ...) slice_row(exp, ...) slice_head_col(exp, n, prop) slice_head_row(exp, n, prop) slice_tail_col(exp, n, prop) slice_tail_row(exp, n, prop) slice_sample_col(exp, n, prop, weight_by = NULL, replace = FALSE) slice_sample_row(exp, n, prop, weight_by = NULL, replace = FALSE) slice_max_col(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE) slice_max_row(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE) slice_min_col(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE) slice_min_row(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE)slice_col(exp, ...) slice_row(exp, ...) slice_head_col(exp, n, prop) slice_head_row(exp, n, prop) slice_tail_col(exp, n, prop) slice_tail_row(exp, n, prop) slice_sample_col(exp, n, prop, weight_by = NULL, replace = FALSE) slice_sample_row(exp, n, prop, weight_by = NULL, replace = FALSE) slice_max_col(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE) slice_max_row(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE) slice_min_col(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE) slice_min_row(exp, order_by, ..., n, prop, with_ties = TRUE, na_rm = FALSE)
exp |
An |
... |
< |
n |
For |
prop |
For |
weight_by |
For |
replace |
For |
order_by |
For |
with_ties |
For |
na_rm |
For |
An object of the same class as exp.
For an experiment() object, sample is a physical column in
sample_info, and variable is a physical column in var_info.
For a SummarizedExperiment, sample and variable identifiers live in
colnames(exp) and rownames(exp), rather than in
SummarizedExperiment::colData() or SummarizedExperiment::rowData().
Observation verbs expose colnames(exp) as a virtual .sample column, and
variable verbs expose rownames(exp) as a virtual .variable column. These
dot-prefixed names distinguish dimension identifiers from regular metadata
columns. After the operation, the virtual column is removed and its values
are written back to the corresponding dimension names.
Consequently, sample in colData(exp) and variable in rowData(exp)
remain ordinary metadata columns. The names .sample and .variable are
reserved; an input containing either name in the corresponding metadata
raises an error rather than overwriting that column.
# Add values used for slicing to a bundled experiment exp <- real_experiment |> mutate_col(score = seq_len(dplyr::n())) |> mutate_row(value = seq_len(dplyr::n())) # Select specific rows by position slice_col(exp, 1, 3, 5) # Select first 3 samples slice_head_col(exp, n = 3) # Select last 2 variables slice_tail_row(exp, n = 2) # Select 2 random samples slice_sample_col(exp, n = 2) # Select samples with highest scores slice_max_col(exp, order_by = score, n = 2) # Select variables with lowest values slice_min_row(exp, order_by = value, n = 2)# Add values used for slicing to a bundled experiment exp <- real_experiment |> mutate_col(score = seq_len(dplyr::n())) |> mutate_row(value = seq_len(dplyr::n())) # Select specific rows by position slice_col(exp, 1, 3, 5) # Select first 3 samples slice_head_col(exp, n = 3) # Select last 2 variables slice_tail_row(exp, n = 2) # Select 2 random samples slice_sample_col(exp, n = 2) # Select samples with highest scores slice_max_col(exp, order_by = score, n = 2) # Select variables with lowest values slice_min_row(exp, order_by = value, n = 2)
Converts meaningless variable IDs (like "GP1", "V1") into meaningful, human-readable IDs based on the experiment type and available columns.
The format of the new IDs depends on the exp_type if format is not specified:
glycomics: {glycan_composition}, e.g., "Hex(5)HexNAc(2)"
glycoproteomics: {protein}-{protein_site}-{glycan_composition}
traitomics: {motif} or {trait} depending on which column is present
traitproteomics: {protein}-{protein_site}-{motif} or {protein}-{protein_site}-{trait}
If duplicate IDs are generated (e.g., same composition with multiple PSMs),
a unique integer suffix is appended using the unique_suffix pattern.
standardize_variable(exp, format = NULL, unique_suffix = "-{N}")standardize_variable(exp, format = NULL, unique_suffix = "-{N}")
exp |
An |
format |
A format string specifying how to construct variable IDs.
Use |
unique_suffix |
A string pattern for making IDs unique when duplicates exist.
Must contain |
exp with standardized variable IDs. The input container class is
preserved.
# Glycomics example expr_mat <- matrix(1:4, nrow = 2) rownames(expr_mat) <- c("V1", "V2") colnames(expr_mat) <- c("S1", "S2") sample_info <- tibble::tibble(sample = c("S1", "S2")) var_info <- tibble::tibble( variable = c("V1", "V2"), glycan_composition = glyrepr::glycan_composition(c(Hex = 5, HexNAc = 2)) ) exp <- experiment(expr_mat, sample_info, var_info, exp_type = "glycomics", glycan_type = "N" ) standardize_variable(exp) # Glycoproteomics example expr_mat <- matrix(1:4, nrow = 2) rownames(expr_mat) <- c("GP1", "GP2") colnames(expr_mat) <- c("S1", "S2") sample_info <- tibble::tibble(sample = c("S1", "S2")) var_info <- tibble::tibble( variable = c("GP1", "GP2"), protein = c("P12345", "P12345"), protein_site = c(32L, 45L), glycan_composition = glyrepr::glycan_composition(c(Hex = 5, HexNAc = 2)) ) exp <- experiment(expr_mat, sample_info, var_info, exp_type = "glycoproteomics", glycan_type = "N" ) standardize_variable(exp) # Custom format example standardize_variable(exp, format = "{protein}-{glycan_composition}")# Glycomics example expr_mat <- matrix(1:4, nrow = 2) rownames(expr_mat) <- c("V1", "V2") colnames(expr_mat) <- c("S1", "S2") sample_info <- tibble::tibble(sample = c("S1", "S2")) var_info <- tibble::tibble( variable = c("V1", "V2"), glycan_composition = glyrepr::glycan_composition(c(Hex = 5, HexNAc = 2)) ) exp <- experiment(expr_mat, sample_info, var_info, exp_type = "glycomics", glycan_type = "N" ) standardize_variable(exp) # Glycoproteomics example expr_mat <- matrix(1:4, nrow = 2) rownames(expr_mat) <- c("GP1", "GP2") colnames(expr_mat) <- c("S1", "S2") sample_info <- tibble::tibble(sample = c("S1", "S2")) var_info <- tibble::tibble( variable = c("GP1", "GP2"), protein = c("P12345", "P12345"), protein_site = c(32L, 45L), glycan_composition = glyrepr::glycan_composition(c(Hex = 5, HexNAc = 2)) ) exp <- experiment(expr_mat, sample_info, var_info, exp_type = "glycoproteomics", glycan_type = "N" ) standardize_variable(exp) # Custom format example standardize_variable(exp, format = "{protein}-{glycan_composition}")
This function summarizes the number of
glycan compositions, glycan structures, glycopeptides, peptides,
glycoforms, glycoproteins, and glycosites in an experiment(),
GlycomicSE(), or GlycoproteomicSE().
summarize_experiment(x, count_struct = NULL)summarize_experiment(x, count_struct = NULL)
x |
An |
count_struct |
For counting glycopeptides and glycoforms.
whether to count the number of glycan structures or glycopeptides.
If |
The following columns are required in the variable information tibble:
composition: glycan_composition
structure: glycan_structure
peptide: peptide
glycopeptide: glycan_composition or glycan_structure, peptide, peptide_site
glycoform: glycan_composition or glycan_structure,
protein or proteins, protein_site or protein_sites
protein: protein or proteins
glycosite: protein or proteins, protein_site or protein_sites
You can use count_struct parameter to control how to count glycopeptides and glycoforms,
either by glycan structures or by glycan compositions.
A tibble with columns item and n
summarizing the results. The items include:
total_composition: The number of glycan compositions.
total_structure: The number of glycan structures.
total_peptide: The number of peptides.
total_glycopeptide: The number of unique combinations of peptides, sites, and glycans.
total_glycoform: The number of unique combinations of proteins, sites, and glycans.
total_protein: The number of proteins.
total_glycosite: The number of unique combinations of proteins and sites.
In addition, _per_sample items are calculated as the average number of detected items per sample.
For example, composition_per_sample is the average number of glycan compositions detected per sample.
exp <- real_experiment summarize_experiment(exp)exp <- real_experiment summarize_experiment(exp)