making two matrices of genes the same size and same variable
1
0
Entering edit mode
8.3 years ago
zizigolu ★ 4.3k

Hi,

Happy new year

I have two matrics of genes like below

> mat <- read.table("aracne-tmatnorm_rld500.txt", header = T, sep = "\t", row.names=1)
> head(mat[,1:4])
          AT1G01060 AT1G01170 AT1G01180 AT1G01260
AT1G01060         0         0         0         0
AT1G01170         0         0         0         0
AT1G01180         0         0         0         0
AT1G01260         0         0         0         0
AT1G01380         0         0         0         0
AT1G01490         0         0         0         0
> # watching the dimension of matrix
> dim(mat)
[1] 3123 3123

> Newmat <- read.table("newMat.txt", header = T, sep = "\t", row.names=1)
> head(Newmat[,1:4])
          AT1G01060 AT1G01170 AT1G01180 AT1G01183
AT1G01060         0         0         0         0
AT1G01170         0         0         0         0
AT1G01180         0         0         0         0
AT1G01183         0         0         0         0
AT1G01260         0         0         0         0
AT1G01380         0         0         0         0
> # watching the dimension of matrix
> dim(Newmat)
[1] 3515 3515

How I can make these matrix the same size and variable, I mean I need two matrices with the same size, maybe

3123 3123

thank you for your help

gene • 1.5k views
ADD COMMENT
1
Entering edit mode
8.3 years ago

use the %in% function in R asking what data of "mat" has the same row.name than newMat..

And if you are planning to normalize data, take care of all these files with only zeroes. They are not useful

ADD COMMENT
0
Entering edit mode

thank you Antonio,

these are adjacency matrix that is why contain many zeroes, but i got confused how i can make them the same size because they both have row.name and col.name

ADD REPLY

Login before adding your answer.

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