Repository navigation
Add 'equal_frequency' option to highly_variable_genes - #572
Closed
davidhbrann wants to merge 2 commits into
Closed
davidhbrann wants to merge 2 commits into
davidhbrann wants to merge 2 commits into
Conversation
Also add option to change number of bins for cell ranger flavor.
Adding drop duplicates to avoid raising an error that the bins don't have unique edges. In practice this could make the first bin have twice as many genes. You could also do the Seurat thing with `pd.cut(df['mean'], bins = [-np.inf, np.percentile(df['mean'], q=np.linspace(0,100,bins+1))])` but I don't know if that's a better approach.
Member
|
Great, thank you! It will be merged very soon; the change in the cell ranger option might be a backwards breaking change, hence, I added this here: #453. Alex |
8 of 15 tasks
Contributor
|
Hey @falexwolf, if starting the percentile bins from 10 is not intentional (as mentioned in #624 ) I can resolve the conflicts and merge this along with the fix in #624 . |
Member
|
Sounds good, @gokceneraslan! |
cyrus303
approved these changes
Dec 19, 2019
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.
This fixes #415, by allowing one to find variable genes using the
equal_frequencyoption. It also adds and option to change the number of bins for cell ranger flavor.I originally tried to copy the implementation in Seurat, which would allow a test similar to what's already present for the
equal_widthimplementation. However the Seurat code has an error:The
-1in the code makes it such that there is always only one value in the first bin, which goes from -1 to the minimum value. Not sure why they have this, but then we get different answers since the Scanpy code inhighly_variable_genesalways makes bins that have only one gene significant (to correct the other error from Seurat that normally excludes these bins/genes, which often contain some highly-expressed genes). Additionally, thecutfunction in R sometimes returns bin edges with different rounding than the Seurat implementation since Seurat does not modify the defaultdig.lab = 3. In contrast, I believe pandas uses the actual cutoffs in the data.