remove NAs from exprs(gset)
1
0
Entering edit mode
7.8 years ago

Hello,

I updated all of my Bioconductor packages and now I'm getting errors I've never seen before.

For this one, I'm trying to remove NA values from expression data downloaded from GEO with GEO2R's code.

After log2 transform and making negative values NaN, I removed all rows with NaN from gset:

ex <- exprs(gset)
probe_with_atLeastOneNA = list()
for(i in 1:nrow(ex)) {
  row <- ex[i,]
  nan_counter = 0
  for(x in row) {
    ifis.na(x)){
      nan_counter = nan_counter + 1
    }
  }
  if(nan_counter > 0){
    probe_with_atLeastOneNA = append(probe_with_atLeastOneNA, rownames(ex)[i])
  }

}

gset@featureData@data <- gset@featureData@data[!rownames(gset@featureData@data) %in% probe_with_atLeastOneNA,]

Following this, I removed these same NaN values from the expressionSet:

exprs(gset) <- na.omit(exprs(gset))

This has been working just fine up until the update. Now I get this error:

Error in .validate_assayDataElementReplace(obj, value) : 
  object and replacement value have different dimensions

Any help or insight on this is greatly appreciated.

Thank you.

geo2r geo exprs • 3.4k views
ADD COMMENT
1
Entering edit mode
7.8 years ago

That this ever worked is surprising. The following will likely work:

RMV = which(apply(exprs(gset), 1, function(x) any ( is.na(x))))
gset = gset[-RMV,]

Edit: Annoyingly, I had to add some extra spaces so things would render on the site.

ADD COMMENT
1
Entering edit mode

Thank you so, so much. This worked. I lost half a day to this. Thanks again. Also just followed you on Twitter.

ADD REPLY
0
Entering edit mode

Hello I have the same problem and i want to remove Nan data out of my analysis. These are the codes i use for log2 transformation:

ex<-exprs(gset)
ex<- log2(ex+1)
exprs(gset) <- ex

I did try your both ways to get rid of them but they didn't work for me. Still i get Nan results and can not heat map or plot my analysis.
Hope you can help me. Thnks by the way

ADD REPLY
0
Entering edit mode

Post a reproducible example as a new question.

ADD REPLY

Login before adding your answer.

Traffic: 1715 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