| Title: | Group Technical Effects |
|---|---|
| Description: | Implementation of the GTE (Group Technical Effects) model for single-cell data. GTE is a quantitative metric to assess batch effects for individual genes in single-cell data. For a single-cell dataset, the user can calculate the GTE value for individual features (such as genes), and then identify the highly batch-sensitive features. Removing these highly batch-sensitive features results in datasets with low batch effects. |
| Authors: | Yang Zhou [aut, cre] |
| Maintainer: | Yang Zhou <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0 |
| Built: | 2026-05-16 05:44:17 UTC |
| Source: | https://github.com/yzhou1999/gtes |
Compute one-hot matrix for given data frame and variable (s)
group_onehot(x, ivar)group_onehot(x, ivar)
x |
Input data frame. |
ivar |
Variable (s) for one-hot computation. |
Compute the group technical effects.
Run.GroupTechEffects(X, meta, g_factor, b_factor, do.scale = FALSE)Run.GroupTechEffects(X, meta, g_factor, b_factor, do.scale = FALSE)
X |
Input data matrix. |
meta |
Input metadata (data.frame). |
g_factor |
Group variable (s). |
b_factor |
Batch variable (s). |
do.scale |
Whether to perform scaling. |
A list containing the overall GTE ($OverallTechEffects) and the GTE ($GroupTechEffects) of each subgroup under the group variable.
# X is a normalized expression matrix with rows as features and columns as cells. # meta is a data.frame with columns containing metadata such as cell type, batch, etc. data_file <- system.file("extdata", "example_data.rds", package = "GTEs") example_data <- readRDS(data_file) meta_file <- system.file("extdata", "example_meta.rds", package = "GTEs") example_meta <- readRDS(meta_file) GTE_ct <- Run.GroupTechEffects(example_data, example_meta, g_factor = "CellType", b_factor = "Batch")# X is a normalized expression matrix with rows as features and columns as cells. # meta is a data.frame with columns containing metadata such as cell type, batch, etc. data_file <- system.file("extdata", "example_data.rds", package = "GTEs") example_data <- readRDS(data_file) meta_file <- system.file("extdata", "example_meta.rds", package = "GTEs") example_meta <- readRDS(meta_file) GTE_ct <- Run.GroupTechEffects(example_data, example_meta, g_factor = "CellType", b_factor = "Batch")
Scale data matrix
scale_data( data.x, do.center = TRUE, do.scale = TRUE, row.means = NULL, row.sds = NULL )scale_data( data.x, do.center = TRUE, do.scale = TRUE, row.means = NULL, row.sds = NULL )
data.x |
Input data matrix. |
do.center |
Whether center the row values. (default TRUE) |
do.scale |
Whether scale the row values. (default TRUE) |
row.means |
The provided row means to center. (default NULL) |
row.sds |
The provided row standard deviations to scale. (default NULL) |
Select HBGs using GTE vector.
select_hbgs(gte, bins = 0.1, gte.ratio = 0.95, is.sort = TRUE)select_hbgs(gte, bins = 0.1, gte.ratio = 0.95, is.sort = TRUE)
gte |
Named GTE vector. |
bins |
Bins. |
gte.ratio |
Ratio of selected HBGs to overall GTE. |
is.sort |
Whether to sort genes by GTE from largest to smallest. |
Select HTGs using GTE vector.
select_htgs(gte, bins = 0.1, gte.ratio = 0.95, is.sort = T)select_htgs(gte, bins = 0.1, gte.ratio = 0.95, is.sort = T)
gte |
Named GTE vector. |
bins |
Bins. |
gte.ratio |
Ratio of selected HTGs to overall GTE. |
is.sort |
Whether to sort genes by GTE from largest to smallest. |
Select highly batch-sensitive genes (HBGs) under a group variable.
Select.HBGs(GTE, bins = 0.1, gte.ratio = 0.95)Select.HBGs(GTE, bins = 0.1, gte.ratio = 0.95)
GTE |
GTE result. |
bins |
Bins. |
gte.ratio |
Ratio of selected HBGs to the total GTE. |
Identified HBGs.
# GTE is the result of Run.GroupTechEffects function. data_file <- system.file("extdata", "GTE_ct.rds", package = "GTEs") GTE_ct <- readRDS(data_file) HBGs <- Select.HBGs(GTE_ct)# GTE is the result of Run.GroupTechEffects function. data_file <- system.file("extdata", "GTE_ct.rds", package = "GTEs") GTE_ct <- readRDS(data_file) HBGs <- Select.HBGs(GTE_ct)
Select HTGs under a group variable.
Select.HTGs(GTE, bins = 0.1, gte.ratio = 0.95)Select.HTGs(GTE, bins = 0.1, gte.ratio = 0.95)
GTE |
GTE result. |
bins |
Bins. |
gte.ratio |
Ratio of selected HTGs to overall GTE. |