Export data out of R and write to disk.

export(object, ...)

# S4 method for DESeqAnalysis
export(object, name = NULL, dir = ".", compress = FALSE)

# S4 method for DESeqDataSet
export(object, name = NULL, dir = ".", compress = FALSE)

Arguments

object

Object. An object supporting dim(), or a supported class capable of being coerced to data.frame, to be written to disk.

name

character(1). Name to use on disk. If NULL, will use the name of the object instead.

dir

character(1). Directory path.

compress

logical(1). Apply gzip compression to all files.

...

Additional arguments.

Value

Invisible character. File path(s).

Details

Size-factor normalized coutns and FPKM values are calculated on the fly and exported automatically.

Note

Updated 2021-02-10.

Row names

Some export utilities in R have a tendency to drop row names when writing to disk in CSV format. For example, the readr family of functions never write row names by design. This is a really poor default setting for handling genomic data, which often contain gene identifiers in the row names. Here we're performing any internal tibble coercion step to ensure row names are always moved to a "rowname" column in the CSV export.

Debugging

Note that this function currently wraps data.table::fwrite() by default for exporting data.frame and matrix class objects.

See also

Examples

data(deseq) ## DESeqAnalysis ==== export(deseq, dir = "example")
#> → Exporting `DESeqDataSet` to data.
#> → Exporting `data` to /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data.
#> → Exporting assays `counts, normalized, fpkm` to /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data/assays/counts.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data/assays/normalized.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data/assays/fpkm.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data/colData.csv using data.table::`fwrite()`.
#> Dropping non-atomic columns: entrezID.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/data/rowData.csv using data.table::`fwrite()`.
#> → Exporting `DESeqTransform` to transform.
#> → Exporting `transform` to /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/transform.
#> → Exporting assays `assay` to /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/transform.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/transform/assays/assay.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/transform/colData.csv using data.table::`fwrite()`.
#> Dropping non-atomic columns: entrezID.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/transform/rowData.csv using data.table::`fwrite()`.
#> → Exporting `DESeqResults` tables to resultsTables.
#> → condition_B_vs_A (shrunken LFC)
#> 38 differentially expressed genes (alpha < 0.01)
#> 24 upregulated genes (alpha < 0.01)
#> 14 downregulated genes (alpha < 0.01)
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsTables/condition_B_vs_A/all.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsTables/condition_B_vs_A/up.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsTables/condition_B_vs_A/down.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsTables/condition_B_vs_A/both.csv using data.table::`fwrite()`.
#> → treatment_D_vs_C (shrunken LFC)
#> 0 differentially expressed genes (alpha < 0.01)
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsTables/treatment_D_vs_C/all.csv using data.table::`fwrite()`.
#> → Exporting `DESeqResults` matrices to resultsMatrices.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsMatrices/log2FoldChange.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsMatrices/stat.csv using data.table::`fwrite()`.
#> → Exporting /Users/mike/git/monorepo/r-packages/r-deseqanalysis/docs/reference/example/deseq/resultsMatrices/padj.csv using data.table::`fwrite()`.
## Clean up. unlink("example", recursive = TRUE)