I would like to apply the quantile normalization on a huge matrix. I tried to turn my matrix into a ff
object as the example below:
library(ff)
df <- ' sample1 sample2 sample3
1834.2 1743.4 1384
4711 4922 4650
4555 1387 4650.8
2588 1325 3258'
df <- read.table(text=df, header=T)
write.table(df, "del.txt", col.names=T, row.names=F, quote=F, sep="\t")
df <- read.table.ffdf(file="del.txt", header=T)
Thus, I tried:
library(preprocessCore)
df <- normalize.quantiles(df)
And got:
Error in normalize.quantiles(df) : Matrix expected in normalize.quantiles
I know that is possible to convert the ff
object to a matrix and apply the nomalization, but is exactly what I am trying to avoid.
If I make the conversion ff
object to a matrix and try to normalize it (after more than 20 hours running!) produce an error as follows:
Error in unlist(x, recursive = FALSE) :
long vectors not supported yet: memory.c:1648
I would be grateful for suggestions to perform this normalization, using or not using, the ff
package. Thank you!
Update to cpad0112:
Thank you for your answer!
However, I tried to run the ff object (ff package) and I got:
quantile_normalisation(df)
Error in aperm.default(X, c(s.call, s.ans)) :
invalid first argument, must be an array
My matrix is too huge to run as.data.frame (600k in rows vs 3k in column). It can be adapted to a ff object?
Oh okay. Probably, I didn't understand your question proper. I don't have resources to such large computations. There are few pointers:
1) One cannot run normal functions on ff objects. For eg look at the structure of ff object you created using read.table.ffdf(). On that quantile normalizations from other packages will fail.
2) ffdf object is a special object used within ff package (as I understand)
Yes, ff objects are as far I understand are hybrid objects and remain almost entirely on hard disk instead of RAM memory.
The ff objects have several ff functions which mimetizes normal functions (mergeffdf, subsetffdf....), thats why I was wondering if this quantile normalize function could be adapted also.