Skip to contents

Wrapper to perform multiple pairwise contrasts with DESeq2::DESeq()

Usage

run_deseq(
  counts,
  meta,
  covar,
  outcome_of_interest,
  contrasts,
  dds = NULL,
  shrink = FALSE,
  verbose = FALSE
)

Arguments

counts

data frame of raw filtered RNA-seq counts. Row names are gene IDs and column names are sample IDs. Column names must correspond to values in meta$viallabel

meta

data frame of metadata with columns c(outcome_of_interest, covar, 'viallabel') at a minimum. counts are subset to meta$viallabel.

covar

character vector, adjustment variables to include in the DESeq model

outcome_of_interest

character, outcome of interest to include in the model. meta must include this variable as column. contrasts must include levels in this variable.

contrasts

list of vectors, where each vector is in the form c(outcome_of_interest, numerator, denominator), e.g. c('sex_group','female.1w','female.control')

dds

optional DESeq2::DESeqResults() object if it was previously generated

shrink

bool, whether to apply DESeq2::lfcShrink()

verbose

bool, whether to print the design string

Value

named list of two items:

res

data frame of results

dds

DESeq2::DESeqResults() object

Examples

if (FALSE) { # \dontrun{
# Get 1- and 2- week training effects in female gastrocnemius
data = transcript_prep_data("SKM-GN", sex = "female")
deseq_res = run_deseq(data$filt_counts, 
                      data$metadata,
                      data$covariates,
                      "group",
                      list(c("group","1w","control"), c("group","2w","control")))
head(deseq_res$res)
                      
# Get shrunken effects using the DESeqResults objects generated in the previous step
deseq_res_shrunk = run_deseq(data$filt_counts, 
                            data$metadata,
                            data$covariates,
                            "group",
                            list(c("group","1w","control"), c("group","2w","control")),
                            dds = deseq_res$dds,
                            shrink = TRUE)
} # }