Skip to content
Snippets Groups Projects
wrap_dds.Rd 1.79 KiB
Newer Older
Arnaud Duvermy's avatar
Arnaud Duvermy committed
% Generated by roxygen2: do not edit by hand
Arnaud Duvermy's avatar
Arnaud Duvermy committed
% Please edit documentation in R/wrapper_dds.R
\name{wrap_dds}
\alias{wrap_dds}
Arnaud Duvermy's avatar
Arnaud Duvermy committed
\title{Wrapper Function for DESeq2 Analysis}
\usage{
Arnaud Duvermy's avatar
Arnaud Duvermy committed
wrap_dds(dds, lfcThreshold, altHypothesis, correction_method = "BH")
Arnaud Duvermy's avatar
Arnaud Duvermy committed
}
\arguments{
\item{dds}{A DESeqDataSet object containing the count data and experimental design.}

\item{lfcThreshold}{The threshold for minimum log-fold change (LFC) to consider differentially expressed.}

\item{altHypothesis}{The alternative hypothesis for the analysis, indicating the direction of change.
Options are "greater", "less", or "two.sided".}

\item{correction_method}{The method for p-value correction. Default is "BH" (Benjamini-Hochberg).}
}
\value{
A list containing the dispersion values and the results of the differential expression analysis.
The dispersion values are calculated from the dds object and named according to sample names.
The inference results include adjusted p-values and log2 fold changes for each gene.
}
\description{
This function performs differential expression analysis using DESeq2 based on the provided
DESeqDataSet (dds) object. It calculates the dispersion values from the dds object and then
performs inference on the log-fold change (LFC) values using the specified parameters.
}
\examples{
N_GENES = 100
MAX_REPLICATES = 5
MIN_REPLICATES = 5
## --init variable
Arnaud Duvermy's avatar
Arnaud Duvermy committed
input_var_list <- init_variable( name = "genotype", sd = 0.1, level = 3) \%>\%
                   init_variable(name = "environment", NA , level = 2) 
Arnaud Duvermy's avatar
Arnaud Duvermy committed

mock_data <- mock_rnaseq(input_var_list, N_GENES, MIN_REPLICATES, MAX_REPLICATES)
dds <- DESeq2::DESeqDataSetFromMatrix(mock_data$counts , 
                   mock_data$metadata, ~ genotype + environment)
dds <- DESeq2::DESeq(dds, quiet = TRUE)
Arnaud Duvermy's avatar
Arnaud Duvermy committed
result <- wrap_dds(dds, lfcThreshold = 1, altHypothesis = "greater")
Arnaud Duvermy's avatar
Arnaud Duvermy committed
}