LouisFaure / scFates

a scalable python suite for tree inference and advanced pseudotime analysis from scRNAseq data.
https://scfates.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
47 stars 1 forks source link

error while using scf.tl.linearity_deviation #23

Closed rLannes closed 10 months ago

rLannes commented 10 months ago

Hi, I have the following issue any idea how to fix, or what the causes?


scf.tl.linearity_deviation(Neutrophile,
                           start_milestone="immature",
                           end_milestone="mature",
                           n_jobs=2,
                           plot=True,
                           basis="X_umap")

Estimation of deviation from linearity

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [29], in <cell line: 1>()
----> 1 scf.tl.linearity_deviation(Neutrophile,
      2                            start_milestone="immature",
      3                            end_milestone="mature",
      4                            n_jobs=2,
      5                            plot=True,
      6                            basis="umap")

File ~/mambaforge/envs/scvi-env/lib/python3.9/site-packages/scFates/tools/linearity_deviation.py:151, in linearity_deviation(adata, start_milestone, end_milestone, percentiles, n_jobs, n_map, plot, basis, copy)
    148     n_jobs_map = n_jobs
    149     n_jobs = 1
--> 151 rss = ProgressParallel(
    152     total=n_map,
    153     n_jobs=n_jobs_map,
    154     use_tqdm=n_map > 1,
    155     desc="    multi mapping",
    156     file=sys.stdout,
    157 )(delayed(lindev_map)(m) for m in range(n_map))
    159 if plot:
    160     import scanpy as sc

File ~/mambaforge/envs/scvi-env/lib/python3.9/site-packages/scFates/tools/utils.py:46, in ProgressParallel.__call__(self, *args, **kwargs)
     39 def __call__(self, *args, **kwargs):
     40     with tqdm(
     41         disable=not self._use_tqdm,
     42         total=self._total,
     43         desc=self._desc,
     44         file=self._file,
     45     ) as self._pbar:
---> 46         return Parallel.__call__(self, *args, **kwargs)

File ~/.local/lib/python3.9/site-packages/joblib/parallel.py:1863, in Parallel.__call__(self, iterable)
   1861     output = self._get_sequential_output(iterable)
   1862     next(output)
-> 1863     return output if self.return_generator else list(output)
   1865 # Let's create an ID that uniquely identifies the current call. If the
   1866 # call is interrupted early and that the same instance is immediately
   1867 # re-used, this id will be used to prevent workers that were
   1868 # concurrently finalizing a task from the previous call to run the
   1869 # callback.
   1870 with self._lock:

File ~/.local/lib/python3.9/site-packages/joblib/parallel.py:1792, in Parallel._get_sequential_output(self, iterable)
   1790 self.n_dispatched_batches += 1
   1791 self.n_dispatched_tasks += 1
-> 1792 res = func(*args, **kwargs)
   1793 self.n_completed_tasks += 1
   1794 self.print_progress()

File ~/mambaforge/envs/scvi-env/lib/python3.9/site-packages/scFates/tools/linearity_deviation.py:94, in linearity_deviation.<locals>.lindev_map(m)
     83 img.add_edges(edges)
     85 cells = getpath(
     86     img,
     87     graph["milestones"][start_milestone],
   (...)
     91     df,
     92 )
---> 94 t_perc = [cells.t.quantile(p / 100) for p in percentiles]
     96 df[name + "_lindev_sel"] = np.nan
     97 df.loc[
     98     adata.obs_names.isin(cells.index), name + "_lindev_sel"
     99 ] = "putative bridge"

File ~/mambaforge/envs/scvi-env/lib/python3.9/site-packages/scFates/tools/linearity_deviation.py:94, in <listcomp>(.0)
     83 img.add_edges(edges)
     85 cells = getpath(
     86     img,
     87     graph["milestones"][start_milestone],
   (...)
     91     df,
     92 )
---> 94 t_perc = [cells.t.quantile(p / 100) for p in percentiles]
     96 df[name + "_lindev_sel"] = np.nan
     97 df.loc[
     98     adata.obs_names.isin(cells.index), name + "_lindev_sel"
     99 ] = "putative bridge"

AttributeError: 'NoneType' object has no attribute 't'
rLannes commented 10 months ago

my bad! did something wrong