Skip to content

Latest commit

 

History

History
45 lines (34 loc) · 1.56 KB

README.md

File metadata and controls

45 lines (34 loc) · 1.56 KB

Save BumpyMatrix objects to file

Environment Status
BioC-release Release OK
BioC-devel Devel OK

The alabaster.bumpy package implements methods for saving and loading BumpyMatrix objects under the alabaster framework. It provides a language-agnostic method for serializing data in bumpy matrices, most typically as assays of a SummarizedExperiment. To get started, install the package and its dependencies from Bioconductor:

# install.packages("BiocManager")
BiocManager::install("alabaster.bumpy")

Let's create a BumpyMatrix object:

library(BumpyMatrix)
library(S4Vectors)
df <- DataFrame(x=runif(100), y=runif(100))
f <- factor(sample(letters[1:20], nrow(df), replace=TRUE), letters[1:20])
mat <- BumpyMatrix(split(df, f), c(5, 4))

We save it to file:

library(alabaster.bumpy)
tmp <- tempfile()
saveObject(mat, tmp)

And then load it back:

roundtrip <- readObject(tmp)
class(roundtrip)
## [1] "BumpyDataFrameMatrix"
## attr(,"package")
## [1] "BumpyMatrix"