mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-25 06:58:11 +08:00
add context sensitivity to annotation "label" menu item (#1015)
* cache common results to reduce jank * add util function in support of annotation labelling * enable/disable annotation edit menus per issue 972; improve formatting * PR review requests
This commit is contained in:
@@ -132,6 +132,22 @@ export function setLabelByMask(df, colName, mask, label) {
|
||||
return ndf;
|
||||
}
|
||||
|
||||
export function allHaveLabelByMask(df, colName, label, mask) {
|
||||
// return true if all rows as indicated by mask have the colname set to label.
|
||||
// False if not.
|
||||
const col = df.col(colName);
|
||||
if (!col) return false;
|
||||
if (df.length !== mask.length)
|
||||
throw new InternalError("mismatch on mask length");
|
||||
|
||||
for (let i = 0; i < df.length; i += 1) {
|
||||
if (mask[i]) {
|
||||
if (col.iget(i) !== label) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
export function worldToUniverseMask(worldMask, worldObsAnnotations, nObs) {
|
||||
/*
|
||||
given world seleciton mask, return a selection mask for entire universe
|
||||
|
||||
Reference in New Issue
Block a user