[R] Cube of Matrices or list of Matrices

Karim Mezhoud kmezhoud at gmail.com
Sun Jan 18 22:36:56 CET 2015


Dear All,
I am trying to get correlation between  Diseases (80) in columns and
samples in rows (UNEQUAL) using gene expression (at less 1000,numeric). For
this I can use CORREP package with cor.unbalanced function.

But before to get this final matrix I need to load and to store the
expression of 1000 genes for every Disease (80). Every disease has
different number of samples (between 50 - 500).

It is possible to get a cube of matrices with equal columns but unequal
rows? I think NO and I can't use array function.

I am trying to get à list of matrices having the same number of columns but
different number of rows. as

Cubist <- vector("list", 1)
Cubist$Expression <- vector("list", 1)


for (i in 1:80){

matrix <- function(getGeneExpression[i])
Cubist$Expression[[Disease[i]]] <- matrix

}

At this step I have:
length(Cubist$Expression)
#80
dim(Cubist$Expression$Disease1)
#526 1000
dim(Cubist$Expression$Disease2)
#106  1000

names(Cubist$Expression$Disease1[4])
#ABD

names(Cubist$Expression$Disease2[4])
#ABD

Now I need to built the final matrices for every genes (1000) that I will
use for CORREP function.

Is there a way to extract directly the first column (first gene) for all
Diseases (80)  from Cubist$Expression? or

I need to built 1000 matrices with 80 columns and unequal rows?

Cublist$Diseases <- vector("list", 1)

for (k in 1:1000){
for (i in 1:80){

Cublist$Diseases[[gene[k] ]] <- Cubist$Expression[[Diseases[i] ]][k]
}

}

This double loops is time consuming...Is there a way to do this faster?

Thanks,
karim
  Ô__
 c/ /'_;~~~~kmezhoud
(*) \(*)   ⴽⴰⵔⵉⵎ  ⵎⴻⵣⵀⵓⴷ
http://bioinformatics.tn/

	[[alternative HTML version deleted]]



More information about the R-help mailing list