@abi-software/flatmapvuer 0.3.8 → 0.3.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "main": "./dist/flatmapvuer.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -21,7 +21,7 @@
21
21
  "lint": "vue-cli-service lint"
22
22
  },
23
23
  "dependencies": {
24
- "@abi-software/flatmap-viewer": "^2.2.5",
24
+ "@abi-software/flatmap-viewer": "^2.2.7",
25
25
  "@abi-software/svg-sprite": "^0.1.14",
26
26
  "core-js": "^3.3.2",
27
27
  "css-element-queries": "^1.2.2",
package/src/App.vue CHANGED
@@ -74,8 +74,9 @@ export default {
74
74
  searchable: true,
75
75
  pathControls: true,
76
76
  minZoom: 4,
77
- availableSpecies : {"Human Female":{id: "human-flatmap_female", iconClass:"mapicon-icon_human", displayWarning:true},
78
- "Human Male":{id: "human-flatmap_male", taxo: "NCBITaxon:9606", iconClass:"mapicon-icon_human", displayWarning:true},
77
+ availableSpecies : {
78
+ "Human Female":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000383", iconClass:"mapicon-icon_human", displayWarning:true},
79
+ "Human Male":{taxo: "NCBITaxon:9606", biologicalSex: "PATO:0000384", iconClass:"mapicon-icon_human", displayWarning:true},
79
80
  "Rat":{taxo: "NCBITaxon:10114", iconClass:"mapicon-icon_rat", displayWarning:false, displayLatestChanges:true},
80
81
  "Mouse":{taxo: "NCBITaxon:10090", iconClass:"mapicon-icon_mouse", displayWarning:true},
81
82
  "Kember":{taxo: "ABI:1000001", displayWarning:true},
@@ -95,7 +96,7 @@ export default {
95
96
  helpMode: false,
96
97
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
97
98
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
98
- flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
99
+ flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
99
100
  // flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v1/"
100
101
  }
101
102
  },
@@ -378,10 +378,10 @@ export default {
378
378
  const label = data.label;
379
379
  const resource = [data.models];
380
380
  const taxonomy = this.entry;
381
- const flatmapId = this.flatmapId;
381
+ const biologicalSex = this.biologicalSex;
382
382
  const payload = {
383
383
  dataset: data.dataset,
384
- flatmapId: flatmapId,
384
+ biologicalSex: biologicalSex,
385
385
  taxonomy: taxonomy,
386
386
  resource: resource,
387
387
  label: label,
@@ -566,7 +566,7 @@ export default {
566
566
  if (this.mapImp) {
567
567
  let state = {
568
568
  entry: this.entry,
569
- flatmapId: this.flatmapId,
569
+ biologicalSex: this.biologicalSex,
570
570
  viewport: this.mapImp.getState()
571
571
  };
572
572
  return state;
@@ -575,11 +575,13 @@ export default {
575
575
  },
576
576
  setState: function(state) {
577
577
  if (state) {
578
- if (this.mapImp && (state.entry || state.flatmapId)) {
579
- if ((this.flatmapId && (this.flatmapId == state.flatmapId)) || (this.entry == state.entry))
580
- if (state.viewport) {
581
- this.mapImp.setState(state.viewport);
582
- }
578
+ if (this.mapImp &&
579
+ (state.entry && (this.entry == state.entry)) &&
580
+ (!state.biologicalSex || (state.biologicalSex === this.biologicalSex)))
581
+ {
582
+ if (state.viewport) {
583
+ this.mapImp.setState(state.viewport);
584
+ }
583
585
  } else {
584
586
  this.createFlatmap(state);
585
587
  }
@@ -593,15 +595,41 @@ export default {
593
595
  minimap = { position: "top-right" };
594
596
  }
595
597
 
596
- let entry = this.flatmapId;
597
- if (state && state.flatmapId) entry = state.flatmapId;
598
- if (!entry) {
599
- entry = this.entry;
600
- if (state && state.entry) entry = state.entry;
598
+ //As for flatmap-viewer@2.2.6, see belowf for the documentation
599
+ //for the identifier:
600
+
601
+ //@arg identifier {string|Object}
602
+ // A string or object identifying the map to load. If a string its
603
+ // value can be either the map's ``uuid``, assigned at generation time,
604
+ // or taxon and biological sex identifiers of the species that the map
605
+ // represents. The latest version of a map is loaded unless it has been
606
+ // identified using a ``uuid`` (see below).
607
+ // @arg identifier.taxon {string} The taxon identifier of the species
608
+ // represented by the map. This is specified as metadata in the map's source file.
609
+ // @arg identifier.biologicalSex {string} The biological sex of the species
610
+ // represented by the map. This is specified as metadatain the map's source file.
611
+ // @arg identifier.uuid {string} The unique uuid the flatmap. If given then this exact map will
612
+ // be loaded, overriding ``taxon`` and ``biologicalSex``.
613
+
614
+ let identifier = { taxon: this.entry };
615
+ if (state && state.entry) {
616
+ identifier.taxon = state.entry;
617
+ if (state.biologicalSex) {
618
+ identifier["biologicalSex"] = state.biologicalSex;
619
+ } else if (identifier.taxon === "NCBITaxon:9606") {
620
+ //For backward compatibility
621
+ identifier["biologicalSex"] ="PATO:0000384";
622
+ }
623
+ } else {
624
+ // Set the bioloicalSex now if map is not resumed from
625
+ // a saved state
626
+ if (this.biologicalSex) {
627
+ identifier["biologicalSex"] = this.biologicalSex;
628
+ }
601
629
  }
602
630
 
603
631
  let promise1 = this.mapManager.loadMap(
604
- entry,
632
+ identifier,
605
633
  this.$refs.display,
606
634
  this.eventCallback(),
607
635
  {
@@ -633,7 +661,7 @@ export default {
633
661
  this.mapImp.setState(state.viewport);
634
662
  });
635
663
  } else if (state) {
636
- if ((this.flatmapId == state.flatmapId) || this.entry == state.entry)
664
+ if (this.entry == state.entry)
637
665
  this._viewportToBeSet = state.viewport;
638
666
  }
639
667
  },
@@ -675,7 +703,7 @@ export default {
675
703
  },
676
704
  props: {
677
705
  entry: String,
678
- flatmapId: String,
706
+ biologicalSex: String,
679
707
  featureInfo: {
680
708
  type: Boolean,
681
709
  default: false
@@ -780,9 +808,6 @@ export default {
780
808
  entry: function() {
781
809
  if (!this.state) this.createFlatmap();
782
810
  },
783
- flatmapId: function() {
784
- if (!this.state) this.createFlatmap();
785
- },
786
811
  helpMode: function(val) {
787
812
  this.setHelpMode(val);
788
813
  },
@@ -31,7 +31,7 @@
31
31
  :showLayer="showLayer"
32
32
  v-show="activeSpecies==key"
33
33
  :entry="item.taxo"
34
- :flatmap-id="item.id"
34
+ :biologicalSex="item.biologicalSex"
35
35
  :displayWarning="item.displayWarning"
36
36
  :warningMessage="warningMessage"
37
37
  :displayLatestChanges="item.displayLatestChanges"
@@ -88,18 +88,20 @@ export default {
88
88
  fetch(this.flatmapAPI)
89
89
  .then(response => response.json())
90
90
  .then(data => {
91
- this.speciesLis= {};
91
+ this.speciesList= {};
92
92
  Object.keys(this.availableSpecies).forEach(key => {
93
93
  for (let i = 0; i < data.length; i++) {
94
- if (this.availableSpecies[key].id === data[i].id) {
95
- this.speciesList[key] = this.availableSpecies[key];
96
- break;
97
- }
98
94
  if (this.availableSpecies[key].taxo === data[i].taxon) {
99
- this.speciesList[key] = this.availableSpecies[key];
100
- //make sure the id is unset as it fails to match the one on
101
- this.speciesList[key].id = undefined;
102
- break;
95
+ if (this.availableSpecies[key].biologicalSex) {
96
+ if (data[i].biologicalSex &&
97
+ data[i].biologicalSex === this.availableSpecies[key].biologicalSex) {
98
+ this.speciesList[key] = this.availableSpecies[key];
99
+ break;
100
+ }
101
+ } else {
102
+ this.speciesList[key] = this.availableSpecies[key];
103
+ break;
104
+ }
103
105
  }
104
106
  }
105
107
  });