Package 'GTEs'

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

Help Index


Compute one-hot matrix for given data frame and variable (s)

Description

Compute one-hot matrix for given data frame and variable (s)

Usage

group_onehot(x, ivar)

Arguments

x

Input data frame.

ivar

Variable (s) for one-hot computation.


Compute the group technical effects.

Description

Compute the group technical effects.

Usage

Run.GroupTechEffects(X, meta, g_factor, b_factor, do.scale = FALSE)

Arguments

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.

Value

A list containing the overall GTE ($OverallTechEffects) and the GTE ($GroupTechEffects) of each subgroup under the group variable.

Examples

# 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

Description

Scale data matrix

Usage

scale_data(
  data.x,
  do.center = TRUE,
  do.scale = TRUE,
  row.means = NULL,
  row.sds = NULL
)

Arguments

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.

Description

Select HBGs using GTE vector.

Usage

select_hbgs(gte, bins = 0.1, gte.ratio = 0.95, is.sort = TRUE)

Arguments

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.

Description

Select HTGs using GTE vector.

Usage

select_htgs(gte, bins = 0.1, gte.ratio = 0.95, is.sort = T)

Arguments

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.

Description

Select highly batch-sensitive genes (HBGs) under a group variable.

Usage

Select.HBGs(GTE, bins = 0.1, gte.ratio = 0.95)

Arguments

GTE

GTE result.

bins

Bins.

gte.ratio

Ratio of selected HBGs to the total GTE.

Value

Identified HBGs.

Examples

# 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.

Description

Select HTGs under a group variable.

Usage

Select.HTGs(GTE, bins = 0.1, gte.ratio = 0.95)

Arguments

GTE

GTE result.

bins

Bins.

gte.ratio

Ratio of selected HTGs to overall GTE.