Generate a tidy table with the DE genes from the results of DESeq

deseqresult2DEgenes(deseqresult, FDR = 0.05)

Arguments

deseqresult

A DESeq2::DESeqResults() object

FDR

Numeric value, the significance level for thresholding adjusted p-values

Value

A "tidy" data.frame with only genes marked as differentially expressed

Examples


# with simulated data...
library(DESeq2)
#> Loading required package: GenomicRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: SummarizedExperiment
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#> 
#> Attaching package: ‘matrixStats’
#> The following objects are masked from ‘package:Biobase’:
#> 
#>     anyMissing, rowMedians
#> 
#> Attaching package: ‘MatrixGenerics’
#> The following objects are masked from ‘package:matrixStats’:
#> 
#>     colAlls, colAnyNAs, colAnys, colAvgsPerRowSet, colCollapse,
#>     colCounts, colCummaxs, colCummins, colCumprods, colCumsums,
#>     colDiffs, colIQRDiffs, colIQRs, colLogSumExps, colMadDiffs,
#>     colMads, colMaxs, colMeans2, colMedians, colMins, colOrderStats,
#>     colProds, colQuantiles, colRanges, colRanks, colSdDiffs, colSds,
#>     colSums2, colTabulates, colVarDiffs, colVars, colWeightedMads,
#>     colWeightedMeans, colWeightedMedians, colWeightedSds,
#>     colWeightedVars, rowAlls, rowAnyNAs, rowAnys, rowAvgsPerColSet,
#>     rowCollapse, rowCounts, rowCummaxs, rowCummins, rowCumprods,
#>     rowCumsums, rowDiffs, rowIQRDiffs, rowIQRs, rowLogSumExps,
#>     rowMadDiffs, rowMads, rowMaxs, rowMeans2, rowMedians, rowMins,
#>     rowOrderStats, rowProds, rowQuantiles, rowRanges, rowRanks,
#>     rowSdDiffs, rowSds, rowSums2, rowTabulates, rowVarDiffs, rowVars,
#>     rowWeightedMads, rowWeightedMeans, rowWeightedMedians,
#>     rowWeightedSds, rowWeightedVars
#> The following object is masked from ‘package:Biobase’:
#> 
#>     rowMedians
dds <- DESeq2::makeExampleDESeqDataSet(n = 100, m = 8, betaSD = 2)
dds <- DESeq(dds)
#> estimating size factors
#> estimating dispersions
#> gene-wise dispersion estimates
#> mean-dispersion relationship
#> final dispersion estimates
#> fitting model and testing
res <- results(dds)
deseqresult2DEgenes(res)
#> Warning: Please use `mosdef::deresult_to_df()` in replacement of the `deseqresult2DEgenes()` function, originally located in the ideal package. 
#> Check the manual page for `?mosdef::deresult_to_df()` to see the details on how to use it, e.g. refer to the new parameter definition and naming
#>            id    baseMean log2FoldChange     lfcSE      stat       pvalue
#> gene21 gene21  326.794163       3.970890 0.3761786 10.555866 4.772187e-26
#> gene88 gene88  180.804426       5.303655 0.5404432  9.813529 9.846350e-23
#> gene34 gene34  112.018028      -3.507861 0.3810008 -9.206964 3.354790e-20
#> gene86 gene86  554.011384       3.576372 0.4206956  8.501093 1.878142e-17
#> gene46 gene46 2519.674827       2.658520 0.3963833  6.706943 1.987434e-11
#> gene73 gene73  312.872780       2.454988 0.4095375  5.994539 2.040634e-09
#> gene43 gene43   79.417862       3.341366 0.5646134  5.917972 3.259358e-09
#> gene99 gene99  354.228616       2.537850 0.4456657  5.694514 1.237237e-08
#> gene81 gene81  125.597432      -2.185457 0.4007836 -5.452960 4.953821e-08
#> gene61 gene61   28.310409      -3.530787 0.6591515 -5.356565 8.481910e-08
#> gene31 gene31   36.360707      -2.811803 0.5326527 -5.278869 1.299839e-07
#> gene95 gene95  145.603866       3.589596 0.7439440  4.825089 1.399409e-06
#> gene82 gene82   56.093609      -2.550799 0.5318243 -4.796319 1.616075e-06
#> gene72 gene72   17.087512      -3.560581 0.7478572 -4.761044 1.925938e-06
#> gene83 gene83   21.449172      -3.292425 0.6965981 -4.726434 2.284973e-06
#> gene18 gene18    9.068569      -6.044623 1.3087556 -4.618603 3.863320e-06
#> gene49 gene49   13.144427      -3.978430 0.8649371 -4.599676 4.231494e-06
#> gene76 gene76   81.131673       2.313319 0.5055756  4.575615 4.748239e-06
#> gene84 gene84  147.338368       2.390671 0.5419009  4.411638 1.025914e-05
#> gene5   gene5   19.405727      -2.736749 0.6321491 -4.329278 1.495992e-05
#> gene80 gene80  106.224530       3.365594 0.7813088  4.307636 1.650085e-05
#> gene89 gene89   54.059109       1.994835 0.4753898  4.196209 2.714197e-05
#> gene67 gene67   36.542053      -2.041300 0.5122432 -3.985021 6.747411e-05
#> gene54 gene54   15.868042      -3.326063 0.8400431 -3.959395 7.513978e-05
#> gene91 gene91   74.112526       1.878567 0.4840147  3.881218 1.039346e-04
#> gene32 gene32   31.784174       2.011663 0.5315085  3.784818 1.538213e-04
#> gene12 gene12   17.340576      -2.622295 0.7175759 -3.654381 2.578035e-04
#> gene35 gene35   13.317010      -2.801431 0.7662973 -3.655802 2.563792e-04
#> gene47 gene47    9.548995      -3.481061 0.9601673 -3.625473 2.884327e-04
#> gene6   gene6   56.063905      -1.721574 0.5002358 -3.441525 5.784444e-04
#> gene44 gene44   30.390915       2.048789 0.6472545  3.165354 1.548946e-03
#> gene55 gene55   47.473016       1.615592 0.5195919  3.109348 1.875006e-03
#> gene56 gene56   49.655733       1.706033 0.5520008  3.090636 1.997284e-03
#> gene28 gene28   20.078496      -2.124868 0.6963988 -3.051222 2.279116e-03
#> gene98 gene98  188.151706       1.214227 0.4154754  2.922500 3.472341e-03
#> gene4   gene4   10.859281      -2.124804 0.7563269 -2.809372 4.963822e-03
#> gene53 gene53    6.909460      -2.775508 0.9886430 -2.807391 4.994452e-03
#> gene77 gene77   32.836129      -1.608078 0.5762311 -2.790682 5.259705e-03
#> gene23 gene23   13.923597       2.552144 0.9177698  2.780810 5.422342e-03
#> gene39 gene39   22.707829       1.815041 0.6594217  2.752474 5.914693e-03
#> gene27 gene27    6.701156       3.254970 1.1900706  2.735106 6.236014e-03
#> gene92 gene92   58.741020      -1.167472 0.4324809 -2.699476 6.944885e-03
#> gene75 gene75  166.663052       1.155936 0.4315829  2.678365 7.398260e-03
#> gene16 gene16   11.179014       6.854420 2.6027814  2.633498 8.451033e-03
#> gene2   gene2   11.098416      -2.024351 0.7745153 -2.613700 8.956753e-03
#> gene22 gene22   42.316717       1.431842 0.5634425  2.541238 1.104607e-02
#> gene24 gene24   53.742605       1.389537 0.5468029  2.541202 1.104719e-02
#> gene93 gene93   41.966342      -1.296233 0.5122289 -2.530573 1.138763e-02
#> gene36 gene36   24.153364       1.538819 0.6232964  2.468840 1.355516e-02
#>                padj
#> gene21 4.772187e-24
#> gene88 4.923175e-21
#> gene34 1.118263e-18
#> gene86 4.695355e-16
#> gene46 3.974867e-10
#> gene73 3.401057e-08
#> gene43 4.656226e-08
#> gene99 1.546546e-07
#> gene81 5.504246e-07
#> gene61 8.481910e-07
#> gene31 1.181672e-06
#> gene95 1.166174e-05
#> gene82 1.243134e-05
#> gene72 1.375670e-05
#> gene83 1.523315e-05
#> gene18 2.414575e-05
#> gene49 2.489114e-05
#> gene76 2.637911e-05
#> gene84 5.399545e-05
#> gene5  7.479961e-05
#> gene80 7.857546e-05
#> gene89 1.233726e-04
#> gene67 2.933657e-04
#> gene54 3.130824e-04
#> gene91 4.157384e-04
#> gene32 5.916205e-04
#> gene12 9.207268e-04
#> gene35 9.207268e-04
#> gene47 9.945957e-04
#> gene6  1.928148e-03
#> gene44 4.996600e-03
#> gene55 5.859392e-03
#> gene56 6.052376e-03
#> gene28 6.703284e-03
#> gene98 9.920974e-03
#> gene4  1.349852e-02
#> gene53 1.349852e-02
#> gene77 1.384133e-02
#> gene23 1.390344e-02
#> gene39 1.478673e-02
#> gene27 1.520979e-02
#> gene92 1.653544e-02
#> gene75 1.720526e-02
#> gene16 1.920689e-02
#> gene2  1.990389e-02
#> gene22 2.350466e-02
#> gene24 2.350466e-02
#> gene93 2.372423e-02
#> gene36 2.766360e-02