View source: R/saveReference.R
saveReference | R Documentation |
Save a reference dataset to disk, usually in preparation for upload via uploadDirectory
.
saveReference(x, labels, path, metadata)
x |
Matrix of log-normalized expression values. This may be sparse or dense, but should be non-integer and have no missing values. Row names should be present and unique for all rows. |
labels |
DataFrame of labels.
Each row of |
path |
String containing the path to a directory in which to save |
metadata |
Named list containing metadata for this reference dataset,
see the schema returned by |
The SummarizedExperiment saved to path
is guaranteed to have the "logcounts"
assay and at least one column in labels
.
This mirrors the expectation for reference datasets obtained via fetchReference
.
x
and labels
are used to create a SummarizedExperiment that is saved into path
.
NULL
is invisibly returned.
Aaron Lun
uploadDirectory
, to upload the saved dataset to the gypsum backend.
fetchReference
, to download an existing dataset into the current sesssion.
# Mocking up some data to be saved.
x <- matrix(rnorm(1000), ncol=10)
rownames(x) <- sprintf("GENE_%i", seq_len(nrow(x)))
labels <- DataFrame(
labels.broad = sample(c("B", "T", "NK"), ncol(x), replace=TRUE),
labels.fine = sample(c("PC", "pre-B", "pro-B", "Th2", "CD4+T", "NK"),
ncol(x), replace=TRUE)
)
# Making up some metadata as well.
meta <- list(
title="New reference dataset",
description="This is a new reference dataset, generated from blah blah.",
genome="GRCm38",
taxonomy_id="10090",
sources=list(
list(provider="GEO", id="GSE123456"),
list(provider="PubMed", id="123456"),
list(provider="URL", id="https://reference.data.com", version="2024-02-26")
),
maintainer_name="Chihaya Kisaragi",
maintainer_email="kisaragi.chihaya@765.com"
)
# Actually saving it.
tmp <- tempfile()
saveReference(x, labels, tmp, meta)
# Reloading it to make sure it looks good.
alabaster.base::readObject(tmp)
str(jsonlite::fromJSON(file.path(tmp, "_bioconductor.json")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.