Allow user selected distance metric for diffusion maps#5
Open
Allow user selected distance metric for diffusion maps#5
Conversation
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'
```
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
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 ☂️ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow the user to pass distance metric for
sc.pp.neighborstopalantir.utils.run_diffusion_maps.The default is stilleuclideanso the default behavior isn't changed.