Subsetting ESet object based on featuredata
1
0
Entering edit mode
@kaushal-raj-chaudhary-6165
Last seen 9.6 years ago
United States

Hello all,

I am trying to subset ESet object base on feature data.  Eset with with feature data was created using following code.

 

library(ragene10sttranscriptcluster.db)
library(annotate)
library(R2HTML)
library(limma)

ID <- featureNames(eset)  

Symbol <- getSYMBOL(ID, "ragene10sttranscriptcluster.db")
Name <- as.character(lookUp(ID, "ragene10sttranscriptcluster.db", "GENENAME"))
tmp <- data.frame(ID=ID, Symbol=Symbol, Name=Name)  
fData(eset) <- tmp  

> eset
ExpressionSet (storageMode: lockedEnvironment)
assayData: 28826 features, 13 samples 
  element names: exprs 
protocolData
  sampleNames: M11001NB1H-Heart-1-RatGeneArray.CEL M11003NB1H-Heart-3-RatGeneArray.CEL ...
    M11024NB2H-Heart-24-2-RatGeneArray.CEL (13 total)
  varLabels: ScanDate
  varMetadata: labelDescription
phenoData
  sampleNames: M11001NB1H-Heart-1-RatGeneArray.CEL M11003NB1H-Heart-3-RatGeneArray.CEL ...
    M11024NB2H-Heart-24-2-RatGeneArray.CEL (13 total)
  varLabels: sample
  varMetadata: labelDescription
featureData
  featureNames: 10700001 10700003 ... 10940690 (28826 total)
  fvarLabels: ID Symbol Name
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation: ragene10stv1 

 

Now I want to get eset object only where Symbol is available for corresponding ID 

sub<-eset[fData(eset)[2]!="NA"]

This gives me whole 28826 features again.

I appreciate any help.

Regards,

affy • 2.6k views
ADD COMMENT
2
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States

You don't want to use getSYMBOL() any longer. Instead you want to do

gns <- select(ragene10sttranscriptcluster.db, featureNames(eset), c("SYMBOL","GENENAME"))

at which time you will get a warning stating that you have multiply-mapped probesets. You will have to deal with this as you see fit; I tend to simply keep the first of the duplicates, as in aggregate this tends to select what I consider to be the 'right' one.

gns <- gns[!duplicated(gns[,1]),]
fData(eset) <- gns

And you can also then do

sub <- eset[!is.na(gns[,2]),]

 

ADD COMMENT
0
Entering edit mode

Thanks, Jim.

ADD REPLY

Login before adding your answer.

Traffic: 870 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6