Take n_bins into account for the cell_ranger flavor of highly_variable_genes #624
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.
I've changed one line in the highly_variable_genes function, so that n_bins is taken into account with the cell_ranger flavor (currently only the seurat flavor uses this parameter).
Additionally, I have noticed that, in the current version, the bins are slightly offset: after -INF, it starts at 10, instead of 5, which results in the first bin containing twice as many genes as the other bins. I don't know if this is intentional (for example, to exactly reproduce the results of cell ranger) or not.
In the version that I suggest, I have removed this offset. As a consequence, with the default parameter of n_bins=20, my new version does not exactly reproduce the results of the previous version. In order to exactly reproduce the current results, we would have to keep this offset by doing range(2,n_bins+1) instead of range(1,n_bins).