From ec222dcec8b444b39b62d38e6104ff9e5a750e52 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 24 Feb 2026 11:13:56 +1300 Subject: [PATCH 1/7] Add single connectivity combination in connectivity list data --- src/services/flatmapQueries.js | 78 ++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 59094d84..b908daa3 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -1,4 +1,6 @@ /* eslint-disable no-alert, no-console */ +import { querySingleConnectivityList } from '@abi-software/map-utilities'; + // remove duplicates by stringifying the objects const removeDuplicates = function (arrayOfAnything) { if (!arrayOfAnything) return [] @@ -99,6 +101,14 @@ let FlatmapQueries = function () { this.destinations = [] this.origins = [] this.components = [] + this.destinationsWithDatasets = [] + this.originsWithDatasets = [] + this.componentsWithDatasets = [] + this.destinationsCombinations = [] + this.originsCombinations = [] + this.componentsCombinations = [] + this.singleConnectivityList = null + this.hasSingleConnectivityList = false this.rawURLs = [] this.controller = undefined this.uberons = [] @@ -140,6 +150,10 @@ let FlatmapQueries = function () { destinationsWithDatasets: this.destinationsWithDatasets, originsWithDatasets: this.originsWithDatasets, componentsWithDatasets: this.componentsWithDatasets, + destinationsCombinations: this.destinationsCombinations, + originsCombinations: this.originsCombinations, + componentsCombinations: this.componentsCombinations, + hasSingleConnectivityList: this.singleConnectivityList?.results?.values?.length > 0, title: eventData.label, featureId: eventData.resource, hyperlinks: hyperlinks, @@ -160,6 +174,9 @@ let FlatmapQueries = function () { componentsWithDatasets: this.componentsWithDatasets, destinations: this.destinations, destinationsWithDatasets: this.destinationsWithDatasets, + destinationsCombinations: this.destinationsCombinations, + originsCombinations: this.originsCombinations, + componentsCombinations: this.componentsCombinations, connectivitySource: this.connectivitySource, noMapConnectivity: this.noMapConnectivity, }; @@ -285,16 +302,35 @@ let FlatmapQueries = function () { this.destinations = [] this.origins = [] this.components = [] + this.destinationsWithDatasets = [] + this.originsWithDatasets = [] + this.componentsWithDatasets = [] + this.destinationsCombinations = [] + this.originsCombinations = [] + this.componentsCombinations = [] + this.singleConnectivityList = null this.rawURLs = [] if (!keastIds || keastIds.length === 0 || !keastIds[0]) return - let prom1 = this.queryForConnectivityNew(mapImp, keastIds[0]) // This on returns a promise so dont need 'await' + let prom1 = await this.queryForConnectivityNew(mapImp, keastIds[0]) // This on returns a promise so dont need 'await' let results = await Promise.all([prom1]) return results } - this.queryForConnectivityNew = function (mapImp, keastId, connectivitySource = 'map', processConnectivity = true) { - this.connectivitySource = connectivitySource + this.queryForConnectivityNew = async function (mapImp, keastId, connectivitySource = 'map', processConnectivity = true) { + // TODO: Temporary for testing + const newService = ( + keastId === 'ilxtr:sparc-nlp/kidney/132' || + keastId === 'ilxtr:neuron-type-bromo-2' || + keastId === 'ilxtr:sparc-nlp/mmset1/12' + ) + connectivitySource = newService ? 'sckan' : connectivitySource + this.connectivitySource = newService ? 'sckan' : connectivitySource + + if (newService) { + this.singleConnectivityList = await querySingleConnectivityList(mapImp.mapMetadata.uuid, keastId); + } + return new Promise((resolve) => { const queryAPI = connectivitySource === 'map' ? this.queryMapConnectivity(mapImp.mapMetadata.uuid, keastId) @@ -485,6 +521,42 @@ let FlatmapQueries = function () { this.destinationsWithDatasets = this.uberons.filter( (ub) => axonsFlat.indexOf(ub.id) !== -1 ).sort(compareNames); + + // Get combinations of SCKAN and Map + if (this.singleConnectivityList?.results?.values?.length > 0) { + this.singleConnectivityList.results.values.forEach((value) => { + const sckanNodeId = value[2] ? this.flattenConnectivity(JSON.parse(value[2]))[0] : ''; + const sckanNodeLabel = value[3]; + const mapNodeId = value[5] ? this.flattenConnectivity(JSON.parse(value[5]))[0] : ''; + const mapNodeLabel = value[6]; + + // The base ID is SCKAN ID + if (axonsFlat.includes(sckanNodeId)) { + this.destinationsCombinations.push({ + sckanId: sckanNodeId, + sckanLabel: sckanNodeLabel, + mapId: mapNodeId, + mapLabel: mapNodeLabel, + }) + } + if (dendritesFlat.includes(sckanNodeId)) { + this.originsCombinations.push({ + sckanId: sckanNodeId, + sckanLabel: sckanNodeLabel, + mapId: mapNodeId, + mapLabel: mapNodeLabel, + }) + } + if (componentsFlat.includes(sckanNodeId)) { + this.componentsCombinations.push({ + sckanId: sckanNodeId, + sckanLabel: sckanNodeLabel, + mapId: mapNodeId, + mapLabel: mapNodeLabel, + }) + } + }); + } } this.processConnectivity = function (mapImp, connectivity) { From 5b9db330cdd5b977d27d82326f18c75f488f93c6 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 24 Feb 2026 12:47:22 +1300 Subject: [PATCH 2/7] Fix connectivity combination keys --- src/services/flatmapQueries.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index b908daa3..1da766a0 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -525,13 +525,13 @@ let FlatmapQueries = function () { // Get combinations of SCKAN and Map if (this.singleConnectivityList?.results?.values?.length > 0) { this.singleConnectivityList.results.values.forEach((value) => { - const sckanNodeId = value[2] ? this.flattenConnectivity(JSON.parse(value[2]))[0] : ''; + const sckanNodeId = value[2] ? JSON.parse(value[2]) : null; const sckanNodeLabel = value[3]; - const mapNodeId = value[5] ? this.flattenConnectivity(JSON.parse(value[5]))[0] : ''; + const mapNodeId = value[5] ? JSON.parse(value[5]) : null; const mapNodeLabel = value[6]; // The base ID is SCKAN ID - if (axonsFlat.includes(sckanNodeId)) { + if (axons.find(axon => JSON.stringify(axon) === JSON.stringify(sckanNodeId))) { this.destinationsCombinations.push({ sckanId: sckanNodeId, sckanLabel: sckanNodeLabel, @@ -539,7 +539,7 @@ let FlatmapQueries = function () { mapLabel: mapNodeLabel, }) } - if (dendritesFlat.includes(sckanNodeId)) { + if (dendrites.find(dendrite => JSON.stringify(dendrite) === JSON.stringify(sckanNodeId))) { this.originsCombinations.push({ sckanId: sckanNodeId, sckanLabel: sckanNodeLabel, @@ -547,7 +547,7 @@ let FlatmapQueries = function () { mapLabel: mapNodeLabel, }) } - if (componentsFlat.includes(sckanNodeId)) { + if (components.find(component => JSON.stringify(component) === JSON.stringify(sckanNodeId))) { this.componentsCombinations.push({ sckanId: sckanNodeId, sckanLabel: sckanNodeLabel, From 154ae3b54ba047bd2671ffc999cb443ab976c344 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Wed, 25 Feb 2026 12:32:38 +1300 Subject: [PATCH 3/7] Emit error message only if there is an error --- src/components/FlatmapVuer.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/FlatmapVuer.vue b/src/components/FlatmapVuer.vue index ed75cfac..62c78302 100644 --- a/src/components/FlatmapVuer.vue +++ b/src/components/FlatmapVuer.vue @@ -1943,7 +1943,9 @@ export default { } // Emit error message for connectivity - this.emitConnectivityError(errorData); + if (errorData.length) { + this.emitConnectivityError(errorData); + } // highlight all available features const connectivityFeatures = featuresToHighlight.reduce((arr, path) => { From 8959249be7afcda33754cdf3b5a613535309a5d9 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Wed, 25 Feb 2026 12:33:43 +1300 Subject: [PATCH 4/7] Update connectivity single combination listing --- src/services/flatmapQueries.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 1da766a0..6bdf19ae 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -525,9 +525,9 @@ let FlatmapQueries = function () { // Get combinations of SCKAN and Map if (this.singleConnectivityList?.results?.values?.length > 0) { this.singleConnectivityList.results.values.forEach((value) => { - const sckanNodeId = value[2] ? JSON.parse(value[2]) : null; + const sckanNodeId = value[2] ? JSON.parse(value[2]) : []; const sckanNodeLabel = value[3]; - const mapNodeId = value[5] ? JSON.parse(value[5]) : null; + const mapNodeId = value[5] ? JSON.parse(value[5]) : []; const mapNodeLabel = value[6]; // The base ID is SCKAN ID @@ -538,6 +538,15 @@ let FlatmapQueries = function () { mapId: mapNodeId, mapLabel: mapNodeLabel, }) + mapNodeId.forEach((id, i) => { + const stringId = typeof id === 'string' ? id : id[0]; + if (stringId) { + this.destinationsWithDatasets.push({ + id: stringId, + name: mapNodeLabel.split(',')[i] + }); + } + }); } if (dendrites.find(dendrite => JSON.stringify(dendrite) === JSON.stringify(sckanNodeId))) { this.originsCombinations.push({ @@ -546,6 +555,15 @@ let FlatmapQueries = function () { mapId: mapNodeId, mapLabel: mapNodeLabel, }) + mapNodeId.forEach((id, i) => { + const stringId = typeof id === 'string' ? id : id[0]; + if (stringId) { + this.originsWithDatasets.push({ + id: stringId, + name: mapNodeLabel.split(',')[i] + }); + } + }); } if (components.find(component => JSON.stringify(component) === JSON.stringify(sckanNodeId))) { this.componentsCombinations.push({ @@ -554,6 +572,15 @@ let FlatmapQueries = function () { mapId: mapNodeId, mapLabel: mapNodeLabel, }) + mapNodeId.forEach((id, i) => { + const stringId = typeof id === 'string' ? id : id[0]; + if (stringId) { + this.componentsWithDatasets.push({ + id: stringId, + name: mapNodeLabel.split(',')[i] + }); + } + }); } }); } From 848289920150ca85a54f2b3412b45ca86d9200fc Mon Sep 17 00:00:00 2001 From: akhuoa Date: Mon, 2 Mar 2026 17:24:28 +1300 Subject: [PATCH 5/7] Update connectivity query --- src/services/flatmapQueries.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 6bdf19ae..4675e0a0 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -525,10 +525,7 @@ let FlatmapQueries = function () { // Get combinations of SCKAN and Map if (this.singleConnectivityList?.results?.values?.length > 0) { this.singleConnectivityList.results.values.forEach((value) => { - const sckanNodeId = value[2] ? JSON.parse(value[2]) : []; - const sckanNodeLabel = value[3]; - const mapNodeId = value[5] ? JSON.parse(value[5]) : []; - const mapNodeLabel = value[6]; + const { sckanNodeId, sckanNodeLabel, mapNodeId, mapNodeLabel } = value; // The base ID is SCKAN ID if (axons.find(axon => JSON.stringify(axon) === JSON.stringify(sckanNodeId))) { From ef7c257172761df23b9ccedfc7a409a1f5635926 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Mon, 2 Mar 2026 17:43:18 +1300 Subject: [PATCH 6/7] Update testing data for temporary map uuid --- src/services/flatmapQueries.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 4675e0a0..8acf1816 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -319,16 +319,12 @@ let FlatmapQueries = function () { this.queryForConnectivityNew = async function (mapImp, keastId, connectivitySource = 'map', processConnectivity = true) { // TODO: Temporary for testing - const newService = ( - keastId === 'ilxtr:sparc-nlp/kidney/132' || - keastId === 'ilxtr:neuron-type-bromo-2' || - keastId === 'ilxtr:sparc-nlp/mmset1/12' - ) - connectivitySource = newService ? 'sckan' : connectivitySource - this.connectivitySource = newService ? 'sckan' : connectivitySource + const newService = mapImp.mapMetadata.uuid === 'e35298a5-ca44-5882-974f-874a1c393cad'; + connectivitySource = newService ? 'sckan' : connectivitySource; + this.connectivitySource = newService ? 'sckan' : connectivitySource; if (newService) { - this.singleConnectivityList = await querySingleConnectivityList(mapImp.mapMetadata.uuid, keastId); + this.singleConnectivityList = await querySingleConnectivityList(this.flatmapAPI, mapImp.mapMetadata.uuid, keastId); } return new Promise((resolve) => { From f419689df30e32da2bfa6a007a1cc51910a21530 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Tue, 3 Mar 2026 10:36:07 +1300 Subject: [PATCH 7/7] Update single connectivity listing test data --- src/services/flatmapQueries.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/services/flatmapQueries.js b/src/services/flatmapQueries.js index 8acf1816..902540e5 100644 --- a/src/services/flatmapQueries.js +++ b/src/services/flatmapQueries.js @@ -107,7 +107,7 @@ let FlatmapQueries = function () { this.destinationsCombinations = [] this.originsCombinations = [] this.componentsCombinations = [] - this.singleConnectivityList = null + this.singleConnectivityList = [] this.hasSingleConnectivityList = false this.rawURLs = [] this.controller = undefined @@ -153,7 +153,7 @@ let FlatmapQueries = function () { destinationsCombinations: this.destinationsCombinations, originsCombinations: this.originsCombinations, componentsCombinations: this.componentsCombinations, - hasSingleConnectivityList: this.singleConnectivityList?.results?.values?.length > 0, + hasSingleConnectivityList: this.singleConnectivityList.length > 0, title: eventData.label, featureId: eventData.resource, hyperlinks: hyperlinks, @@ -308,7 +308,7 @@ let FlatmapQueries = function () { this.destinationsCombinations = [] this.originsCombinations = [] this.componentsCombinations = [] - this.singleConnectivityList = null + this.singleConnectivityList = [] this.rawURLs = [] if (!keastIds || keastIds.length === 0 || !keastIds[0]) return @@ -319,12 +319,14 @@ let FlatmapQueries = function () { this.queryForConnectivityNew = async function (mapImp, keastId, connectivitySource = 'map', processConnectivity = true) { // TODO: Temporary for testing - const newService = mapImp.mapMetadata.uuid === 'e35298a5-ca44-5882-974f-874a1c393cad'; + const newService = mapImp.id === 'human-flatmap_female'; + const tempMapUUID = 'e35298a5-ca44-5882-974f-874a1c393cad'; + const tempFlatmapAPI = 'https://napakalas-flatmap-demo.hf.space/'; connectivitySource = newService ? 'sckan' : connectivitySource; this.connectivitySource = newService ? 'sckan' : connectivitySource; if (newService) { - this.singleConnectivityList = await querySingleConnectivityList(this.flatmapAPI, mapImp.mapMetadata.uuid, keastId); + this.singleConnectivityList = await querySingleConnectivityList(tempFlatmapAPI, tempMapUUID, keastId); } return new Promise((resolve) => { @@ -519,8 +521,8 @@ let FlatmapQueries = function () { ).sort(compareNames); // Get combinations of SCKAN and Map - if (this.singleConnectivityList?.results?.values?.length > 0) { - this.singleConnectivityList.results.values.forEach((value) => { + if (this.singleConnectivityList.length > 0) { + this.singleConnectivityList.forEach((value) => { const { sckanNodeId, sckanNodeLabel, mapNodeId, mapNodeLabel } = value; // The base ID is SCKAN ID