Helper function to filter and sort results from DESeq2, to aid in identifying differentially expressed genes.
Arguments
- deseq2_result
Results object for DE genes, of class
DESeqResults
- p_adjusted
Threshold for adjusted p-value. Defaults to 0.05.
- fold_change
Threshold for absolute fold change. Defaults to 1.5.
- inform
Should a message be printed with the name of the DE comparison and number of DE genes found? Defaults to
TRUE
.
Value
A data frame (tibble) of filtered DE genes; see ?DESeq2::results
for details on the output.
Examples
ex_deseq_result <-
readRDS(system.file("extdata", "ex_deseq_results.rds", package = "tRavis"))
#> Loading required package: DESeq2
#> Loading required package: S4Vectors
#> Loading required package: stats4
#> Loading required package: BiocGenerics
#>
#> Attaching package: ‘BiocGenerics’
#> The following objects are masked from ‘package:stats’:
#>
#> IQR, mad, sd, var, xtabs
#> The following objects are masked from ‘package:base’:
#>
#> Filter, Find, Map, Position, Reduce, anyDuplicated, aperm, append,
#> as.data.frame, basename, cbind, colnames, dirname, do.call,
#> duplicated, eval, evalq, get, grep, grepl, intersect, is.unsorted,
#> lapply, mapply, match, mget, order, paste, pmax, pmax.int, pmin,
#> pmin.int, rank, rbind, rownames, sapply, setdiff, table, tapply,
#> union, unique, unsplit, which.max, which.min
#>
#> Attaching package: ‘S4Vectors’
#> The following object is masked from ‘package:utils’:
#>
#> findMatches
#> The following objects are masked from ‘package:base’:
#>
#> I, expand.grid, unname
#> Loading required package: IRanges
#> Loading required package: GenomicRanges
#> Loading required package: GenomeInfoDb
#> Loading required package: SummarizedExperiment
#> Loading required package: MatrixGenerics
#> Loading required package: matrixStats
#>
#> 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
#> Loading required package: Biobase
#> Welcome to Bioconductor
#>
#> Vignettes contain introductory material; view with
#> 'browseVignettes()'. To cite Bioconductor, see
#> 'citation("Biobase")', and for packages 'citation("pkgname")'.
#>
#> Attaching package: ‘Biobase’
#> The following object is masked from ‘package:MatrixGenerics’:
#>
#> rowMedians
#> The following objects are masked from ‘package:matrixStats’:
#>
#> anyMissing, rowMedians
tr_clean_deseq2_result(ex_deseq_result)
#> Found 100 DE genes for condition B vs A.
#> # A tibble: 100 × 7
#> gene baseMean log2FoldChange lfcSE stat pvalue padj
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 gene95 853. 3.35 0.279 12.0 3.26e-33 6.53e-31
#> 2 gene197 591. 3.29 0.279 11.8 4.53e-32 4.53e-30
#> 3 gene180 420. 3.30 0.298 11.1 1.57e-28 1.05e-26
#> 4 gene70 235. -2.91 0.276 -10.5 5.23e-26 2.62e-24
#> 5 gene106 886. 3.08 0.303 10.1 3.80e-24 1.52e-22
#> 6 gene187 57.3 -4.28 0.428 -10.0 1.42e-23 4.74e-22
#> 7 gene26 93.9 4.62 0.473 9.77 1.47e-22 4.20e-21
#> 8 gene68 72.7 -3.23 0.345 -9.37 7.58e-21 1.90e-19
#> 9 gene122 462. 2.63 0.307 8.58 9.79e-18 2.18e-16
#> 10 gene39 191. 2.67 0.325 8.20 2.33e-16 4.66e-15
#> # ℹ 90 more rows