I would like to JSON serialize an expressionSet
. I tried the following:
# create expression set based on the link above
library("Biobase")
ExpressionSet()
ExpressionSet(assayData=matrix(runif(1000), nrow=100, ncol=10))
# update an existing ExpressionSet
data(sample.ExpressionSet)
updateObject(sample.ExpressionSet)
# information about assay and sample data
featureNames(sample.ExpressionSet)[1:10]
sampleNames(sample.ExpressionSet)[1:5]
experimentData(sample.ExpressionSet)
# subset: first 10 genes, samples 2, 4, and 10
expressionSet <- sample.ExpressionSet[1:10,c(2,4,10)]
When I then do (using the same approach as for dataframes):
library(jsonlite)
toJSON(expressionSet)
I get
Error: No method for S4 class:ExpressionSet
Is there a way to get this done or would I have to write a custom serializer?