@abi-software/flatmapvuer 1.19.1-demo.0 → 1.20.0

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/src/App.vue CHANGED
@@ -247,6 +247,9 @@ export default {
247
247
  taxo: 'UBERON:0001759',
248
248
  uuid: '0ea568ec-538d-52f3-a8e7-0437d844e1cf',
249
249
  },
250
+ FC: {
251
+ uuid: '0525bdec-ce68-5230-b10e-bdde3269e55f',
252
+ },
250
253
  Sample: { taxo: 'NCBITaxon:1', displayWarning: true },
251
254
  'Functional Connectivity': {
252
255
  taxo: 'FunctionalConnectivity',
@@ -273,8 +276,8 @@ export default {
273
276
  mapSettings: [],
274
277
  //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v2/"
275
278
  //flatmapAPI: "https://mapcore-demo.org/devel/flatmap/v3/"
276
- //flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/",
277
- flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
279
+ flatmapAPI: "https://mapcore-demo.org/current/flatmap/v3/",
280
+ //flatmapAPI: 'https://mapcore-demo.org/devel/flatmap/v4/',
278
281
  //flatmapAPI: 'https://mapcore-demo.org/curation/flatmap/',
279
282
  //flatmapAPI: "https://mapcore-demo.org/fccb/flatmap/"
280
283
  //flatmapAPI: "https://mapcore-demo.org/staging/flatmap/v1/"
@@ -557,7 +557,6 @@ import { capitalise, normaliseAlertToStringArray } from './utilities.js';
557
557
  import yellowstar from '../icons/yellowstar';
558
558
  import ResizeSensor from 'css-element-queries/src/ResizeSensor';
559
559
  import flatmap from '../services/flatmapLoader.js';
560
- import { attachSomaLocationMarkerMethods } from '../services/somaLocationMarkers.js';
561
560
  import { AnnotationService } from '@abi-software/sparc-annotation';
562
561
  import { mapState } from 'pinia';
563
562
  import { useMainStore } from '@/store/index';
@@ -2787,7 +2786,7 @@ export default {
2787
2786
  });
2788
2787
  promise1
2789
2788
  .then((returnedObject) => {
2790
- this.mapImp = attachSomaLocationMarkerMethods(returnedObject);
2789
+ this.mapImp = returnedObject;
2791
2790
  this.serverURL = this.mapImp.makeServerUrl('').slice(0, -1);
2792
2791
  let mapVersion = this.mapImp.details.version;
2793
2792
  this.setFlightPathInfo(mapVersion);
@@ -123,6 +123,7 @@ let FlatmapQueries = function () {
123
123
  this.singleConnectivityList = [];
124
124
  this.hasSingleConnectivityList = false;
125
125
  this.rawURLs = [];
126
+ this.expertConsultants = [];
126
127
  this.controller = undefined;
127
128
  this.uberons = [];
128
129
  this.lookUp = [];
@@ -167,6 +168,7 @@ let FlatmapQueries = function () {
167
168
  title: eventData.label,
168
169
  featureId: eventData.resource,
169
170
  hyperlinks: hyperlinks,
171
+ 'expert-consultants': this.expertConsultants,
170
172
  provenanceTaxonomy: eventData.provenanceTaxonomy,
171
173
  provenanceTaxonomyLabel: taxonomyLabel,
172
174
  connectivitySource: this.connectivitySource,
@@ -317,6 +319,7 @@ let FlatmapQueries = function () {
317
319
  this.componentsCombinations = [];
318
320
  this.singleConnectivityList = [];
319
321
  this.rawURLs = [];
322
+ this.expertConsultants = [];
320
323
  if (!keastIds || keastIds.length === 0 || !keastIds[0]) return;
321
324
 
322
325
  let prom1 = await this.queryForConnectivityNew(mapImp, keastIds[0]); // This on returns a promise so dont need 'await'
@@ -362,6 +365,9 @@ let FlatmapQueries = function () {
362
365
  // with publications from both PubMed and Others
363
366
  this.rawURLs = [...response.references];
364
367
  }
368
+ if (response['expert-consultants']) {
369
+ this.expertConsultants = [...response['expert-consultants']];
370
+ }
365
371
  resolve(processedConnectivity);
366
372
  });
367
373
  } else resolve(connectivity);
@@ -383,6 +389,9 @@ let FlatmapQueries = function () {
383
389
  // with publications from both PubMed and Others
384
390
  this.rawURLs = [...fallbackResponse.references];
385
391
  }
392
+ if (fallbackResponse['expert-consultants']) {
393
+ this.expertConsultants = [...fallbackResponse['expert-consultants']];
394
+ }
386
395
  resolve(processedConnectivity);
387
396
  });
388
397
  } else resolve(connectivity);
@@ -1,129 +0,0 @@
1
- const SOMA_MARKER_COLOUR = '#1b7f6b';
2
- const SOMA_MARKER_SECONDARY_COLOUR = '#f4f1de';
3
- const SOMA_MARKER_TEXT_COLOUR = '#12312b';
4
- const SOMA_MARKER_MAX_COUNT_LABEL = '99+';
5
-
6
- const normalizeSomaLocations = function (somaLocations) {
7
- return (Array.isArray(somaLocations) ? somaLocations : [])
8
- .map((item) => ({
9
- label: String(item?.label || '').trim(),
10
- curie: String(item?.curie || '').trim(),
11
- count: Number(item?.count || 0),
12
- }))
13
- .filter((item) => item.curie && item.count > 0);
14
- };
15
-
16
- const formatCount = function (count) {
17
- if (count > 99) return SOMA_MARKER_MAX_COUNT_LABEL;
18
- return String(count);
19
- };
20
-
21
- const createSomaLocationMarkerElement = function (somaLocation) {
22
- const wrapper = document.createElement('div');
23
- wrapper.className = 'flatmapvuer-soma-location-marker';
24
- wrapper.title = somaLocation.label || somaLocation.curie;
25
- wrapper.style.width = '34px';
26
- wrapper.style.height = '48px';
27
- wrapper.style.display = 'flex';
28
- wrapper.style.alignItems = 'center';
29
- wrapper.style.justifyContent = 'center';
30
- wrapper.style.transform = 'translate(-50%, -100%)';
31
-
32
- const countLabel = formatCount(somaLocation.count);
33
- wrapper.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 27 42" width="34" height="48" aria-hidden="true">
34
- <ellipse style="fill: rgb(0, 0, 0); fill-opacity: 0.18;" cx="12" cy="36" rx="8" ry="4"/>
35
- <path d="M12.25.25a12.254 12.254 0 0 0-12 12.494
36
- c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0
37
- C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z"
38
- style="fill:${SOMA_MARKER_COLOUR};stroke:${SOMA_MARKER_SECONDARY_COLOUR};stroke-width:1.1"/>
39
- <circle cx="12.5" cy="12.5" r="8" fill="${SOMA_MARKER_SECONDARY_COLOUR}"/>
40
- <text x="12.5" y="16.1" text-anchor="middle" style="font-size:7.5px;font-weight:700;fill:${SOMA_MARKER_TEXT_COLOUR};font-family:Arial, sans-serif">${countLabel}</text>
41
- </svg>`;
42
-
43
- return wrapper;
44
- };
45
-
46
- const resolveMarkerPlacement = function (mapImp, curie) {
47
- const featureIds = Array.isArray(mapImp?.modelFeatureIds?.(curie))
48
- ? mapImp.modelFeatureIds(curie)
49
- : [];
50
- const placements = [];
51
- const seenFeatureUris = new Set();
52
-
53
- for (const featureId of featureIds) {
54
- const annotation = mapImp.annotation(featureId);
55
- const featureUri = String(annotation?.uri || '').trim();
56
- if (featureUri && !seenFeatureUris.has(featureUri)) {
57
- seenFeatureUris.add(featureUri);
58
- placements.push({
59
- type: 'feature-uri',
60
- value: featureUri,
61
- });
62
- }
63
- }
64
-
65
- // Fall back to model placement only when no feature URI can be resolved.
66
- if (!placements.length && featureIds.length) {
67
- placements.push({
68
- type: 'model',
69
- value: curie,
70
- });
71
- }
72
-
73
- return placements;
74
- };
75
-
76
- export const attachSomaLocationMarkerMethods = function (mapImp) {
77
- if (!mapImp || mapImp.addSomaLocationMarkers) {
78
- return mapImp;
79
- }
80
-
81
- let markerIds = [];
82
-
83
- mapImp.clearSomaLocationMarkers = function () {
84
- markerIds.forEach((markerId) => {
85
- mapImp.removeMarker(markerId);
86
- });
87
- markerIds = [];
88
- };
89
-
90
- mapImp.addSomaLocationMarkers = function (somaLocations) {
91
- const normalizedSomaLocations = normalizeSomaLocations(somaLocations);
92
- const placedSomaLocations = [];
93
-
94
- mapImp.clearSomaLocationMarkers();
95
-
96
- normalizedSomaLocations.forEach((somaLocation) => {
97
- const placements = resolveMarkerPlacement(mapImp, somaLocation.curie);
98
- if (!placements.length) return;
99
-
100
- let somaLocationPlaced = false;
101
- placements.forEach((placement) => {
102
- const markerElement = createSomaLocationMarkerElement(somaLocation);
103
- let addedMarkerIds = [];
104
-
105
- if (placement.type === 'feature-uri') {
106
- addedMarkerIds = mapImp.addMarkerByFeatureUri(placement.value, {
107
- element: markerElement,
108
- });
109
- } else if (placement.type === 'model') {
110
- const markerId = mapImp.addMarker(placement.value, { element: markerElement });
111
- addedMarkerIds = markerId > -1 ? [markerId] : [];
112
- }
113
-
114
- if (!addedMarkerIds.length) return;
115
-
116
- markerIds.push(...addedMarkerIds);
117
- somaLocationPlaced = true;
118
- });
119
-
120
- if (somaLocationPlaced) {
121
- placedSomaLocations.push(somaLocation);
122
- }
123
- });
124
-
125
- return placedSomaLocations;
126
- };
127
-
128
- return mapImp;
129
- };