Skip to contents

This function provides a simple wrapper to perform jackknife resampling on all columns of a SummarizedExperiment object and returns the results of each resample in a list. This function is designed to be used to assess the robustness of p-value combination techniques of the included meta_de() function but in theory any arbitrary function which operates on the columns of a SummarizedExperiment object could be used.

Usage

jackknifeSE(x, FUN, ...)

Arguments

x

SummarizedExperiment object to perform jackknife resampling of columns on

FUN

Function to perform on each resample.

...

Additional arguments passed to FUN

Value

List of jackknife resampled results

Examples

# Define three differential expression dataset data.frames
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)
)

exp3 <- data.frame(
  feature_id = c("geneA", "geneB", "geneC", "geneD"),
  PValue = c(0.03, 0.3, 0.01, 0.8),
  FDR = c(0.08, 0.4, 0.04, 0.9),
  logFC = c(1.5, -2.0, 3.0, 4.1),
  logCPM = c(14, 10, 1, 2.1)
)

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

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

# Perform the jackknife using meta_de on each subset of the data
result <- jackknifeSE(se, \(x) meta_de(x, metapod::parallelWilkinson, min.prop = 0.5))

# Combine the results from calling meta_de on each resample and show
result <- data.table::rbindlist(result, idcol = "Jackknife")
head(result[order(Feature)])
#>    Jackknife Feature Combined.Pval Direction Rep.logFC Rep.Pval Median.logFC
#>        <int>  <char>         <num>    <char>     <num>    <num>        <num>
#> 1:         1   geneA        0.0591        up       1.5     0.03         1.50
#> 2:         2   geneA        0.0199        up       1.2     0.01         1.35
#> 3:         3   geneA        0.0199        up       1.2     0.01         1.35
#> 4:         1   geneB        0.5100      down      -2.0     0.30        -2.00
#> 5:         2   geneB        0.5100      down      -2.0     0.30        -2.25
#> 6:         3   geneB        0.5100      down      -2.0     0.30        -2.25
#>    Mean.logFC Min.logFC Max.logFC
#>         <num>     <num>     <num>
#> 1:       1.50       1.5       1.5
#> 2:       1.35       1.2       1.5
#> 3:       1.35       1.2       1.5
#> 4:      -2.00      -2.0      -2.0
#> 5:      -2.25      -2.5      -2.0
#> 6:      -2.25      -2.5      -2.0