Skip to contents

Generate a tidy table with the results of DESeq2

Usage

deresult_to_df(res_de, FDR = NULL)

Arguments

res_de

An object containing the results of the Differential Expression analysis workflow (e.g. DESeq2, edgeR or limma). Currently, this can be a DESeqResults object created using the DESeq2 framework.

FDR

Numeric value, specifying the significance level for thresholding adjusted p-values. Defaults to NULL, which would return the full set of results without performing any subsetting based on FDR.

Value

A tidy data.frame with the results from differential expression, sorted by adjusted p-value. If FDR is specified, the table contains only genes with adjusted p-value smaller than the value.

Examples

library("DESeq2")
library("macrophage")
data(res_de_macrophage, package = "mosdef")
head(res_macrophage_IFNg_vs_naive)
#> log2 fold change (MLE): condition IFNg vs naive 
#> Wald test p-value: condition IFNg vs naive 
#> DataFrame with 6 rows and 7 columns
#>                  baseMean log2FoldChange     lfcSE      stat      pvalue
#>                 <numeric>      <numeric> <numeric> <numeric>   <numeric>
#> ENSG00000000003   171.571     -0.2822450 0.3005710 -0.939029 9.91539e-01
#> ENSG00000000419   967.751      0.0391223 0.0859708  0.455065 1.00000e+00
#> ENSG00000000457   682.433      1.2846179 0.1969067  6.523992 7.41664e-02
#> ENSG00000000460   262.963     -1.4718762 0.2186916 -6.730372 1.54747e-02
#> ENSG00000000938  2660.102      0.6754781 0.2360530  2.861552 9.15401e-01
#> ENSG00000000971  3052.123      4.9871107 0.4964284 10.045982 4.81077e-16
#>                        padj      SYMBOL
#>                   <numeric> <character>
#> ENSG00000000003 1.00000e+00      TSPAN6
#> ENSG00000000419 1.00000e+00        DPM1
#> ENSG00000000457 7.56362e-01       SCYL3
#> ENSG00000000460 2.04864e-01    C1orf112
#> ENSG00000000938 1.00000e+00         FGR
#> ENSG00000000971 6.85285e-14         CFH
res_df <- deresult_to_df(res_macrophage_IFNg_vs_naive)
#> Warning: Direct call of 'as.data.frame.numeric()' is deprecated.  Use 'as.data.frame.vector()' or 'as.data.frame()' instead
#> Warning: Direct call of 'as.data.frame.numeric()' is deprecated.  Use 'as.data.frame.vector()' or 'as.data.frame()' instead
#> Warning: Direct call of 'as.data.frame.numeric()' is deprecated.  Use 'as.data.frame.vector()' or 'as.data.frame()' instead
#> Warning: Direct call of 'as.data.frame.numeric()' is deprecated.  Use 'as.data.frame.vector()' or 'as.data.frame()' instead
#> Warning: Direct call of 'as.data.frame.numeric()' is deprecated.  Use 'as.data.frame.vector()' or 'as.data.frame()' instead
#> Warning: Direct call of 'as.data.frame.numeric()' is deprecated.  Use 'as.data.frame.vector()' or 'as.data.frame()' instead
head(res_df)
#>                              id   baseMean log2FoldChange     lfcSE     stat
#> ENSG00000125347 ENSG00000125347 30585.0749       5.560124 0.2182663 25.47403
#> ENSG00000162645 ENSG00000162645 36790.5921       6.665804 0.2865732 23.26039
#> ENSG00000111181 ENSG00000111181   688.5779       4.710592 0.1961023 24.02110
#> ENSG00000174944 ENSG00000174944  1324.3975       9.863904 0.4715127 20.91970
#> ENSG00000100336 ENSG00000100336  2551.4789       8.708551 0.4214096 20.66529
#> ENSG00000145365 ENSG00000145365  3637.2221       5.193448 0.2368542 21.92677
#>                       pvalue         padj  SYMBOL
#> ENSG00000125347 3.134235e-97 5.580818e-93    IRF1
#> ENSG00000162645 2.652111e-87 2.361174e-83    GBP2
#> ENSG00000111181 3.777590e-80 2.242126e-76 SLC6A12
#> ENSG00000174944 3.857562e-79 1.717194e-75  P2RY14
#> ENSG00000100336 4.765415e-75 1.697059e-71   APOL4
#> ENSG00000145365 1.926538e-70 5.717323e-67    TIFA