Open iamsalil opened 1 year ago
I am encountering the same error. Have you fixed it?
I encountered the same problem
Hi, everyone, @DawnChou , @Aeget1000 , @iamsalil . I faced the same problem as well. TLDR: choose a higher span
value in sc.pp.highly_variable_genes
. The default is 0.3, which caused an error for me as well. 0.5 worked fine in my case. The information below might be interesting for developers or anyone who wants to understand this error more deeply.
I got the error when using HLCA data. If scanpy developers are interested, I can point to the dataset to reproduce this problem. It is quite big, but I don't know any other example yet.
The error is caused by this line. I got it when selecting HVGs by "dataset" batch key in HLCA. Batch "Sims_2019" caused the problem. Surprisingly, relationships between mean
and var
as well as between x
and y
seemed ok:
However, something was still causing the problem. I tried to locate the error in the loess calucation in the original package but did not succeed. Anyway, this is a bit out of the scope of scanpy. Setting span
to a higher value (0.5) solved the problem for me. If there is no strong argument against it, I suggest changing the default value from 0.3 to 0.5.
By the way, there is another potential bug in this function. If all the values are constant and not_const
only consists of False, kernel dies when trying to run model.fit()
. Maybe it is prevented previously, but in case it isn't, you might want to check that.
Please make sure these conditions are met
What happened?
Note: This bug seems to have been mentioned on 2/13/2022 in this discourse.scverse.org thread: https://discourse.scverse.org/t/error-in-highly-variable-gene-selection/276. However, I can't seem to access scverse.org so I can't see what the cause/resolution was.
Issue: I am running highly_variable_genes with flavor='seurat_v3'. When I do not include a batch_key, the function runs fine. When I add a batch_key, I get a numerical error.
Minimal code sample
Error output
Versions