exportResList: Export results from findMarkers, edgeR or DESeq2 to tsv

View source: R/func_markers.R

exportResListR Documentation

Export results from findMarkers, edgeR or DESeq2 to tsv

Description

This function takes a list of objects containing results from findMarkers(), edgeR or DESeq2, and save the content to text file(s).

Usage

exportResList(
  object,
  concatenate = FALSE,
  col_anno = NULL,
  direction = "both",
  prefix = "output",
  dir_path = NULL
)

Arguments

object

A named list of objects storing outputs returned by findMarkers(), edgeR or DESeq2, each of which contains results for the corresponding group of comparison.

concatenate

Logical scalar indicating whether to concatenate results stored in a list to a single file. Default is FALSE.

col_anno

A character vector containing the names of the annotation columns in the results stored in object, for example c("GeneID","Symbol"). This is used to construct common annotation column(s) when concatenate = TRUE. The row names of the result is used to create a "Symbol" column in the concatenated output when col_anno = NULL. Default is NULL.

direction

A string indicating the directionality of expression changes of markers/DEGs used to perform marker gene detection or differential expression analysis. The string is added to the output file name. Allowable character values are "both", "up" and "down". Default is "both".

prefix

A string indicating the prefix of output file. Default is "output".

dir_path

The directory path for exported TSV. The file is exported to the current working directory when file_path = NULL. Default is NULL.

Details

When concatenate = TRUE, the function concatenate the test statistics from results stored in the list and outputs a single file.

Author(s)

I-Hsuan Lin

Examples

library(SingleCellExperiment)

# Load demo dataset
data(sce)

# Use result saved after running findMarkers and 'pval.type = "any"'
# Save results into individual files in the per-session temporary directory
exportResList(metadata(sce)[["findMarkers1"]], dir_path = tempdir())

# Save concatenate result in the per-session temporary directory
exportResList(metadata(sce)[["findMarkers4"]],
  concatenate = TRUE,
  prefix = "findMarkers4", dir_path = tempdir()
)

ycl6/scRUtils documentation built on Feb. 18, 2025, 6:14 a.m.