bedapub/besca

Clear warning for mistakes in the batch correction methods

Closed this issue · 0 comments

We should introduce a warning or stop statement upon selection of a batch variable that is constant for all cells.

Right now the error is unclear:

ValueError                                Traceback (most recent call last)
<ipython-input-30-5ecaefce0ae6> in <module>
      3     adata_uncorrected = adata.copy()
      4     adata.obs['batch'] = adata.obs[batch_to_correct]
----> 5     adata = bc.st.pca_neighbors_umap(adata,results_folder, method='bbknn')
      6 else:
      7     adata = bc.st.pca_neighbors_umap(adata, results_folder)

[...]besca/st/_wrapper_funcs.py in pca_neighbors_umap(adata, results_folder, nrpcs, nrpcs_neigh, nrneigh, method)
    382                 'Neighborhood analysis performed with .X instead of PCs.')
ValueError: Unknown metric angular. Valid metrics are ['euclidean', 'l2', 'l1', 'manhattan', 'cityblock', 'braycurtis', 'canberra', 'chebyshev', 'correlation', 'cosine', 'dice', 'hamming', 'jaccard', 'kulsinski', 'mahalanobis', 'matching', 'minkowski', 'rogerstanimoto', 'russellrao', 'seuclidean', 'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule', 'wminkowski', 'nan_euclidean', 'haversine'], or 'precomputed', or a callable

Reported by RS