rename phenotypic variables in pData (microarray) or colData (RNA-Seq)
0
0
Entering edit mode
jogugil • 0
@fe38b9b8
Last seen 21 days ago
Spain

I would like to know how I can rename the phenotypic variables of an ExpressionSet object (names(pData(ExpressionSet)). As well as of a data object SummarizedExperiment::RangedSummarizedExperiment); . The following text does not work, something to be expected since it should modify the Set Expression or SummarizedExperiment object

names(pData (microarray))[1]<- "NEW_VAR" or names(colData ( SummarizedExperiment::RangedSummarizedExperiment);)) [1] <- "NEW_VAR"

thanks... Javi

PhenoGeneRanker • 174 views
0
Entering edit mode

names(pData(microarray))[1]<- "NEW_VAR" works, what is the error you have ?

0
Entering edit mode

names(pData(microarray))[1]<- "NEW_VAR"

It doesn't work, it gives the following error:

invalid (NULL) left side of assignment

you cannot rename phenotypic variables in this way. I understand that it is not possible because you must change the slot of the S4 object (ExpressionSet) where the phenotypic variables are located. also. But I don't see any way to rename these phenotypic variables. Exists?

0
Entering edit mode

Could you share an example of your dataset( dput(...)) ? I tried with a random ExpressionSet and names(p(Data(dataset))[1] <- "New_VAR" works so your dataset might not be correctly formatted

0
Entering edit mode

Excuse me, but I have had some personal issues that have not allowed me to put on.

I started to test and I think it is a problem of how R manages the objects, not of the S4 ExpressionSet object. If you create your own object where you add a atribute that is your ExpressionSet, you cannot use the typical get_, set_ functions to update values ​​inside that object. You must work directly with the attribute and not through the get_ function.

• [OP1] names(pData(myobj$get(oMAExpressSet)) ) [1] <- "NEW_VAR" • [OP2] names(pData(myobj$oMAExpressSet) ) [1] <- "NEW_VAR"

OP1 fails, giving the indicated error since it tries to assign the value "NEW_VAR" to the function "get_" and not to the object it retrieves. OP2 works and modifies the name of the phenotypic variable.

Thanks for everything. I hope that it would be useful to someone. PS: The versions I work with:

• [64-bit] R-4.1.2
• R6 object version of R
• RStudio 2022.02.2+485 "Prairie Trillium" Release (8acbd38b0d4ca3c86c570cf4112a8180c48cc6fb, 2022-04-19) for Windows Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36