Open t-a-m-i opened 3 days ago
Having infinites in your .X
sounds fundamentally incorrect.
My best guess as to why your other samples did not explode is that the bins with the infinites weren't part of the conflict resolution, and didn't make it to the PCA.
Not a bin2cell bug. Pursue with scanpy devs, or better yet, don't have infinites in your .X
.
Actually wait. How did you get the infinites in .X
in the first place?
So I just checked and they appear after b2c.destripe. However, this is only the case if sc.pp.filter_cells(ydata, min_counts=0) is called before. I know one would usually filter by min_count=1, but I have a special case and reason why I don´t.
I did some experimenting with b2c.destripe()
yesterday and was able to get it to produce infinites in certain situations after sc.pp.filter_cells(adata, min_counts=0)
. This is not a standard use case, as you yourself acknowledge - bins without expression are not conventionally useful. If I were to add acknowledgment of this to the code, I'd have destripe error out upon encountering 0s. I don't think you want that.
You could try the following as a workaround, assuming a freshly loaded object after sc.pp.filter_cells(adata, min_counts=0)
:
bdata = sc.pp.filter_cells(adata, min_counts=1, copy=True)
b2c.destripe(bdata)
adata[bdata.obs_names].X = bdata.X
adata.obs["n_counts_adjusted"] = 0
adata.obs.loc[bdata.obs_names, "n_counts_adjusted"] = bdata.obs["n_counts_adjusted"]
Hi, I get ValueError: Input contains infinity or a value too large for dtype('float64') when trying to run following on my data:
Full traceback:
I do have Infinites in ydata.X, but that wasn´t a problem in my other datasets. The exact same code with infinites being present in their ydata.X worked perfectly fine. Wondering what could be the issue here.
Thanks in advance!