Biostar Beta. Not for public use.
How to get a matrix gene weights in NMF
0
Entering edit mode
19 months ago
sugus • 30
China Pharmaceutical University

Hi there,

Briefly, I know NMF (non-negative matrix factorization) as modeling the matrix X of expression for g genes and s samples, constituting the product of a matrix G of g gene weights for k factors and a matrix S of s sample weights for k factors.

And I want to derive the matrix G for selecting genes with high weights for specific NMF factor (cluster). How to get this matrix in NMF()?

Thanks for someone could give me some hints.

ADD COMMENTlink
3
Entering edit mode
13 months ago
WCIP | Glasgow | UK

I think what you want is the W matrix which you can get with the basis command (NMF package), E.g.:

# A matrix of 20 genes and 10 samples
mat<- matrix(runif(n= 200, min= 0, max= 100), nrow= 20, ncol= 10)

library(NMF)
res<- nmf(mat, rank= 2)
w<- basis(res)
h<- coef(res)

w %*% h # ~ mat

dim(w) # 20 2
ADD COMMENTlink
0
Entering edit mode

Thank you so much. It's really helpful!

ADD REPLYlink
0
Entering edit mode

Hopefully you get the idea. But on reading again your question make sure that what you need is instead the H matrix of the transpose of the expression matrix.

ADD REPLYlink
0
Entering edit mode

If I have a new dataset with 30 different samples measured by the above 20 genes, how to project the new data into the low-dimensional subspace generated by NMF. Can I just multiplying the w matrix? Thanks in advance.

ADD REPLYlink
0
Entering edit mode

Hi Dario, I am wondering if it's possible to use an alternative distance except KL or euclidean in nmf() function? Thanks a lot!

ADD REPLYlink
0
Entering edit mode

Hi- looking at the documentation of nmf (i.e. ?nmf), it appears the parameter method accept a keyword for the distance algorithm. Look at the Algorithm section of the docs for the available ones. E.g. nmf(x, 2, method= 'lee')

ADD REPLYlink

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.1