This is a test version of Biostars. For the public version, visit https://www.biostars.org.
inverse normal transformation for gtex data

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

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))))
}

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 !

0 answers

No answers yet.

Log in to answer this question.