gramene-search 2.41.0 → 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
@@ -232,6 +232,14 @@ $parcel$export(module.exports, "bootViewFromUrl", () => $c69c61828e36a328$export
232
232
 
233
233
 
234
234
 
235
+ // The API the gene Expression tab takes its studies from: configuration
236
+ // expressionApi when set, for a site whose own index has no expression studies
237
+ // or attributes but shares its genes (by id) with one that does, as Gramene
238
+ // Maize (maize_v5) does with Gramene's current release.
239
+ const $9d9aeaf9299e61a1$var$expressionApi = (store)=>{
240
+ const cfg = store.selectConfiguration();
241
+ return (cfg && cfg.expressionApi || store.selectGrameneAPI()).replace(/\/$/, '');
242
+ };
235
243
  const $9d9aeaf9299e61a1$var$facets = [
236
244
  "{!facet.limit='300' facet.mincount='1' key='taxon_id'}taxon_id",
237
245
  // "{!facet.limit='100' facet.mincount='1' key='genetree'}gene_tree",
@@ -423,7 +431,7 @@ const $9d9aeaf9299e61a1$var$expressionStudies = (0, $gXNCa$reduxbundler.createAs
423
431
  persist: true,
424
432
  staleAfter: 86400000,
425
433
  getPromise: ({ store: store })=>{
426
- return fetch(`${store.selectGrameneAPI()}/experiments?rows=-1`).then((res)=>res.json()).then((res)=>(0, ($parcel$interopDefault($gXNCa$lodash))).groupBy(res, 'taxon_id'));
434
+ return fetch(`${$9d9aeaf9299e61a1$var$expressionApi(store)}/experiments?rows=-1`).then((res)=>res.json()).then((res)=>(0, ($parcel$interopDefault($gXNCa$lodash))).groupBy(res, 'taxon_id'));
427
435
  }
428
436
  });
429
437
  // Only fetch when a view that consumes expression studies is enabled.
@@ -766,8 +774,10 @@ const $9d9aeaf9299e61a1$var$grameneParalogs = {
766
774
  // e.g. ['E-MTAB-3839', 'JGI-SB-2']), keyed by gene id. The search results do
767
775
  // not carry the field (it is not among /search's default fields), so the
768
776
  // Expression tab asks for it gene by gene. Each entry is {pending: true} while
769
- // the request is out, then {studies: [...]} ([] for a gene expressed in no
770
- // study), or {studies: null} when the request failed (asked again next time).
777
+ // the request is out, then {studies: [...]}, or {studies: null} when the
778
+ // request failed (asked again next time) or the gene's doc lacks the field:
779
+ // older indexes (e.g. maize_v5) never carry it, so its absence can't be read
780
+ // as "in no study". A site with an expressionApi asks that instead.
771
781
  const $9d9aeaf9299e61a1$var$grameneGeneStudies = {
772
782
  name: 'grameneGeneStudies',
773
783
  getReducer: ()=>(state = {}, { type: type, payload: payload })=>{
@@ -805,12 +815,12 @@ const $9d9aeaf9299e61a1$var$grameneGeneStudies = {
805
815
  payload: geneId
806
816
  });
807
817
  const q = encodeURIComponent(`id:"${geneId}"`);
808
- fetch(`${store.selectGrameneAPI()}/search?q=${q}&fl=id,expressed_in_gxa_attr_ss&rows=1`).then((res)=>{
818
+ fetch(`${$9d9aeaf9299e61a1$var$expressionApi(store)}/search?q=${q}&fl=id,expressed_in_gxa_attr_ss&rows=1`).then((res)=>{
809
819
  if (!res.ok) throw new Error(`HTTP ${res.status}`);
810
820
  return res.json();
811
821
  }).then((res)=>{
812
822
  const doc = res.response.docs.find((d)=>d.id === geneId);
813
- const studies = doc && doc.expressed_in_gxa_attr_ss || [];
823
+ const studies = doc && doc.expressed_in_gxa_attr_ss || null;
814
824
  dispatch({
815
825
  type: 'GRAMENE_GENE_STUDIES_RECEIVED',
816
826
  payload: {
@@ -6359,6 +6369,9 @@ var $d365d8c287ab0c94$export$2e2bcd8739ae039 = $d365d8c287ab0c94$var$ontologyEnr
6359
6369
  // - homology.tbrowse: the tbrowse ViewState (collapsedNodeIds, prunedNodeIds,
6360
6370
  // swappedNodeIds, compressedNodeIds, nodeOfInterestId, zones, zoneStates,
6361
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)
6362
6375
  // - sequences: the Sequences detail's internal state — tab ('dna'|'rna'|'pep'),
6363
6376
  // tid (selected transcript id), upstream/downstream (flanking bp). Driven in
6364
6377
  // controlled mode from this so a saved view restores the chosen sub-tab and
@@ -6485,13 +6498,18 @@ const $7f865ea0feda21af$var$uiViewState = {
6485
6498
  viewer: payload.viewer
6486
6499
  });
6487
6500
  case 'UI_HOMOLOGY_TREE_SET':
6488
- // payload: { geneId, tree }. The tbrowse ViewState belongs to one tree
6489
- // (its node ids), so a switch drops it and Homology re-seeds the new
6490
- // tree pivoted on the gene.
6491
- return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
6492
- tree: payload.tree,
6493
- tbrowse: undefined
6494
- });
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
+ }
6495
6513
  case 'UI_HOMOLOGY_HEIGHT_SET':
6496
6514
  // payload: { geneId, height }
6497
6515
  return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
@@ -6500,7 +6518,8 @@ const $7f865ea0feda21af$var$uiViewState = {
6500
6518
  case 'UI_HOMOLOGY_TBROWSE_SET':
6501
6519
  // payload: { geneId, tbrowse } -- a full ViewState object
6502
6520
  return $7f865ea0feda21af$var$setHomology(state, payload.geneId, {
6503
- tbrowse: payload.tbrowse
6521
+ tbrowse: payload.tbrowse,
6522
+ tbrowseCarry: undefined
6504
6523
  });
6505
6524
  case 'UI_SEQUENCES_SET':
6506
6525
  // payload: { geneId, patch } -- merges into the sequences slice
@@ -9222,6 +9241,39 @@ const $64fad37f770d2bfe$var$ZONE_SLOTS = {
9222
9241
  'exprAttrs'
9223
9242
  ]
9224
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
+ }
9225
9277
  class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$react))).Component {
9226
9278
  constructor(props){
9227
9279
  super(props);
@@ -9279,6 +9331,7 @@ class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$
9279
9331
  return typeof h === 'number' ? h : 600;
9280
9332
  }
9281
9333
  setTree(field) {
9334
+ if (this.treeRef && this.treeRef.field === field) return;
9282
9335
  this.props.doSetHomologyTree({
9283
9336
  geneId: this.getGeneId(),
9284
9337
  tree: field
@@ -9354,6 +9407,8 @@ class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$
9354
9407
  // uncontrolled mode (each zone's fr-share, initial visibility, default
9355
9408
  // per-zone state); the pivot is computed for THIS gene — the loader is
9356
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.
9357
9412
  maybeSeedTbrowseViewState() {
9358
9413
  if (this.getViewer() !== 'tbrowse') return;
9359
9414
  if (this.getHomologySlice().tbrowse) return;
@@ -9363,7 +9418,10 @@ class $64fad37f770d2bfe$var$Homology extends (0, ($parcel$interopDefault($gXNCa$
9363
9418
  const snap = this.loader.getSnapshot();
9364
9419
  const ref = this.selectedTreeRef(this.gene);
9365
9420
  if (!ref || snap.status !== 'ready' || !snap.tree || !snap.root || snap.root.meta.treeId !== ref.id) return;
9366
- 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)));
9367
9425
  }
9368
9426
  componentDidMount() {
9369
9427
  this._unsubscribe = this.loader.subscribe(()=>this.setState({