Skip to content

Allow user selected distance metric for diffusion maps#5

Open
jordanc17 wants to merge 65 commits intomasterfrom
distance-metric
Open

Allow user selected distance metric for diffusion maps#5
jordanc17 wants to merge 65 commits intomasterfrom
distance-metric

Conversation

@jordanc17
Copy link

Allow the user to pass distance metric for sc.pp.neighbors to palantir.utils.run_diffusion_maps. The default is still euclidean so the default behavior isn't changed.

We ecountered the follwing testing error, which seems to be an
incompatibility of scanpy:

```Python
        # Run PCA
        if not use_hvg:
            n_comps = n_components
        else:
            l_n_comps = min(1000, ad.n_obs - 1, ad.n_vars - 1)
>           sc.pp.pca(ad, n_comps=l_n_comps, mask_var="highly_variable", zero_center=False)
E           TypeError: pca() got an unexpected keyword argument 'mask_var'
```
katosh and others added 29 commits June 12, 2024 17:08
Update `run_magic_imputation` to make setting small values to 0 optional
 * Made pygam an optional dependency that can be installed with `pip install palantir[gam]` or `pip install palantir[full]`
 * Added proper conditional imports and improved error handling for pygam
 * Enhanced `run_magic_imputation` to return appropriate data types for different inputs
   * For numpy arrays or csr_matrix inputs, returns sparse matrices by default (sparse=True)
   * For pandas DataFrames, returns pandas DataFrames
   * For AnnData objects, stores results in the object and returns sparse matrices by default
 * Maintained sparse=True as the default for run_magic_imputation for backward compatibility
 * Added better support for both sparse and dense output formats in `run_magic_imputation`
 * Fixed circular import issues between modules
 * Updated code to use direct AnnData imports for newer compatibility
 * Improved version detection using importlib.metadata with graceful fallbacks
 * Fixed Series indexing deprecation warnings in early cell detection functions
 * Standardized documentation with NumPy-style docstrings throughout the codebase
 * Added comprehensive type hints to improve code quality and IDE support
@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments