Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in verify.fit.and.count.matrix(X, fit) : Dimensions of input matrices "X" , "fit$F" and "fit$L" do not agree #44

Open
ZhengYingqi-doctor opened this issue Feb 4, 2024 · 4 comments

Comments

@ZhengYingqi-doctor
Copy link

When I run de_analysis(), there was an error:

> de <- de_analysis(fit,counts,pseudocount = 0.1, control = list(ns = 1e4,nc = 4))
Error in verify.fit.and.count.matrix(X, fit) : 
  Dimensions of input matrices "X" , "fit$F" and "fit$L" do not agree

The "counts" is a dgCMatrix

> str(counts)
Formal class 'dgCMatrix' [package "Matrix"] with 6 slots
  ..@ i       : int [1:35272029] 11 19 32 69 111 118 120 158 164 165 ...
  ..@ p       : int [1:15727] 0 1580 1967 3050 4257 6138 7258 8988 10550 11551 ...
  ..@ Dim     : int [1:2] 27197 15726
  ..@ Dimnames:List of 2
  .. ..$ : chr [1:27197] "AL627309.1" "AL669831.5" "FAM87B" "LINC00115" ...
  .. ..$ : chr [1:15726] "CRLM_P2_Colon_P_AGAGCAGGTACAGTAA" "CRLM_P17_Colon_T_GAGTTACCAAGTTTGC-1" "ICC_I02T_CGAGTGCCAGAGGCTA" "ICC_I03P_CTCTGGTAGAGCATAT" ...
  ..@ x       : num [1:35272029] 1 1 1 1 4 1 1 1 1 1 ...
  ..@ factors : list()

And I found that the "fit" only has 24141 genes after run > fit <- fit_topic_model(t(counts),k = n.topics).
So how to solve this issue

@pcarbo
Copy link
Member

pcarbo commented Feb 4, 2024

Hi @ZhengYingqi-doctor thanks for your question. The "X" input argument for fit_topic_model() and de_analysis should be the same, otherwise you will get errors such as the one you got here.

@ZhengYingqi-doctor
Copy link
Author

The "X" for fit_topic_model() is "counts":

> dim(counts)
[1] 15726 27197

But after running fit <- fit_topic_model(counts,k = 16), the number of genes was changed:

@ZhengYingqi-doctor
Copy link
Author

> dim(fit$F);dim(fit$L)
[1] 24141     16
[1] 15726     16

@pcarbo
Copy link
Member

pcarbo commented Feb 4, 2024

@ZhengYingqi-doctor Did you get a warning that looked something like this? "One or more columns of X are all zero; after removing all-zero columns, n columns will be used for model fitting."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants