theislab / cellrank

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

Question about metabolic labeling analysis #1208

Closed mingjianPeng closed 4 months ago

mingjianPeng commented 4 months ago

... Dear Developer, Hi, I noticed that CellRank 2 already supports the analysis of metabolic labeling data, I would like to know if there is a tutorial or a notebook about metabolic labeling?Looking forward to your reply, thanks!

WeilerP commented 4 months ago

Hi @mingjianPeng, sorry, there isn't a dedicated tutorial yet, but you can follow the reproducibility notebooks for CellRank 2. This and this notebook should be what you are looking for.

Marius1311 commented 4 months ago

for now, I think we could just link to the reproducibility repo from our docs I suppose @WeilerP

mingjianPeng commented 4 months ago

Hi, @WeilerP ,Thank you very much for your notebook, which is very helpful to me, but I found a small problem when I tried to reproduce the Parameter inference in this notebook.:

alpha, gamma, r0, success, opt_res = get_parameters(
    adata=adata,
    use_rep="labeled_smoothed",
    time_key="labeling_time",
    experiment_key="experiment",
    n_neighbors=n_neighbors,
    n_jobs=N_JOBS,
)

Running the above code will prompt:

TypeError: get_parameters() missing 1 required positional argument: 'x0'

The prompt is missing a parameter x0, can you help to see what is the reason?thanks.

WeilerP commented 4 months ago

Sorry about that! You can simply pass x0=None or specify custom initial guesses for the parameters.

mingjianPeng commented 4 months ago

Sorry about that! You can simply pass x0=None or specify custom initial guesses for the parameters.

Thank you for replying, yes, I tried x0 = None before, but there are still some problems :

alpha, gamma, r0, success, opt_res = get_parameters(
    adata=adata,
    use_rep="labeled_smoothed",
    time_key="labeling_time",
    experiment_key="experiment",
    n_neighbors=n_neighbors,
    n_jobs=N_JOBS,x0=None
)

_RemoteTraceback: 
Traceback (most recent call last):
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/joblib/externals/loky/process_executor.py", line 463, in _process_worker
    r = call_item()
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/joblib/externals/loky/process_executor.py", line 291, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/joblib/parallel.py", line 598, in __call__
    return [func(*args, **kwargs)
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/joblib/parallel.py", line 598, in <listcomp>
    return [func(*args, **kwargs)
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/scvelo/inference/_metabolic_labeling.py", line 446, in _fit
    _counts = get_counts(
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/scvelo/inference/_metabolic_labeling.py", line 308, in get_counts
    for idx, val in neighbors.iteritems()
  File "/home/mingjian/miniconda3/envs/cellrank_2.0.3/lib/python3.10/site-packages/pandas/core/generic.py", line 6299, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'iteritems'
WeilerP commented 4 months ago

That seems to be Pandas related. You can either install an earlier version - I haven't tried which one works - or wait for this PR to be merged and install scvelo from source.