emdann / milopy

Python implementation of Milo for differential abundance testing on KNN graph
MIT License
60 stars 7 forks source link

Error in glmFit.default(sely, design, offset = seloffset, dispersion = 0.05, : nrow(design) disagrees with ncol(y) #28

Closed Mari123i closed 1 year ago

Mari123i commented 1 year ago

Hello,

I get an error doing the following: I subset my adata to a certain celltype, copy it into a new adata, recalculate the KNN on that subset adata and run the milo workflow. I get the following error but only at one celltype out of maybe 20:

Error in glmFit.default(sely, design, offset = seloffset, dispersion = 0.05,  : 
  nrow(design) disagrees with ncol(y)

Where could I search for the error? What could differ in that celltype from the others, that if I subset it the DA_analysis fails but not in others.

Thank you!

emdann commented 1 year ago

Hi @Mari123i, I am not quite sure I understand the subsetting steps correctly, could you share the exact code you are running? Ideally on a dataset on which I can also reproduce e.g. the vignette example data.

I suspect this error might come from subsetting the cell-level adata, but not the nhood-level anndata stored in adata.uns['nhood_adata']. Do you re-run milopy.core.make_nhoods and milopy.core.count_cells after subsetting?

Mari123i commented 1 year ago

Hi @Mari123i, I am not quite sure I understand the subsetting steps correctly, could you share the exact code you are running? Ideally on a dataset on which I can also reproduce e.g. the vignette example data.

I suspect this error might come from subsetting the cell-level adata, but not the nhood-level anndata stored in adata.uns['nhood_adata']. Do you re-run milopy.core.make_nhoods and milopy.core.count_cells after subsetting?

Thank you for your reply! I do recalculate the KNN and neighbors for each subset. But no worries, the issue resolved itself. Thank you a lot for your time!