Skip to contents

constructNull takes the target data as the input and returns the corresponding synthetic null data.

Usage

constructNull(
  obj,
  approximation = "none",
  corr_cut = 0.1,
  data_type = "scRNA",
  family = "nb",
  formula = "1",
  if_sparse = F,
  n_cores = 1,
  n_pcs = 200,
  n_rep = 1,
  other_covariates = NULL,
  seed = 123
)

Arguments

obj

A Seurat object. The reference data.

approximation

A string of either "none", "fast" or "pca". For a high-latitude scRNA counting matrix, use "fast" as approximation can increase the speed of data generation while ensuring accuracy. For high-dimensional scRNA data (gene number is much larger than cell number), use "pca" as approximation. Default is "none".

corr_cut

A numeric value. The cutoff for non-zero proportions in genes used in modelling correlation. Default is 0.1. All features will be used if approximation is set to "pca", or when data_type is "bulk_microarray".

data_type

A string of either "scRNA", "scATAC", "spatial", "cellline", "microbiome" or "bulk_microarray". Default is "scRNA".

family

A string of the distribution of your data. Must be one of 'nb', 'binomial', 'poisson', 'zip', 'zinb' or 'gaussian', which represent 'poisson distribution', 'negative binomial distribution', 'zero-inflated poisson distribution', 'zero-inflated negative binomail distribution', and 'gaussian distribution' respectively. For UMI-counts data, we usually use 'nb'. For bulk microarray data, use 'gaussian'. Default is 'nb'.

formula

A string of the mu parameter formula. It defines the relationship between gene expression in synthetic null data and the extra covariates. Default is 1 (cell type case). For example, if your input data is a spatial data with X, Y coordinates, the formula can be 's(X, Y, bs = 'gp', k = 4)'.

if_sparse

A logic value. For high-dimensional data (gene number is much larger than cell number), if a sparse correlation estimation will be used. Default is FALSE.

n_cores

An integer. The number of cores to use for Parallel processing.

n_pcs

A numeric value. Number of PCs to use when usePca=T. Default is 200.

n_rep

An integer. The number of sampled synthetic null datasets. Default value is 1.

other_covariates

A list of the extra covariates used in formula. For example, the 2D spatial coordinates. Default is NULL.

seed

Random seed. Default is 123

Value

The expression matrix of the synthetic null data.

Details

This function constructs the synthetic null data based on the target data (real data). The input is a expression matrix (gene by cell); the user should specify a distribution, which is usually Negative Binomial for count matrix.