gramene-search 2.41.1 → 2.41.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6369,6 +6369,9 @@ var $d365d8c287ab0c94$export$2e2bcd8739ae039 = $d365d8c287ab0c94$var$ontologyEnr
6369
6369
  // - homology.tbrowse: the tbrowse ViewState (collapsedNodeIds, prunedNodeIds,
6370
6370
  // swappedNodeIds, compressedNodeIds, nodeOfInterestId, zones, zoneStates,
6371
6371
  // search, selectedNodeId). Tbrowse is driven in controlled mode from this.
6372
+ // - homology.tbrowseCarry: the previous tree's ViewState, held across a tree
6373
+ // switch until the new tree is seeded from its configuration (zones, zone
6374
+ // settings, row height, font size)
6372
6375
  // - sequences: the Sequences detail's internal state — tab ('dna'|'rna'|'pep'),
6373
6376
  // tid (selected transcript id), upstream/downstream (flanking bp). Driven in
6374
6377
  // controlled mode from this so a saved view restores the chosen sub-tab and
@@ -6495,13 +6498,18 @@ const $7f865ea0feda21af$var$uiViewState = {
6495
6498
  viewer: payload.viewer
6496
6499
  });
6497
6500
  case 'UI_HOMOLOGY_TREE_SET':
6498
- // payload: { geneId, tree }. The tbrowse ViewState belongs to one tree
6499
- // (its node ids), so a switch drops it and Homology re-seeds the new
6500
- // tree pivoted on the gene.
6501
- return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
6502
- tree: payload.tree,
6503
- tbrowse: undefined
6504
- });
6501
+ {
6502
+ // payload: { geneId, tree }. The tbrowse ViewState's node ids belong to
6503
+ // one tree, so a switch drops it and Homology re-seeds the new tree
6504
+ // pivoted on the gene, keeping the old state's configuration (carried
6505
+ // until then; a switch before the seed keeps the earlier carry).
6506
+ const prev = state.byGene[payload.geneId]?.homology || {};
6507
+ return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
6508
+ tree: payload.tree,
6509
+ tbrowse: undefined,
6510
+ tbrowseCarry: prev.tbrowse || prev.tbrowseCarry
6511
+ });
6512
+ }
6505
6513
  case 'UI_HOMOLOGY_HEIGHT_SET':
6506
6514
  // payload: { geneId, height }
6507
6515
  return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
@@ -6510,7 +6518,8 @@ const $7f865ea0feda21af$var$uiViewState = {
6510
6518
  case 'UI_HOMOLOGY_TBROWSE_SET':
6511
6519
  // payload: { geneId, tbrowse } -- a full ViewState object
6512
6520
  return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
6513
- tbrowse: payload.tbrowse
6521
+ tbrowse: payload.tbrowse,
6522
+ tbrowseCarry: undefined
6514
6523
  });
6515
6524
  case 'UI_SEQUENCES_SET':
6516
6525
  // payload: { geneId, patch } -- merges into the sequences slice
@@ -9232,6 +9241,39 @@ const $64fad37f770d2bfe$var$ZONE_SLOTS = {
9232
9241
  'exprAttrs'
9233
9242
  ]
9234
9243
  };
9244
+ // Per-zone settings that point into one tree's rows or alignment columns
9245
+ // (row flips, per-gap / per-intron overrides, the MSA viewport and expanded
9246
+ // mask runs, the genome pan), reset when a tree switch carries the rest of
9247
+ // the zone settings over.
9248
+ const $64fad37f770d2bfe$var$TREE_SCOPED_ZONE_FIELDS = {
9249
+ flippedNodeIds: [],
9250
+ gapOverrideKeys: [],
9251
+ intronOverrideKeys: [],
9252
+ viewportStart: 0,
9253
+ viewportEnd: 0,
9254
+ panPx: 0
9255
+ };
9256
+ function $64fad37f770d2bfe$var$carryViewState(vs) {
9257
+ const soft = (0, $gXNCa$tbrowsecore.softResetForNewTree)(vs);
9258
+ const zoneStates = (0, ($parcel$interopDefault($gXNCa$lodash))).mapValues(soft.zoneStates || {}, (zs)=>{
9259
+ if (!(0, ($parcel$interopDefault($gXNCa$lodash))).isPlainObject(zs)) return zs;
9260
+ const next = {
9261
+ ...zs
9262
+ };
9263
+ Object.keys($64fad37f770d2bfe$var$TREE_SCOPED_ZONE_FIELDS).forEach((k)=>{
9264
+ if (k in next) next[k] = $64fad37f770d2bfe$var$TREE_SCOPED_ZONE_FIELDS[k];
9265
+ });
9266
+ if (next.mask && next.mask.expandedRuns) next.mask = {
9267
+ ...next.mask,
9268
+ expandedRuns: []
9269
+ };
9270
+ return next;
9271
+ });
9272
+ return {
9273
+ ...soft,
9274
+ zoneStates: zoneStates
9275
+ };
9276
+ }
9235
9277
  class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$react))).Component {
9236
9278
  constructor(props){
9237
9279
  super(props);
@@ -9289,6 +9331,7 @@ class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$
9289
9331
  return typeof h === 'number' ? h : 600;
9290
9332
  }
9291
9333
  setTree(field) {
9334
+ if (this.treeRef && this.treeRef.field === field) return;
9292
9335
  this.props.doSetHomologyTree({
9293
9336
  geneId: this.getGeneId(),
9294
9337
  tree: field
@@ -9364,6 +9407,8 @@ class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$
9364
9407
  // uncontrolled mode (each zone's fr-share, initial visibility, default
9365
9408
  // per-zone state); the pivot is computed for THIS gene — the loader is
9366
9409
  // shared by every gene of the tree, so its own pivot may be another gene's.
9410
+ // After a tree switch the seed starts from the previous tree's state instead,
9411
+ // minus its node ids, so the zones and display settings stay as they were.
9367
9412
  maybeSeedTbrowseViewState() {
9368
9413
  if (this.getViewer() !== 'tbrowse') return;
9369
9414
  if (this.getHomologySlice().tbrowse) return;
@@ -9373,7 +9418,10 @@ class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$
9373
9418
  const snap = this.loader.getSnapshot();
9374
9419
  const ref = this.selectedTreeRef(this.gene);
9375
9420
  if (!ref || snap.status !== 'ready' || !snap.tree || !snap.root || snap.root.meta.treeId !== ref.id) return;
9376
- this.setTbrowseViewState((0, $gXNCa$tbrowsecore.applyPivot)((0, $gXNCa$tbrowsecore.buildInitialViewState)(this.getTbrowseZones()), (0, $gXNCa$tbrowsecore.computePivotState)(snap.tree, this.gene._id)));
9421
+ const zones = this.getTbrowseZones();
9422
+ const carry = this.getHomologySlice().tbrowseCarry;
9423
+ const base = carry ? (0, $gXNCa$tbrowsecore.ensureZones)($64fad37f770d2bfe$var$carryViewState(carry), zones) : (0, $gXNCa$tbrowsecore.buildInitialViewState)(zones);
9424
+ this.setTbrowseViewState((0, $gXNCa$tbrowsecore.applyPivot)(base, (0, $gXNCa$tbrowsecore.computePivotState)(snap.tree, this.gene._id)));
9377
9425
  }
9378
9426
  componentDidMount() {
9379
9427
  this._unsubscribe = this.loader.subscribe(()=>this.setState({