JonathanShor / DoubletDetection

Doublet detection in single-cell RNA-seq data.
https://doubletdetection.readthedocs.io/en/stable/
MIT License
81 stars 23 forks source link

`IndexError: list index out of range` #157

Open danli349 opened 1 year ago

danli349 commented 1 year ago

Hello:

Can you please let me know what is the reason of this error? Thanks

clf = doubletdetection.BoostClassifier(
    n_iters=10,
    clustering_algorithm="louvain",
    standard_scaling=True,
    pseudocount=0.1,
    n_jobs=-1,
)
doublets = clf.fit(adata.X).predict(p_thresh=1e-16, voter_thresh=0.5)
doublet_score = clf.doublet_score()
Exception ignored on calling ctypes callback function: <function _ThreadpoolInfo._find_modules_with_dl_iterate_phdr.<locals>.match_module_callback at 0x7f1efcee03a0>
Traceback (most recent call last):
  File "/home/dan/miniconda3/lib/python3.8/site-packages/threadpoolctl.py", line 400, in match_module_callback
    self._make_module_from_path(filepath)
  File "/home/dan/miniconda3/lib/python3.8/site-packages/threadpoolctl.py", line 515, in _make_module_from_path
    module = module_class(filepath, prefix, user_api, internal_api)
  File "/home/dan/miniconda3/lib/python3.8/site-packages/threadpoolctl.py", line 606, in __init__
    self.version = self.get_version()
  File "/home/dan/miniconda3/lib/python3.8/site-packages/threadpoolctl.py", line 646, in get_version
    config = get_config().split()
AttributeError: 'NoneType' object has no attribute 'split'
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
Cell In[8], line 1
----> 1 doublets = clf.fit(adata.X).predict(p_thresh=1e-16, voter_thresh=0.5)
      2 doublet_score = clf.doublet_score()

File ~/miniconda3/lib/python3.8/site-packages/doubletdetection/doubletdetection.py:208, in BoostClassifier.fit(self, raw_counts)
    206 if self.verbose:
    207     print("Iteration {:3}/{}".format(i + 1, self.n_iters))
--> 208 self.all_scores_[i], self.all_log_p_values_[i] = self._one_fit()
    209 all_communities[i] = self.communities_
    210 all_parents.append(self.parents_)

File ~/miniconda3/lib/python3.8/site-packages/doubletdetection/doubletdetection.py:333, in BoostClassifier._one_fit(self)
    331 f = io.StringIO()
    332 with redirect_stdout(f):
--> 333     fullcommunities, _, _ = phenograph.cluster(
    334         aug_counts.obsm["X_pca"], n_jobs=self.n_jobs, **self.clustering_kwargs
    335     )
    336 out = f.getvalue()
    337 if self.verbose:

File ~/miniconda3/lib/python3.8/site-packages/phenograph/cluster.py:350, in cluster(data, clustering_algo, k, directed, prune, min_cluster_size, jaccard, primary_metric, n_jobs, q_tol, louvain_time_limit, nn_method, partition_type, resolution_parameter, n_iterations, use_weights, seed, **kargs)
    348 communities, Q = "", ""
    349 if clustering_algo == "louvain":
--> 350     communities, Q = run_louvain(graph, q_tol, louvain_time_limit)
    352 elif clustering_algo == "leiden":
    353     communities, Q = run_leiden(
    354         graph,
    355         directed,
   (...)
    361         kargs,
    362     )

File ~/miniconda3/lib/python3.8/site-packages/phenograph/cluster.py:164, in run_louvain(graph, q_tol, louvain_time_limit)
    162 uid = uuid.uuid1().hex
    163 graph2binary(uid, graph)
--> 164 communities, Q = runlouvain(uid, tol=q_tol, time_limit=louvain_time_limit)
    166 # clean up
    167 for f in os.listdir():

File ~/miniconda3/lib/python3.8/site-packages/phenograph/core.py:293, in runlouvain(filename, max_runs, time_limit, tol)
    290 run += 1
    292 # continue only if we've reached a higher modularity than before
--> 293 if q[-1] - Q > tol:
    295     Q = q[-1]
    296     updated = run

IndexError: list index out of range