theislab / cellrank

CellRank: dynamics from multi-view single-cell data
https://cellrank.org
BSD 3-Clause "New" or "Revised" License
343 stars 47 forks source link

BaseModel.prepare() unexpected behaviour #1152

Open nrclaudio opened 8 months ago

nrclaudio commented 8 months ago

According to the documentation of BaseModel.prepare() if there's no Lineage specified, the weights will be set to 1. In such case Line 366

probs = Lineage.from_adata(self.adata, backward=backward)

throws a KeyError: "Unable to find lineage data in adata.obsm['lineages_fwd']:

Therefore Line 432 is never reached :

if lineage is not None:
    weight_threshold, val = weight_threshold
    w = _densify_squeeze(probs.X, self._dtype)
    w[w < weight_threshold] = val
else: 
    w = np.ones(len(x), dtype=self._dtype) ##432

I know having no lineage computed is non-standard functionality within your pipeline, but I thought it might be worth bringing it up.

michalk8 commented 7 months ago

Hi @nrclaudio , thanks a lot for pointing this out, will fix to match the docs!

Marius1311 commented 5 months ago

Hi @michalk8, can we close this?