When I use exprs
function to reassign expression matrix to an ExpressionSet
object, it does not work and an error occur. I want to remove the rows which cannot match any gene symbol
.
A minimal code as follows can reproduce my error, someone who know how to do this correctly please help me, thanks.
> dataDirectory <- system.file("extdata", package="Biobase")
> exprsFile <- file.path(dataDirectory, "exprsData.txt")
> exprs <- as.matrix(read.table(exprsFile, header=TRUE, sep="\t",
+ row.names=1,
+ as.is=TRUE))
> minimalSet <- ExpressionSet(assayData=exprs)
> sdata <- matrix(0, nrow=400, ncol=26)
> exprs(minimalSet) <- sdata
Error in .validate_assayDataElementReplace(obj, value) :
object and replacement value have different dimensions
> exprs(minimalSet) <- NULL # here I want to assign NULL to arrayData and reassign sdata to it, but it fails
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘exprs<-’ for signature ‘"ExpressionSet", "NULL"’
Thank a lot. Your suggestion is practical.