muscat
muscat copied to clipboard
Problem using covariates with mmDS
If I run the code:
mmDS_res <- mmDS(sce,
covs = c("Disease", "Gender", "Batch"),
n_threads = 4)
I get the output
Skipping cluster(s) “Low-density neutrophils”, “Unknown”
due to an insufficient number of samples with a sufficient number of cells.
Testing 15425 genes across 10098 cells in cluster “Classical monocytes”...
Argument 'coef' not specified; testing for “group_idyes”.
[1] "~(1|sample_id)+Disease+Gender+Batch+group_id"
Error in .fitVarPartModel(exprObj, formula, data, REML = REML, useWeights = useWeights, :
Variable in formula is not found: Disease
Calls: mmDS ... fitVarPartModel -> fitVarPartModel -> .fitVarPartModel
In addition: Warning message:
In DGEList(counts(x), norm.factors = 1/sizeFactors(x)) :
norm factors don't multiply to 1
I have checked to confirm that my covariate names are column names in colData(sce)
. (In fact, when I tried changing covs
to things like "GenderMale"
I got a different error because those were not in colData(sce)
.)
I cannot find any documentation or examples using the covs
argument, so I don't have a working example to compare against.
HI, Did you figure out a solution? I have a similar error!
Hm. At this point, it is difficult for me to wrap my mind around the issue. The following mock example worked
# subset "B cells" cluster
data(example_sce)
b_cells <- example_sce$cluster_id == "B cells"
sub <- example_sce[, b_cells]
sub$cluster_id <- droplevels(sub$cluster_id)
# downsample to 100 genes
gs <- sample(nrow(sub), 100)
sub <- sub[gs, ]
# mock up some other variable
sub$foo <- sample(c("A", "B"), ncol(sub), TRUE)
res <- mmDS(sub, covs = "foo")
> Testing 83 genes across 298 cells in cluster “B cells”...
Argument 'coef' not specified; testing for “group_idstim”.
[1] "~(1|sample_id)+foo+group_id"
So, in principle, the inclusion of covariates should work. I also tried adding 2 covariates and there was still no error. Any other hints as to track down the issues would be appreciated. Else, have you tried running debug("mmDS")
to perhaps better understand what's going wrong?