Skip to contents

This function takes as input a list of data.frames containing differential expression results and converts this list to a SummarizedExperiment object containing assays for each of the reported statistics columns. This function is intended to be used upstream of the meta-analysis functions implemented in this package.

Usage

dfs2se(
  x,
  feature_col = "feature_id",
  import = c("logFC", "logCPM", "PValue", "FDR"),
  complete = FALSE
)

Arguments

x

List of data.frames containing differential expression results. All data.frames must have matching colnames.

feature_col

Column name in the data.frames containing the gene or feature ids. Default "feature_id"

import

Character vector of columns from the data.frames to import. These columns will be converted to assays in the final SummarizedExperiment object.

complete

Use only features found across all datasets. Default FALSE, i.e. fill data for missing features with NAs.

Value

SummarizedExperiment object containing assays for each of the columns in 'import'.

Examples


# data.frames containing differential expression data
exp1 <- data.frame(
  feature_id = c("geneA", "geneB", "geneC"),
  PValue = c(0.01, 0.5, 0.05),
  FDR = c(0.02, 0.5, 0.07),
  logFC = c(1.2, -2.5, 3.7),
  logCPM = c(12, 9, 0)
)

exp2 <- data.frame(
  feature_id = c("geneA", "geneB", "geneD"),
  PValue = c(0.07, 0.3, 0.8),
  FDR = c(0.08, 0.4, 1.0),
  logFC = c(1.5, -2.0, 3.0),
  logCPM = c(14, 10, 2)
)

# Combine into a single list
l <- list(experiment1 = exp1, experiment2 = exp2)

# Convert the data to a SummarizedExperiment
se <- dfs2se(l)

# Data is converted to assays
SummarizedExperiment::assays(se)
#> List of length 4
#> names(4): logFC logCPM PValue FDR