Skip to contents

Export data from R

Usage

export(object, con, ...)

# S4 method for FgseaList,character
export(
  object,
  con,
  geneSetResults = FALSE,
  compress = FALSE,
  overwrite = TRUE,
  quiet = FALSE
)

Arguments

object

Object.

con

character(1). Directory path.

geneSetResults

logical(1) or character. Export per-gene set expression including log fold change values generated from DESeq2. Can be slow when processing all MSigDB collections, so disabled by default. Alternatively, can declare specific collections to process (see collectionNames for supported values).

compress

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

overwrite

logical(1). Overwrite existing file on disk.

quiet

logical(1). Perform command quietly, suppressing messages.

...

Additional arguments.

Value

Invisible character or list of file paths.

Note

Updated 2023-09-13.

On-disk structure

Example:

file.path("object", "mutant_vs_control", "c1.csv")

S4 object is currently structured by:

  1. Gene set (c1-c8, h).

  2. Contrast.

The object was structured in this manner to flow with the R Markdown template. However, when writing to disk, I think it makes more sense to organize by:

  1. Contrast

  2. Gene set.

Examples

data(fgsea)

## FgseaList ====
object <- fgsea
con <- AcidBase::tempdir2()
out <- export(
    object = object,
    con = con
)
#> → Exporting <FgseaList> to '/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp9TkQ9s/BvCptbuYW2-169644920193096'.
#> → Exporting results for `condition_B_vs_A`.
#> → Exporting /private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp9TkQ9s/BvCptbuYW2-169644920193096/condition_B_vs_A/h_all_v7_0_symbols.csv using base::`write.table()`.
#> → Exporting results for `treatment_D_vs_C`.
#> → Exporting /private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp9TkQ9s/BvCptbuYW2-169644920193096/treatment_D_vs_C/h_all_v7_0_symbols.csv using base::`write.table()`.
print(out)
#> $condition_B_vs_A
#> $condition_B_vs_A$h_all_v7_0_symbols
#> [1] "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp9TkQ9s/BvCptbuYW2-169644920193096/condition_B_vs_A/h_all_v7_0_symbols.csv"
#> 
#> 
#> $treatment_D_vs_C
#> $treatment_D_vs_C$h_all_v7_0_symbols
#> [1] "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp9TkQ9s/BvCptbuYW2-169644920193096/treatment_D_vs_C/h_all_v7_0_symbols.csv"
#> 
#> 
AcidBase::unlink2(con)