thank you very much, yes you understood my mean well but the question is , genes coming from where in other word which is my reference for subsetting?
hello,
I have two matrices of gene IDs with the same dimension but whenever I am trying to measure fscore using them telling
networks have not the same node names
> head(A[,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
> dim(A)
[1] 3123 3123
> head(B[,1:4])
AT5G10140 AT5G11260 AT5G62020 AT5G20240
AT5G10140 0 0 0 0
AT5G11260 0 0 1 0
AT5G62020 0 0 0 0
AT5G20240 0 0 0 0
AT3G54340 0 0 0 0
AT3G27010 0 0 0 0
> dim(B)
[1] 3123 3123
how I can have these two matrices with the same gene names? I mean keeping the same genes and removing which is different between two matrices then two matrices become will have the same genes
thank you
1 answer
Greetings Fereshteh.
If I understood your question, a simple workaround is creating a character vector containing the Arabidopsis gene names you want and subsetting the two matrices by your vector, then you should get only what you want.
Ex.:
> genes <- c("AT3G54340", "AT5G10140")
> new_A <- subset(A, by = genes)
> new_B <- subset(B, by = genes)
Hi Fereshteh,
Your reference should be the genes you want to be the same. Another simple workaround is to use the function:
unique()
ex.:
new_A <- unique(A)
new_B <- unique(B)
you can also bind them by column using cbind() and apply unique() to the new data.frame.
I am not quite sure if this is what you are looking for, but send me a message anytime.
Regards,
R.
thank you so much
Log in to answer this question.