Question: How can I reassign assayData slot of ExpressionSet?
0
gravatar for wangshx
2.4 years ago by
wangshx10
China/Shanghai/ShanghaiTech. University
wangshx10 wrote:

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"’
ADD COMMENTlink modified 2.4 years ago by Kevin Blighe60k • written 2.4 years ago by wangshx10
3
gravatar for Kevin Blighe
2.4 years ago by
Kevin Blighe60k
Kevin Blighe60k wrote:

If you are filtering genes or samples from an ExpressionSet object, you do not have to access via the exprs() function. Just filter based on the name of the ExpressionSet object:

MyEset

ExpressionSet (storageMode: lockedEnvironment)
assayData: 194706 features, 22 samples

.

Select first 10 features and samples

MyEset[c(1:10),c(1:10)]

ExpressionSet (storageMode: lockedEnvironment)
assayData: 10 features, 10 samples

If you're trying to re-assign an entire 'new' expression matrix to your ExpressionSet object, then I do not see the utility in this. Just create another ExpressionSet object based on the new data matrix.

ADD COMMENTlink modified 14 days ago • written 2.4 years ago by Kevin Blighe60k
1

Thank a lot. Your suggestion is practical.

ADD REPLYlink written 2.4 years ago by wangshx10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 899 users visited in the last hour