Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve type handling for non-string annotation data #465

Merged
merged 2 commits into from
Nov 26, 2018

Conversation

bkmartinjr
Copy link
Contributor

@bkmartinjr bkmartinjr commented Nov 21, 2018

Fixes #457

Several improvements to annotation/metadata handling:

  • revised front-end categorical metadata (components and reducers) to not assume all annotation is composed of string data. It will now safely handle native types (bool, string, number, etc).
  • improved the type inferencing in the ScanPy engine so that it correctly handles bools, and does not mistakenly coerce between incompatible numpy types.

While this fixes #457, there is still residual issues with how we summarize metadata in the front-end (specfically, world.summary assumes all annotation/metadata values can be safely converted to Object lables/strings without losing information). There will be another PR to fix that.

@bkmartinjr bkmartinjr changed the title [NOT READY TO MERGE] improve type handling for non-string annotation data improve type handling for non-string annotation data Nov 25, 2018
const cat = categoricalSelectionState[metadataField];
const categoryCount = {
total: cat.numOptions,
on: _.reduce(cat.optionSelected, (res, cond) => (cond ? res + 1 : res), 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, feeling on might be a little bit obfuscated. Does it mean 'currentlySelected', or is it related to a handler for an event? Room for a better name or a comment here. Obvious what it's doing here after spending a minute reading the ternary, so maybe it's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will improve the clarity

Copy link
Contributor

@csweaver csweaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backend stuff looks good to me!

@csweaver csweaver merged commit 138d309 into master Nov 26, 2018
@bkmartinjr bkmartinjr deleted the bkmartinjr/#457-bools branch November 28, 2018 17:39
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.

Issue with launching cellxgene when anndata object has boolean metadata
3 participants