pegasus.deseq2

pegasus.deseq2(pseudobulk, design, contrast, de_key='deseq2', replaceOutliers=True)[source]

Perform Differential Expression (DE) Analysis using DESeq2 on pseduobulk data. This function calls R package DESeq2, requiring DESeq2 in R installed.

DE analysis will be performed on all pseudo-bulk matrices in pseudobulk.

Parameters
  • pseudobulk (UnimodalData) – Pseudobulk data with rows for samples and columns for genes. If pseudobulk contains multiple matrices, DESeq2 will apply to all matrices.

  • design (str) – Design formula that will be passed to DESeq2

  • contrast (Tuple[str, str, str]) – A tuple of three elements passing to DESeq2: a factor in design formula, a level in the factor as numeritor of fold change, and a level as denominator of fold change.

  • de_key (str, optional, default: "deseq2") – Key name of DE analysis results stored. For cluster.X, stored key will be cluster.de_key

  • replaceOutliers (bool, optional, default: True) – If execute DESeq2’s replaceOutliers step. If set to False, we will set minReplicatesForReplace=Inf in DESeq function and set cooksCutoff=False in results function.

Return type

None

Returns

  • None

  • Update pseudobulk.varmpseudobulk.varm[de_key]: DE analysis result for pseudo-bulk count matrix. pseudobulk.varm[cluster.de_key]: DE results for cluster-specific pseudo-bulk count matrices.

Examples

>>> pg.deseq2(pseudobulk, '~gender', ('gender', 'female', 'male'))