Repository navigation
Conversation
|
So, without any evidence, I think it should be fine. The reason I had put an error in the first place is that the typical behavior is to pass log normalized data to this HVG function, and I didn't want people to run this incorrectly. I think another solution would be to just throw a UserWarning, though in a way I like the idea of having an argument that disables the You might also consider bypassing the check if the flag is set, because it can be slowish for large datasets. |
|
How about a "Your data doesn't appear to be have integer values, but this method expects raw count data. Proceed with caution."
|
Makes sense to me. Though if So the warning would be more like, "'seurat_v3' flavor expects raw count data. Proceed with caution." |
Yes.
I was thinking the warning would only occur if |
|
thanks guys, added the I tried to add a test for the warning following: https://docs.pytest.org/en/stable/warnings.html Thank you! |
| logg.warning( | ||
| "`flavor='seurat_v3'` expects raw count data, but non-integers were found." | ||
| ) |
There was a problem hiding this comment.
Logging frameworks should have a way of recording warnings on their own. In general, we should not be using logg.warning
There was a problem hiding this comment.
| logg.warning( | |
| "`flavor='seurat_v3'` expects raw count data, but non-integers were found." | |
| ) | |
| warn( | |
| "`flavor='seurat_v3'` expects raw count data, but non-integers were found.", | |
| UserWarning | |
| ) |
|
I will merge this! |
| if check_values: | ||
| warnings.warn( | ||
| "`flavor='seurat_v3'` expects raw count data, but non-integers were found.", | ||
| UserWarning, |
There was a problem hiding this comment.
On another note, in this current state check_nonnegative_integers is an unused import. Do you guys check for this with flake8?
| check_values: Optional[bool] = True, | ||
| span: Optional[float] = 0.3, |
There was a problem hiding this comment.
shouldn't both not be Optional?
|
really bad job from my side, thanks @adamgayoso for checking it🙏 reverted PR on master |
…m and warning as in scverse#1642
* adding core functions and documentation for pearson residual normalization and hvg selection * adding Pearson residual+PCA bundles, minor bug fixes * some style cleanup, minor fixes * adapting _normalize_pearson_residuals() to cleaned-up _normalized_total() from #1667 * updating layer management as in #1667 for _highly_variable_pearson_residuals() as well * slight performance improvement for sparse input * style cleanup * fixing import issue, fixing docstring style, adding check_values param and warning as in #1642 * fixed small NameError, simplified clip argument * remove pd.categorical() * adding check_values to docstrings and remaining pearson residual functions * np.empty instead of np.nan * add references to docstrings, add HVG details to docstring * exposing pca keyword arguments to the user for the bundle/recipe functions * removed unneeded reversal in hvg, fix kwargs_pca bug, consistent defaults across files * fixing handling of `inplace` and `subset` arguments (see issue #1886), explicit typing of output, adding theta input check * renaming output fields for consistency, fixing minor bug * renaming output fields for consistency * adding function that prepares testdata (used for pearson residual tests) * adding tests for all pearson residual functions * fix precommit high_var_genes * try to get precommit to work * try to get precommit to work * fix recipes * fix normalization * remove relative imports * fix docstrings * retry to build docs * fix highvar docstring * more fixing docstrings * docs build locally ? 🔨 * minor cleanup test normalization * more minor cleanups * final cleanup normalization * fixes high var * init experimental module * fix column ordering for batch case * moving to experimental, minor fix for experimental version of hvg selection * linking tests to new experimental submodule, style cleanup * adapt input arguments and docstring for experimental version of hvg selection function * add recipes * fix docs * add correct module docs * fix recipe docstrings * try fix indentation * fix indentation * fix * new indentation * add space * fixing typo in docstring * renaming pca output fields * adapting tests to new output fieldname * fix docs 🔨 * update docs * fix test 🔨 * ensure argument and docstring consistency * update citation year * cleaning imports in `preprocessing` functions * making inputcheck tests specific to error/warning messages * making inputcheck tests specific to error/warning messages * resolve HVGs across batches more cleanly, fix dtype issue * renaming pca input arguments * renaming pca input arguments * _pca bundle: more efficient copy handling, added input check. both _pca and _recipe: varm field for PCs, adapted tests and docs * move repeated inputcheck code to helpers * merging tests *_values and *_general * condense code in pearson hvg selection test, smaller test data for speedup * condensing code in normalization tests * add asteriks for keyword * updating refs to Genome Biology publication * cleanup helpers.py * cleanup main files as requested by @ivirshup * revert unneeded settingWithCopy fix * cache data * use doc_params for doc * fix doc_params var * finalize docs * fix param doc * wrong var still * add cached datasets module and test on high_var_genes tests * use new cache dataset module for tests * fix precommit * fix docs * fix reference and add notebook to tutorials * add release note * add release note * fix release note * typo * remove duplicate reference * fixing black flake etc requirements * add _pca function to release note * last edits to docs * fix release and tutorial image * try fix pre-commit * minor docs * Remove accidentally included files from merge Co-authored-by: giovp <[email protected]> Co-authored-by: Isaac Virshup <[email protected]>
Hi,
I'm working with pseudocounts data (kallisto/alevin/salomon output). I think they are called "pseudocount": if a read is assigned to two regions (genes) , a probability is assigned (e.g. gene1=0.2, gene2=0.8). Nevertheless, they can still considered counts and so it would be cool to use the
highly_variable_genes flavour=seuratv3.I added an additional argument in case users would like to enforce this, as it was similarly done/discussed in theislab/scvelo#190
Would like to hear what you guys think, pinging @adamgayoso (thanks for the great overleaf doc! )