Description Usage Arguments Value Errors when ncores > 1 Author(s) See Also Examples
View source: R/deseq_functions.R
This function calls DESeq2::DESeq and
DESeq2::results on a pre-existing
DESeqDataSet object and returns a DESeqResults table for one or
more pairwise comparisons. However, unlike a standard call to
DESeq2::results using the contrast argument, this function
subsets the dataset so that DESeq2 only estimates dispersion for the samples
being compared, and not for all samples present.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 
| dds | A DESeqDataSet object, produced using either
 | 
| contrast.numer | A string naming the  | 
| contrast.denom | A string naming the  | 
| comparisons | As an optional alternative to supplying a single
 | 
| sizeFactors | A vector containing DESeq2  | 
| alpha | The significance threshold passed to  | 
| lfcShrink | Logical indicating if log2FoldChanges and their standard
errors should be shrunk using  | 
| args.DESeq | Additional arguments passed to
 | 
| args.results | Additional arguments passed to
DESeq2::results, given as a list of argument-value
pairs, e.g.  | 
| args.lfcShrink | Additional arguments passed to
 | 
| ncores | The number of cores to use for parallel processing. Multicore
processing is only used if more than one comparison is being made (i.e.
argument  | 
| quiet | If  | 
For a single comparison, the output is the DESeqResults result
table. If a comparisons is used to make multiple comparisons, the
output is a named list of DESeqResults objects, with elements named
following the pattern "X_vs_Y", where X is the name of the
numerator condition, and Y is the name of the denominator condition.
ncores > 1If this function returns an error,
set ncores = 1. Whether or not this occurs can depend on whether
users are using alternative BLAS libraries (e.g. OpenBLAS or Apple's
Accelerate framework) and/or how DESeq2 was installed. This is because some
DESeq2 functions (e.g. 
nbinomWaldTest) use C code that can be compiled to use parallelization,
and this conflicts with our use of process forking (via the
parallel package) when
ncores > 1.
Mike DeBerardine
getDESeqDataSet,
DESeq2::results
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #--------------------------------------------------#
# getDESeqDataSet
#--------------------------------------------------#
suppressPackageStartupMessages(require(DESeq2))
data("PROseq") # import included PROseq data
data("txs_dm6_chr4") # import included transcripts
# divide PROseq data into 6 toy datasets
ps_a_rep1 <- PROseq[seq(1, length(PROseq), 6)]
ps_b_rep1 <- PROseq[seq(2, length(PROseq), 6)]
ps_c_rep1 <- PROseq[seq(3, length(PROseq), 6)]
ps_a_rep2 <- PROseq[seq(4, length(PROseq), 6)]
ps_b_rep2 <- PROseq[seq(5, length(PROseq), 6)]
ps_c_rep2 <- PROseq[seq(6, length(PROseq), 6)]
ps_list <- list(A_rep1 = ps_a_rep1, A_rep2 = ps_a_rep2,
                B_rep1 = ps_b_rep1, B_rep2 = ps_b_rep2,
                C_rep1 = ps_c_rep1, C_rep2 = ps_c_rep2)
# make flawed dataset (ranges in txs_dm6_chr4 not disjoint)
#    this means there is double-counting
# also using discontinuous gene regions, as gene_ids are repeated
dds <- getDESeqDataSet(ps_list,
                       txs_dm6_chr4,
                       gene_names = txs_dm6_chr4$gene_id,
                       ncores = 1)
dds
#--------------------------------------------------#
# getDESeqResults
#--------------------------------------------------#
res <- getDESeqResults(dds, "B", "A")
res
reslist <- getDESeqResults(dds, comparisons = list(c("B", "A"), c("C", "A")),
                           ncores = 1)
names(reslist)
reslist$B_vs_A
# or using a dataframe
reslist <- getDESeqResults(dds, comparisons = data.frame(num = c("B", "C"),
                                                         den = c("A", "A")),
                           ncores = 1)
reslist$B_vs_A
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.