-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add support for nD datasets in CompoundMatrix #1169
Conversation
packages/app/src/vis-packs/core/compound/CompoundMatrixVisContainer.tsx
Outdated
Show resolved
Hide resolved
|
||
const [slicedDims, slicedMapping] = useSlicedDimsAndMapping(dims, dimMapping); | ||
const [mappedArray] = useMappedArray( | ||
value.flat(1), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given our dimMapping, value
will always be a 1D array of tuples. So value.flat(1)
is still valid to flatten the tuples.
value: ArrayValue<PrintableType>; | ||
dims: number[]; | ||
dimMapping: DimensionMapping; | ||
toolbarContainer: HTMLDivElement | undefined; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at what is needed to add support for nD, I realized that there were a few props in MappedMatrixVis
that were derived from other props:
selection
can be derived fromdimMapping
throughgetSliceSelection
dims
is simplydataset.shape
Therefore, I think removing these props simplifies the component and reduces the risk of misuse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm true, true, I was going to argue against calling getSliceSelection
in MappedCompoundMatrixVis
, but you're making an excellent point. getSliceSelection
is cheap, so why not 🤷
Do you want to do this in the other containers/mapped vis, then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha, didn't realize it was the case for other containers. I will revert it for MatrixVis
and do another PR to do it for all containers at once.
d1fae05
to
9576550
Compare
packages/app/src/vis-packs/core/compound/CompoundMatrixVisContainer.tsx
Outdated
Show resolved
Hide resolved
value: ArrayValue<PrintableType>; | ||
dims: number[]; | ||
dimMapping: DimensionMapping; | ||
toolbarContainer: HTMLDivElement | undefined; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm true, true, I was going to argue against calling getSliceSelection
in MappedCompoundMatrixVis
, but you're making an excellent point. getSliceSelection
is cheap, so why not 🤷
Do you want to do this in the other containers/mapped vis, then?
9576550
to
6b7e627
Compare
/approve |
Update Cypress reference snapshots
Follow-up of #1130
I also refactored a few things: I will underline them in the comments. Tell me if you agree.