pseudodynamics.de_test._base

Functions

fitGAM(count_matrix, cell_time[, n_knots, ...])

Fits a GAM model per gene using pseudotime.

fit_gam_simple(expr, time[, n_knots])

Simple wrapper for GAM fitting

load_gamfit(save_dir)

Load GAM fit from saved directory

process_gene_chunk(gene_indices, ...)

Process a subset of genes using the fitGAM function

run_fitGAM_parallel(expression_matrix, ...)

Run fitGAM in parallel across multiple cores using the original implementation

save_gamfit(gam_fit, save_dir)

save gam fit to disk

Classes

BetweenLineageTest(model, lineage_names)

Class for performing association tests between lineages using GAMs.

DifferentialExpressionTest(model)

Abstract base class for a DifferentialExpressionTest.

class pseudodynamics.de_test._base.BetweenLineageTest(model, lineage_names)[source]

Bases: DifferentialExpressionTest

Class for performing association tests between lineages using GAMs.

associationTest(pseudotimes, lineages, pairwise_test=False, global_test=True, l2fc=0, n_points=None)[source]

Perform association tests between lineages.

Parameters:
class pseudodynamics.de_test._base.DifferentialExpressionTest(model)[source]

Bases: ABC

Abstract base class for a DifferentialExpressionTest.

pseudodynamics.de_test._base.fitGAM(count_matrix, cell_time, n_knots=7, cell_weights=None, gene_symbol=None)[source]

Fits a GAM model per gene using pseudotime.

Args:

count_matrixnp.ndarray

Gene expression matrix (cells x genes).

cell_timenp.ndarray

Pseudotime values for cells.

n_knots: int

Number of knots for spline fitting.

cell_weightsnp.ndarray

Optional weights for each cell.

Returns:

: GAMResult: dict

Dictionary containing fitted models and metadata.

pseudodynamics.de_test._base.fit_gam_simple(expr, time, n_knots=7)[source]

Simple wrapper for GAM fitting

Parameters:

expr (np.ndarray): Gene expression values time (np.ndarray): Pseudotime values n_knots (int): Number of knots for spline fitting

Returns:

tuple: (predicted_values, model)

pseudodynamics.de_test._base.load_gamfit(save_dir)[source]

Load GAM fit from saved directory

Args:

save_dir (str): directory where GAM fit is saved

Returns:

gam_fit (dict): GAM fit, of key

pseudodynamics.de_test._base.process_gene_chunk(gene_indices, expression_matrix, cell_time, n_knots, gene_symbol)[source]

Process a subset of genes using the fitGAM function

Parameters: gene_indices: indices of genes to process expression_matrix: full gene expression matrix cell_time: pseudotime values n_knots: number of knots for spline fitting gene_symbol: list of gene names

Returns: dict with results for processed genes

pseudodynamics.de_test._base.run_fitGAM_parallel(expression_matrix, cell_time, genes, n_knots=7, n_cores=20)[source]

Run fitGAM in parallel across multiple cores using the original implementation

Parameters: expression_matrix: gene expression matrix (cells x genes) cell_time: pseudotime values for cells genes: list of gene names n_knots: number of knots for spline fitting n_cores: number of CPU cores to use

Returns: dict with all gene results

pseudodynamics.de_test._base.save_gamfit(gam_fit, save_dir)[source]

save gam fit to disk