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

Flat cell set manager #1382

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

keller-mark
Copy link
Member

@keller-mark keller-mark commented Jan 10, 2023

Fixes #1302

Also updates documentation formatting for older view config schema versions to put them under a dropdown.

TODO

  • Update config schema to reflect addition of coordination type obsSetFilter

Checklist

  • Ensure PR works with all demos on the dev.vitessce.io homepage
  • Open (draft) PR's into vitessce-python and vitessce-r if this is a release PR
  • Documentation added or updated

Copy link
Collaborator

@ilan-gold ilan-gold left a comment

Choose a reason for hiding this comment

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

First pass, need to check out and try now

*/
export function isEqualSet(a, b) {
if (a.length === b.length) {
const aSet = new Set(a);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this needed? For delete? It doesn't seem like this would ever actually dedup something (at least the behavior is not tested)

Copy link
Member Author

Choose a reason for hiding this comment

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

These functions are needed to check whether the parent checkbox should be:

  • checked (isFullSubSet true - all of the parent's children are selected)
  • indeterminate (isPartialSet && !isEqualSet true - subset of the parent's children are selected)
  • unchecked (otherwise - none of the parent's children)

They are implemented using isEqual because the set elements are arrays of strings like ["Clustering", "Cluster 1"] so normal equality operators won't work.

Screen Shot 2023-01-05 at 10 14 51 AM

*/
export function isPartialSet(a, b) {
// b is partially contained in a.
if (a.length > 0 && b.length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Like, Set is not used here but is below so not sure.

Copy link
Member Author

Choose a reason for hiding this comment

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

Set is just used for the internal implementation

Copy link
Member Author

Choose a reason for hiding this comment

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

Taking advantage of the fact that the arrays of strings will be represented in the Set by the reference to their array object. Could be implemented many other ways.

@@ -577,6 +647,88 @@ export function treeToExpectedCheckedLevel(currTree, checkedPaths) {
return result;
}

export function treeToFullyCheckedLevels(currTree, checkedPaths) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add doc strings to these?

@ilan-gold
Copy link
Collaborator

@keller-mark can you tell me how to use this (like a view config)? I tried adding a line into the view config upgrader to replace obsSets with flatObsSets and the component didn't work. The selection mechanism also seemed flaky.

@keller-mark
Copy link
Member Author

Sorry, I should have clarified this. It won't really be useful until the scatterplot and other components take advantage of the value for obsSetFilter. Right now the implementation here also does not render the user-selected cell sets, only those that come from the data. This is because I eventually wanted to implement the same type of lasso selection as cellxgene, where the user can select two cell sets at a time for differential expression, and I didn't think it would make much sense to show those in this cell set manager.

We can wait to merge this until at least the scatterplot usage of obsSetFilter (could be implemented on this branch, or a branch off of this branch) is implemented to avoid confusion.

@ilan-gold
Copy link
Collaborator

Up to you @keller-mark - I do want to give it a try but if you want to merge, we can.

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.

Implement a flat cell set manager
2 participants