added 640 characters in body
Source Link
gringer
  • 10.9k
  • 3
  • 17
  • 66

I'm trying to run the Non-Negative Matrix Factorization(NMF) for my Gene Expression dataset which was originally in matrix form. But it throws errors as given below:

expr <- read_excel("./expr.xlsx")
expr<- as.matrix(expr)

#removing the first column containing gene symbols before clustering
expr_rm <- expr[,-1]
class(expr_rm)
[1] "matrix" "array" 

So converted these expr_rm to numeric:

expr_rm <- as.numeric(expr_rm)

#removing negative values for running NMF
eps <- .Machine$double.eps
expr_rm[expr_rm<=0] = eps

estimate <- NMF::nmf(expr_rm, 3, nrun = 10, method = "lee", seed = 123)

Error: NMF::nmf - 10/10 fit(s) threw an error. Error(s) thrown: run #1: 'x' must be numeric Timing stopped at: 1.95 0.14 4.4*

cluster <- cbind(names(NMF::predict(estimate)), NMF::predict(estimate))

Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'predict': object 'estimate' not found

result <- list(estimate, cluster)

Error: object 'estimate' not found

For clarity, my expr_rm has row indices as 1, 2, 3, 4,.. which indicates different genes and column headings as samples.

Please suggest a solution for this soon!

Additional information (requested from comments):

>summary(expr_rm) - before conversion 
 Sample_C44_0001.genes.results Sample_C44_0002.genes.results Sample_C44_0003.genes.results Sample_C44_0005.genes.results 
 Length:145   Length:145 Length:145  Length:145  Class :character

 > summary(expr_rm) - after numeric type conversion
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.000   1.808   4.264   4.220   6.333  16.246

If in expr_rm is data.matrix() also, it gives the error like:

> median_centered_data<- expr_rm - med
Error in expr_rm - med : non-numeric argument to binary operator 

I'm trying to run the Non-Negative Matrix Factorization(NMF) for my Gene Expression dataset which was originally in matrix form. But it throws errors as given below:

expr <- read_excel("./expr.xlsx")
expr<- as.matrix(expr)

#removing the first column containing gene symbols before clustering
expr_rm <- expr[,-1]
class(expr_rm)
[1] "matrix" "array" 

So converted these expr_rm to numeric:

expr_rm <- as.numeric(expr_rm)

#removing negative values for running NMF
eps <- .Machine$double.eps
expr_rm[expr_rm<=0] = eps

estimate <- NMF::nmf(expr_rm, 3, nrun = 10, method = "lee", seed = 123)

Error: NMF::nmf - 10/10 fit(s) threw an error. Error(s) thrown: run #1: 'x' must be numeric Timing stopped at: 1.95 0.14 4.4*

cluster <- cbind(names(NMF::predict(estimate)), NMF::predict(estimate))

Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'predict': object 'estimate' not found

result <- list(estimate, cluster)

Error: object 'estimate' not found

For clarity, my expr_rm has row indices as 1, 2, 3, 4,.. which indicates different genes and column headings as samples.

Please suggest a solution for this soon!

I'm trying to run the Non-Negative Matrix Factorization(NMF) for my Gene Expression dataset which was originally in matrix form. But it throws errors as given below:

expr <- read_excel("./expr.xlsx")
expr<- as.matrix(expr)

#removing the first column containing gene symbols before clustering
expr_rm <- expr[,-1]
class(expr_rm)
[1] "matrix" "array" 

So converted these expr_rm to numeric:

expr_rm <- as.numeric(expr_rm)

#removing negative values for running NMF
eps <- .Machine$double.eps
expr_rm[expr_rm<=0] = eps

estimate <- NMF::nmf(expr_rm, 3, nrun = 10, method = "lee", seed = 123)

Error: NMF::nmf - 10/10 fit(s) threw an error. Error(s) thrown: run #1: 'x' must be numeric Timing stopped at: 1.95 0.14 4.4*

cluster <- cbind(names(NMF::predict(estimate)), NMF::predict(estimate))

Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'predict': object 'estimate' not found

result <- list(estimate, cluster)

Error: object 'estimate' not found

For clarity, my expr_rm has row indices as 1, 2, 3, 4,.. which indicates different genes and column headings as samples.

Please suggest a solution for this soon!

Additional information (requested from comments):

>summary(expr_rm) - before conversion 
 Sample_C44_0001.genes.results Sample_C44_0002.genes.results Sample_C44_0003.genes.results Sample_C44_0005.genes.results 
 Length:145   Length:145 Length:145  Length:145  Class :character

 > summary(expr_rm) - after numeric type conversion
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.000   1.808   4.264   4.220   6.333  16.246

If in expr_rm is data.matrix() also, it gives the error like:

> median_centered_data<- expr_rm - med
Error in expr_rm - med : non-numeric argument to binary operator 
Source Link

NMF clustering not giving results

I'm trying to run the Non-Negative Matrix Factorization(NMF) for my Gene Expression dataset which was originally in matrix form. But it throws errors as given below:

expr <- read_excel("./expr.xlsx")
expr<- as.matrix(expr)

#removing the first column containing gene symbols before clustering
expr_rm <- expr[,-1]
class(expr_rm)
[1] "matrix" "array" 

So converted these expr_rm to numeric:

expr_rm <- as.numeric(expr_rm)

#removing negative values for running NMF
eps <- .Machine$double.eps
expr_rm[expr_rm<=0] = eps

estimate <- NMF::nmf(expr_rm, 3, nrun = 10, method = "lee", seed = 123)

Error: NMF::nmf - 10/10 fit(s) threw an error. Error(s) thrown: run #1: 'x' must be numeric Timing stopped at: 1.95 0.14 4.4*

cluster <- cbind(names(NMF::predict(estimate)), NMF::predict(estimate))

Error in h(simpleError(msg, call)) : error in evaluating the argument 'object' in selecting a method for function 'predict': object 'estimate' not found

result <- list(estimate, cluster)

Error: object 'estimate' not found

For clarity, my expr_rm has row indices as 1, 2, 3, 4,.. which indicates different genes and column headings as samples.

Please suggest a solution for this soon!