inverse normal transformation for gtex data
0
0
Entering edit mode
3 months ago
rheab1230 ▴ 120

I have a gene count datasets that look like:

enter image description here

I am trying to do inverse normal transformation on this dataset but the results are coming like this:

enter image description here

I want to do it across samples. so basically want to get an output that looks like sample as column and gene as row and INT applied across sample for each gene.

inormal <- function(x)
{
    data <<- (qnorm((rank(x, na.last = "keep") - 0.5) / sum(!is.na(x))))
}
INT normalization gtex R • 299 views
ADD COMMENT
3
Entering edit mode

What's wrong with a for loop here?

dat.norm <- dat
for ( j in 1:ncol(dat.norm) ) {
  dat.norm[,j] <- qnorm( (rank(dat.norm[,j], na.last='keep')-0.5)/sum(! is.na(dat.norm[,j))))
}
ADD REPLY
0
Entering edit mode

yes, this worked. thank you.

ADD REPLY
0
Entering edit mode

Minor typos fixed

for ( j in 1:ncol(dat.norm) ) {
  dat.norm[,j] <- qnorm( (rank(dat.norm[,j], na.last='keep') - 0.5) / sum( !is.na(dat.norm[,j]) ) )
}

Thank you for this code, LChart !

ADD REPLY

Login before adding your answer.

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