@abi-software/flatmapvuer 1.19.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/dist/flatmapvuer.js +5 -4
- package/dist/flatmapvuer.umd.cjs +1 -1
- package/package.json +2 -2
- package/src/App.vue +5 -2
- package/src/services/flatmapQueries.js +9 -0
package/dist/flatmapvuer.js
CHANGED
|
@@ -8538,7 +8538,7 @@ var A_ = /*#__PURE__*/ n_(S_, [["render", k_], ["__scopeId", "data-v-3238f52a"]]
|
|
|
8538
8538
|
return i < a ? -1 : +(i > a);
|
|
8539
8539
|
}, R_ = function() {
|
|
8540
8540
|
this.initialise = function(e) {
|
|
8541
|
-
this.flatmapAPI = e, this.destinations = [], this.origins = [], this.components = [], this.destinationsWithDatasets = [], this.originsWithDatasets = [], this.componentsWithDatasets = [], this.destinationsCombinations = [], this.originsCombinations = [], this.componentsCombinations = [], this.singleConnectivityList = [], this.hasSingleConnectivityList = !1, this.rawURLs = [], this.controller = void 0, this.uberons = [], this.lookUp = [], this.connectivitySource = "map", this.noMapConnectivity = !1;
|
|
8541
|
+
this.flatmapAPI = e, this.destinations = [], this.origins = [], this.components = [], this.destinationsWithDatasets = [], this.originsWithDatasets = [], this.componentsWithDatasets = [], this.destinationsCombinations = [], this.originsCombinations = [], this.componentsCombinations = [], this.singleConnectivityList = [], this.hasSingleConnectivityList = !1, this.rawURLs = [], this.expertConsultants = [], this.controller = void 0, this.uberons = [], this.lookUp = [], this.connectivitySource = "map", this.noMapConnectivity = !1;
|
|
8542
8542
|
}, this.createTooltipData = async function(e, t) {
|
|
8543
8543
|
let n;
|
|
8544
8544
|
n = t.feature.hyperlinks && t.feature.hyperlinks.length > 0 ? t.feature.hyperlinks : this.rawURLs;
|
|
@@ -8569,6 +8569,7 @@ var A_ = /*#__PURE__*/ n_(S_, [["render", k_], ["__scopeId", "data-v-3238f52a"]]
|
|
|
8569
8569
|
title: t.label,
|
|
8570
8570
|
featureId: t.resource,
|
|
8571
8571
|
hyperlinks: n,
|
|
8572
|
+
"expert-consultants": this.expertConsultants,
|
|
8572
8573
|
provenanceTaxonomy: t.provenanceTaxonomy,
|
|
8573
8574
|
provenanceTaxonomyLabel: r,
|
|
8574
8575
|
connectivitySource: this.connectivitySource,
|
|
@@ -8633,7 +8634,7 @@ var A_ = /*#__PURE__*/ n_(S_, [["render", k_], ["__scopeId", "data-v-3238f52a"]]
|
|
|
8633
8634
|
}, this.retrieveFlatmapKnowledgeForEvent = async function(e, t) {
|
|
8634
8635
|
this.controller && this.controller.abort(), this.controller = new AbortController();
|
|
8635
8636
|
let n = t.resource;
|
|
8636
|
-
if (this.destinations = [], this.origins = [], this.components = [], this.destinationsWithDatasets = [], this.originsWithDatasets = [], this.componentsWithDatasets = [], this.destinationsCombinations = [], this.originsCombinations = [], this.componentsCombinations = [], this.singleConnectivityList = [], this.rawURLs = [], !n || n.length === 0 || !n[0]) return;
|
|
8637
|
+
if (this.destinations = [], this.origins = [], this.components = [], this.destinationsWithDatasets = [], this.originsWithDatasets = [], this.componentsWithDatasets = [], this.destinationsCombinations = [], this.originsCombinations = [], this.componentsCombinations = [], this.singleConnectivityList = [], this.rawURLs = [], this.expertConsultants = [], !n || n.length === 0 || !n[0]) return;
|
|
8637
8638
|
let r = await this.queryForConnectivityNew(e, n[0]);
|
|
8638
8639
|
return await Promise.all([r]);
|
|
8639
8640
|
}, this.queryForConnectivityNew = async function(e, t, n = "map", r = !0) {
|
|
@@ -8644,13 +8645,13 @@ var A_ = /*#__PURE__*/ n_(S_, [["render", k_], ["__scopeId", "data-v-3238f52a"]]
|
|
|
8644
8645
|
this.connectivitySource === "map" && (this.noMapConnectivity = !1);
|
|
8645
8646
|
let t = i;
|
|
8646
8647
|
r ? this.processConnectivity(e, t).then((e) => {
|
|
8647
|
-
i.references && (this.rawURLs = [...i.references]), n(e);
|
|
8648
|
+
i.references && (this.rawURLs = [...i.references]), i["expert-consultants"] && (this.expertConsultants = [...i["expert-consultants"]]), n(e);
|
|
8648
8649
|
}) : n(t);
|
|
8649
8650
|
} else this.connectivitySource === "map" ? (this.connectivitySource = "sckan", this.noMapConnectivity = !0, e.queryKnowledge(t).then((t) => {
|
|
8650
8651
|
if (this.checkConnectivityExists(t)) {
|
|
8651
8652
|
let i = t;
|
|
8652
8653
|
r ? this.processConnectivity(e, i).then((e) => {
|
|
8653
|
-
t.references && (this.rawURLs = [...t.references]), n(e);
|
|
8654
|
+
t.references && (this.rawURLs = [...t.references]), t["expert-consultants"] && (this.expertConsultants = [...t["expert-consultants"]]), n(e);
|
|
8654
8655
|
}) : n(i);
|
|
8655
8656
|
} else n(!1);
|
|
8656
8657
|
}).catch(() => n(!1))) : n(!1);
|
package/dist/flatmapvuer.umd.cjs
CHANGED
|
@@ -13,7 +13,7 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:i,curr
|
|
|
13
13
|
<circle cx="12.5" cy="12.5" r="9" fill="#fff"></circle>
|
|
14
14
|
<text x="12" y="17.5" style="font-size:14px;fill:#000;text-anchor:middle">2</text>
|
|
15
15
|
</svg>
|
|
16
|
-
</div>`,dg=function(e){return e?[...new Set(e.map(e=>JSON.stringify(e)))].map(e=>JSON.parse(e)):[]},fg=function(e){if(!e)return[];let t=new Set,n=[];return e.forEach(e=>{let{id:r,name:i}=e,a=`${r.toLowerCase()}:${i.toLowerCase()}`;t.has(a)||(t.add(a),n.push(e))}),n},pg=[],mg=async function(e,t){let n=t.filter(e=>pg.some(t=>t.taxon===e)),r=pg.filter(e=>n.includes(e.taxon)),i=t.filter(e=>!n.includes(e));if(i.length){let t=await e.queryLabels(i);if(t.length)return t.forEach(e=>{let{entity:t,label:n}=e;n===`Mammalia`&&(n=`Mammalia not otherwise specified`);let i={taxon:t,label:n};r.push(i),pg.push(i)}),r}else return r},hg=function(e,t){if(!e||!t)return!1;let n=JSON.stringify(e),r=JSON.stringify(t);return n.indexOf(r)!==-1},gg=(e,t)=>{let n=e.name??e,r=t.name??t,i=n.toUpperCase(),a=r.toUpperCase();return i<a?-1:+(i>a)},_g=function(){this.initialise=function(e){this.flatmapAPI=e,this.destinations=[],this.origins=[],this.components=[],this.destinationsWithDatasets=[],this.originsWithDatasets=[],this.componentsWithDatasets=[],this.destinationsCombinations=[],this.originsCombinations=[],this.componentsCombinations=[],this.singleConnectivityList=[],this.hasSingleConnectivityList=!1,this.rawURLs=[],this.controller=void 0,this.uberons=[],this.lookUp=[],this.connectivitySource=`map`,this.noMapConnectivity=!1},this.createTooltipData=async function(e,t){let n;n=t.feature.hyperlinks&&t.feature.hyperlinks.length>0?t.feature.hyperlinks:this.rawURLs;let r;if(t.provenanceTaxonomy){r=[];try{let n=await mg(e,t.provenanceTaxonomy);n.length&&n.forEach(e=>{let{label:t}=e;r.push(t)})}catch(e){console.log(e)}}return{destinations:this.destinations,origins:this.origins,components:this.components,destinationsWithDatasets:fg(this.destinationsWithDatasets),originsWithDatasets:fg(this.originsWithDatasets),componentsWithDatasets:fg(this.componentsWithDatasets),destinationsCombinations:this.destinationsCombinations,originsCombinations:this.originsCombinations,componentsCombinations:this.componentsCombinations,hasSingleConnectivityList:this.singleConnectivityList.length>0,title:t.label,featureId:t.resource,hyperlinks:n,provenanceTaxonomy:t.provenanceTaxonomy,provenanceTaxonomyLabel:r,connectivitySource:this.connectivitySource,noMapConnectivity:this.noMapConnectivity}},this.updateTooltipData=function(e){return{...e,origins:this.origins,originsWithDatasets:fg(this.originsWithDatasets),components:this.components,componentsWithDatasets:fg(this.componentsWithDatasets),destinations:this.destinations,destinationsWithDatasets:fg(this.destinationsWithDatasets),destinationsCombinations:this.destinationsCombinations,originsCombinations:this.originsCombinations,componentsCombinations:this.componentsCombinations,connectivitySource:this.connectivitySource,noMapConnectivity:this.noMapConnectivity}},this.createComponentsLabelList=function(e,t){let n=[];return e.forEach(e=>{n.push(this.createLabelFromNeuralNode(e[0]),t),e.length===2&&n.push(this.createLabelFromNeuralNode(e[1]),t)}),n},this.createLabelLookup=async function(e,t){let n={};this.uberons=[];let r=await mg(e,t);return r.length&&r.forEach(e=>{let{taxon:t,label:r}=e;n[t]=r,this.uberons.push({id:t,name:r})}),n},this.buildConnectivitySqlStatement=function(e){let t=`select knowledge from knowledge where entity in (`;if(e.length===1)t+=`'${e[0]}')`;else if(e.length>1)for(let n in e)t+=`'${e[n]}'${n>=e.length-1?`)`:`,`} `;return t},this.buildLabelSqlStatement=function(e){let t=`select entity, label from labels where entity in (`;if(e.length===1)t+=`'${e[0]}')`;else if(e.length>1)for(let n in e)t+=`'${e[n]}'${n>=e.length-1?`)`:`,`} `;return t},this.findAllIdsFromConnectivity=function(e){let t=e.connectivity.flat(),n=[...new Set(t)],r=[];return n.forEach(e=>{Array.isArray(e)?r.push(e.flat()):r.push(e)}),[...new Set(r.flat())]},this.flattenConnectivity=function(e){let t=e.flat(),n=[...new Set(t)],r=[];return n.forEach(e=>{Array.isArray(e)?r.push(e.flat()):r.push(e)}),r.flat()},this.findComponents=function(e,t,n,r){let i=dg(e.connectivity.flat()),a=[],o=!1;return i.forEach(e=>{o=!1,hg(t,e)&&(o=!0),r&&hg(r,e)&&(o=!0),hg(n,e)&&(o=!0),o||a.push(e)}),a},this.retrieveFlatmapKnowledgeForEvent=async function(e,t){this.controller&&this.controller.abort(),this.controller=new AbortController;let n=t.resource;if(this.destinations=[],this.origins=[],this.components=[],this.destinationsWithDatasets=[],this.originsWithDatasets=[],this.componentsWithDatasets=[],this.destinationsCombinations=[],this.originsCombinations=[],this.componentsCombinations=[],this.singleConnectivityList=[],this.rawURLs=[],!n||n.length===0||!n[0])return;let r=await this.queryForConnectivityNew(e,n[0]);return await Promise.all([r])},this.queryForConnectivityNew=async function(e,t,n=`map`,r=!0){let i=/^sckan-(\d{4})/.exec(e.knowledgeSource||``),o=(i?Number(i[1]):0)>=2026,s=e.mapMetadata.uuid,c=this.flatmapAPI;return this.connectivitySource=o?`sckan`:n,o&&(this.singleConnectivityList=await(0,a.querySingleConnectivityList)(c,s,t)),new Promise(n=>{(this.connectivitySource===`map`?this.queryMapConnectivity(e.mapMetadata.uuid,t):e.queryKnowledge(t)).then(i=>{if(this.checkConnectivityExists(i)){this.connectivitySource===`map`&&(this.noMapConnectivity=!1);let t=i;r?this.processConnectivity(e,t).then(e=>{i.references&&(this.rawURLs=[...i.references]),n(e)}):n(t)}else this.connectivitySource===`map`?(this.connectivitySource=`sckan`,this.noMapConnectivity=!0,e.queryKnowledge(t).then(t=>{if(this.checkConnectivityExists(t)){let i=t;r?this.processConnectivity(e,i).then(e=>{t.references&&(this.rawURLs=[...t.references]),n(e)}):n(i)}else n(!1)}).catch(()=>n(!1))):n(!1)}).catch(e=>{e.name===`AbortError`||console.warn(`Unable to get the knowledge for the entity ${t}.`),n(!1)})})},this.queryMapConnectivity=async function(e,t){let n=this.flatmapAPI+`flatmap/${e}/connectivity/${t}`;try{let e=await fetch(n);if(!e.ok)throw Error(`Response status: ${e.status}`);return await e.json()}catch(e){throw Error(e,{cause:e})}},this.queryForConnectivity=function(e,t,n,r=!0){let i={sql:this.buildConnectivitySqlStatement(t)},a={method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i),...n?{signal:n}:{}};return new Promise(t=>{fetch(`${this.flatmapAPI}knowledge/query/`,a).then(e=>e.json()).then(n=>{if(this.connectivityExists(n)){let i=JSON.parse(n.values[0][0]);r?this.processConnectivity(e,i).then(e=>{t(e)}):t(i)}else t(!1)}).catch(e=>{e.name===`AbortError`||console.error(`Error:`,e),t(!1)})})},this.checkConnectivityExists=function(e){return e&&e.connectivity?.length},this.connectivityExists=function(e){return!!(e.values&&e.values.length>0&&JSON.parse(e.values[0][0]).connectivity&&JSON.parse(e.values[0][0]).connectivity.length>0)},this.findIfNodeIsSingle=function(e){return e.length===1?(console.error(`Server returns a single node`,e),e[0]):e.length===2&&e[1].length===0&&e[0]},this.createLabelFromNeuralNode=function(e,t){let n=this.findIfNodeIsSingle(e);if(n)return t[n];let r=t[e[0]];return e.length===2&&e[1].length>0&&e[1].forEach(e=>{t[e]==null?r+=`, ${e}`:r+=`, ${t[e]}`}),r},this.flattenAndFindDatasets=function(e,t,n){let r=this.flattenConnectivity(e),i=this.flattenConnectivity(t),a=this.flattenConnectivity(n);this.originsWithDatasets=this.uberons.filter(e=>r.indexOf(e.id)!==-1).sort(gg),this.componentsWithDatasets=this.uberons.filter(e=>i.indexOf(e.id)!==-1).sort(gg),this.destinationsWithDatasets=this.uberons.filter(e=>a.indexOf(e.id)!==-1).sort(gg),this.singleConnectivityList.length>0&&this.singleConnectivityList.forEach(r=>{let{sckanNodeId:i,sckanNodeLabel:a,mapNodeId:o,mapNodeLabel:s}=r;n.find(e=>JSON.stringify(e)===JSON.stringify(i))&&(this.destinationsCombinations.push({sckanId:i,sckanLabel:a,mapId:o,mapLabel:s}),o.forEach((e,t)=>{let n=typeof e==`string`?e:e[0];n&&this.destinationsWithDatasets.push({id:n,name:s.split(`,`)[t]})})),e.find(e=>JSON.stringify(e)===JSON.stringify(i))&&(this.originsCombinations.push({sckanId:i,sckanLabel:a,mapId:o,mapLabel:s}),o.forEach((e,t)=>{let n=typeof e==`string`?e:e[0];n&&this.originsWithDatasets.push({id:n,name:s.split(`,`)[t]})})),t.find(e=>JSON.stringify(e)===JSON.stringify(i))&&(this.componentsCombinations.push({sckanId:i,sckanLabel:a,mapId:o,mapLabel:s}),o.forEach((e,t)=>{let n=typeof e==`string`?e:e[0];n&&this.componentsWithDatasets.push({id:n,name:s.split(`,`)[t]})}))})},this.processConnectivity=function(e,t){return new Promise(n=>{let r=[],i=[],a;t&&t[`node-phenotypes`]?([`ilxtr:hasSomaLocatedIn`].forEach(e=>{e in t[`node-phenotypes`]&&r.push(...t[`node-phenotypes`][e])}),r=dg(r),[`ilxtr:hasAxonPresynapticElementIn`,`ilxtr:hasAxonSensorySubcellularElementIn`].forEach(e=>{e in t[`node-phenotypes`]&&i.push(...t[`node-phenotypes`][e])}),i=dg(i)):(i=dg(t.axons),t.somas&&t.somas.length>0&&r.push(...t.somas),t.dendrites&&t.dendrites.length>0&&r.push(...t.dendrites),r=dg(r),a=t.somas);let o=this.findComponents(t,i,r,a),s=this.findAllIdsFromConnectivity(t);this.createLabelLookup(e,s).then(e=>{this.origins=r.map(t=>this.createLabelFromNeuralNode(t,e)).sort(gg),this.components=o.map(t=>this.createLabelFromNeuralNode(t,e)).sort(gg),this.destinations=i.map(t=>this.createLabelFromNeuralNode(t,e)).sort(gg),this.flattenAndFindDatasets(r,o,i),n({ids:{dendrites:r,components:o,axons:i},labels:{origins:this.origins,components:this.components,destinations:this.destinations}})})})},this.buildPubmedSqlStatement=function(e){let t=`select distinct publication from publications where entity in (`;if(e.length===1)t+=`'${e[0]}')`;else if(e.length>1)for(let n in e)t+=`'${e[n]}'${n>=e.length-1?`)`:`,`} `;return t},this.buildPubmedSqlStatementForModels=function(e){return`select distinct publication from publications where entity = '${e}'`},this.queryKnowledge=async(e,t)=>{let n=`${this.flatmapAPI}knowledge/query/`,r=await fetch(n,{method:`POST`,headers:{Accept:`application/json`},body:JSON.stringify({sql:e,params:t})});if(!r.ok)throw Error(`Cannot access ${n}`);let i=await r.json();if(`error`in i)throw TypeError(i.error);return i.values}};async function vg(e){let t=sessionStorage.getItem(`flatmap-knowledge`);if(t){let n=JSON.parse(t).filter(e=>e.references&&e.references.length).filter(t=>t.references.includes(e));if(n.length)return n.map(e=>e.id)}return[]}async function yg(e,t,n){let r=`select knowledge from knowledge
|
|
16
|
+
</div>`,dg=function(e){return e?[...new Set(e.map(e=>JSON.stringify(e)))].map(e=>JSON.parse(e)):[]},fg=function(e){if(!e)return[];let t=new Set,n=[];return e.forEach(e=>{let{id:r,name:i}=e,a=`${r.toLowerCase()}:${i.toLowerCase()}`;t.has(a)||(t.add(a),n.push(e))}),n},pg=[],mg=async function(e,t){let n=t.filter(e=>pg.some(t=>t.taxon===e)),r=pg.filter(e=>n.includes(e.taxon)),i=t.filter(e=>!n.includes(e));if(i.length){let t=await e.queryLabels(i);if(t.length)return t.forEach(e=>{let{entity:t,label:n}=e;n===`Mammalia`&&(n=`Mammalia not otherwise specified`);let i={taxon:t,label:n};r.push(i),pg.push(i)}),r}else return r},hg=function(e,t){if(!e||!t)return!1;let n=JSON.stringify(e),r=JSON.stringify(t);return n.indexOf(r)!==-1},gg=(e,t)=>{let n=e.name??e,r=t.name??t,i=n.toUpperCase(),a=r.toUpperCase();return i<a?-1:+(i>a)},_g=function(){this.initialise=function(e){this.flatmapAPI=e,this.destinations=[],this.origins=[],this.components=[],this.destinationsWithDatasets=[],this.originsWithDatasets=[],this.componentsWithDatasets=[],this.destinationsCombinations=[],this.originsCombinations=[],this.componentsCombinations=[],this.singleConnectivityList=[],this.hasSingleConnectivityList=!1,this.rawURLs=[],this.expertConsultants=[],this.controller=void 0,this.uberons=[],this.lookUp=[],this.connectivitySource=`map`,this.noMapConnectivity=!1},this.createTooltipData=async function(e,t){let n;n=t.feature.hyperlinks&&t.feature.hyperlinks.length>0?t.feature.hyperlinks:this.rawURLs;let r;if(t.provenanceTaxonomy){r=[];try{let n=await mg(e,t.provenanceTaxonomy);n.length&&n.forEach(e=>{let{label:t}=e;r.push(t)})}catch(e){console.log(e)}}return{destinations:this.destinations,origins:this.origins,components:this.components,destinationsWithDatasets:fg(this.destinationsWithDatasets),originsWithDatasets:fg(this.originsWithDatasets),componentsWithDatasets:fg(this.componentsWithDatasets),destinationsCombinations:this.destinationsCombinations,originsCombinations:this.originsCombinations,componentsCombinations:this.componentsCombinations,hasSingleConnectivityList:this.singleConnectivityList.length>0,title:t.label,featureId:t.resource,hyperlinks:n,"expert-consultants":this.expertConsultants,provenanceTaxonomy:t.provenanceTaxonomy,provenanceTaxonomyLabel:r,connectivitySource:this.connectivitySource,noMapConnectivity:this.noMapConnectivity}},this.updateTooltipData=function(e){return{...e,origins:this.origins,originsWithDatasets:fg(this.originsWithDatasets),components:this.components,componentsWithDatasets:fg(this.componentsWithDatasets),destinations:this.destinations,destinationsWithDatasets:fg(this.destinationsWithDatasets),destinationsCombinations:this.destinationsCombinations,originsCombinations:this.originsCombinations,componentsCombinations:this.componentsCombinations,connectivitySource:this.connectivitySource,noMapConnectivity:this.noMapConnectivity}},this.createComponentsLabelList=function(e,t){let n=[];return e.forEach(e=>{n.push(this.createLabelFromNeuralNode(e[0]),t),e.length===2&&n.push(this.createLabelFromNeuralNode(e[1]),t)}),n},this.createLabelLookup=async function(e,t){let n={};this.uberons=[];let r=await mg(e,t);return r.length&&r.forEach(e=>{let{taxon:t,label:r}=e;n[t]=r,this.uberons.push({id:t,name:r})}),n},this.buildConnectivitySqlStatement=function(e){let t=`select knowledge from knowledge where entity in (`;if(e.length===1)t+=`'${e[0]}')`;else if(e.length>1)for(let n in e)t+=`'${e[n]}'${n>=e.length-1?`)`:`,`} `;return t},this.buildLabelSqlStatement=function(e){let t=`select entity, label from labels where entity in (`;if(e.length===1)t+=`'${e[0]}')`;else if(e.length>1)for(let n in e)t+=`'${e[n]}'${n>=e.length-1?`)`:`,`} `;return t},this.findAllIdsFromConnectivity=function(e){let t=e.connectivity.flat(),n=[...new Set(t)],r=[];return n.forEach(e=>{Array.isArray(e)?r.push(e.flat()):r.push(e)}),[...new Set(r.flat())]},this.flattenConnectivity=function(e){let t=e.flat(),n=[...new Set(t)],r=[];return n.forEach(e=>{Array.isArray(e)?r.push(e.flat()):r.push(e)}),r.flat()},this.findComponents=function(e,t,n,r){let i=dg(e.connectivity.flat()),a=[],o=!1;return i.forEach(e=>{o=!1,hg(t,e)&&(o=!0),r&&hg(r,e)&&(o=!0),hg(n,e)&&(o=!0),o||a.push(e)}),a},this.retrieveFlatmapKnowledgeForEvent=async function(e,t){this.controller&&this.controller.abort(),this.controller=new AbortController;let n=t.resource;if(this.destinations=[],this.origins=[],this.components=[],this.destinationsWithDatasets=[],this.originsWithDatasets=[],this.componentsWithDatasets=[],this.destinationsCombinations=[],this.originsCombinations=[],this.componentsCombinations=[],this.singleConnectivityList=[],this.rawURLs=[],this.expertConsultants=[],!n||n.length===0||!n[0])return;let r=await this.queryForConnectivityNew(e,n[0]);return await Promise.all([r])},this.queryForConnectivityNew=async function(e,t,n=`map`,r=!0){let i=/^sckan-(\d{4})/.exec(e.knowledgeSource||``),o=(i?Number(i[1]):0)>=2026,s=e.mapMetadata.uuid,c=this.flatmapAPI;return this.connectivitySource=o?`sckan`:n,o&&(this.singleConnectivityList=await(0,a.querySingleConnectivityList)(c,s,t)),new Promise(n=>{(this.connectivitySource===`map`?this.queryMapConnectivity(e.mapMetadata.uuid,t):e.queryKnowledge(t)).then(i=>{if(this.checkConnectivityExists(i)){this.connectivitySource===`map`&&(this.noMapConnectivity=!1);let t=i;r?this.processConnectivity(e,t).then(e=>{i.references&&(this.rawURLs=[...i.references]),i[`expert-consultants`]&&(this.expertConsultants=[...i[`expert-consultants`]]),n(e)}):n(t)}else this.connectivitySource===`map`?(this.connectivitySource=`sckan`,this.noMapConnectivity=!0,e.queryKnowledge(t).then(t=>{if(this.checkConnectivityExists(t)){let i=t;r?this.processConnectivity(e,i).then(e=>{t.references&&(this.rawURLs=[...t.references]),t[`expert-consultants`]&&(this.expertConsultants=[...t[`expert-consultants`]]),n(e)}):n(i)}else n(!1)}).catch(()=>n(!1))):n(!1)}).catch(e=>{e.name===`AbortError`||console.warn(`Unable to get the knowledge for the entity ${t}.`),n(!1)})})},this.queryMapConnectivity=async function(e,t){let n=this.flatmapAPI+`flatmap/${e}/connectivity/${t}`;try{let e=await fetch(n);if(!e.ok)throw Error(`Response status: ${e.status}`);return await e.json()}catch(e){throw Error(e,{cause:e})}},this.queryForConnectivity=function(e,t,n,r=!0){let i={sql:this.buildConnectivitySqlStatement(t)},a={method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i),...n?{signal:n}:{}};return new Promise(t=>{fetch(`${this.flatmapAPI}knowledge/query/`,a).then(e=>e.json()).then(n=>{if(this.connectivityExists(n)){let i=JSON.parse(n.values[0][0]);r?this.processConnectivity(e,i).then(e=>{t(e)}):t(i)}else t(!1)}).catch(e=>{e.name===`AbortError`||console.error(`Error:`,e),t(!1)})})},this.checkConnectivityExists=function(e){return e&&e.connectivity?.length},this.connectivityExists=function(e){return!!(e.values&&e.values.length>0&&JSON.parse(e.values[0][0]).connectivity&&JSON.parse(e.values[0][0]).connectivity.length>0)},this.findIfNodeIsSingle=function(e){return e.length===1?(console.error(`Server returns a single node`,e),e[0]):e.length===2&&e[1].length===0&&e[0]},this.createLabelFromNeuralNode=function(e,t){let n=this.findIfNodeIsSingle(e);if(n)return t[n];let r=t[e[0]];return e.length===2&&e[1].length>0&&e[1].forEach(e=>{t[e]==null?r+=`, ${e}`:r+=`, ${t[e]}`}),r},this.flattenAndFindDatasets=function(e,t,n){let r=this.flattenConnectivity(e),i=this.flattenConnectivity(t),a=this.flattenConnectivity(n);this.originsWithDatasets=this.uberons.filter(e=>r.indexOf(e.id)!==-1).sort(gg),this.componentsWithDatasets=this.uberons.filter(e=>i.indexOf(e.id)!==-1).sort(gg),this.destinationsWithDatasets=this.uberons.filter(e=>a.indexOf(e.id)!==-1).sort(gg),this.singleConnectivityList.length>0&&this.singleConnectivityList.forEach(r=>{let{sckanNodeId:i,sckanNodeLabel:a,mapNodeId:o,mapNodeLabel:s}=r;n.find(e=>JSON.stringify(e)===JSON.stringify(i))&&(this.destinationsCombinations.push({sckanId:i,sckanLabel:a,mapId:o,mapLabel:s}),o.forEach((e,t)=>{let n=typeof e==`string`?e:e[0];n&&this.destinationsWithDatasets.push({id:n,name:s.split(`,`)[t]})})),e.find(e=>JSON.stringify(e)===JSON.stringify(i))&&(this.originsCombinations.push({sckanId:i,sckanLabel:a,mapId:o,mapLabel:s}),o.forEach((e,t)=>{let n=typeof e==`string`?e:e[0];n&&this.originsWithDatasets.push({id:n,name:s.split(`,`)[t]})})),t.find(e=>JSON.stringify(e)===JSON.stringify(i))&&(this.componentsCombinations.push({sckanId:i,sckanLabel:a,mapId:o,mapLabel:s}),o.forEach((e,t)=>{let n=typeof e==`string`?e:e[0];n&&this.componentsWithDatasets.push({id:n,name:s.split(`,`)[t]})}))})},this.processConnectivity=function(e,t){return new Promise(n=>{let r=[],i=[],a;t&&t[`node-phenotypes`]?([`ilxtr:hasSomaLocatedIn`].forEach(e=>{e in t[`node-phenotypes`]&&r.push(...t[`node-phenotypes`][e])}),r=dg(r),[`ilxtr:hasAxonPresynapticElementIn`,`ilxtr:hasAxonSensorySubcellularElementIn`].forEach(e=>{e in t[`node-phenotypes`]&&i.push(...t[`node-phenotypes`][e])}),i=dg(i)):(i=dg(t.axons),t.somas&&t.somas.length>0&&r.push(...t.somas),t.dendrites&&t.dendrites.length>0&&r.push(...t.dendrites),r=dg(r),a=t.somas);let o=this.findComponents(t,i,r,a),s=this.findAllIdsFromConnectivity(t);this.createLabelLookup(e,s).then(e=>{this.origins=r.map(t=>this.createLabelFromNeuralNode(t,e)).sort(gg),this.components=o.map(t=>this.createLabelFromNeuralNode(t,e)).sort(gg),this.destinations=i.map(t=>this.createLabelFromNeuralNode(t,e)).sort(gg),this.flattenAndFindDatasets(r,o,i),n({ids:{dendrites:r,components:o,axons:i},labels:{origins:this.origins,components:this.components,destinations:this.destinations}})})})},this.buildPubmedSqlStatement=function(e){let t=`select distinct publication from publications where entity in (`;if(e.length===1)t+=`'${e[0]}')`;else if(e.length>1)for(let n in e)t+=`'${e[n]}'${n>=e.length-1?`)`:`,`} `;return t},this.buildPubmedSqlStatementForModels=function(e){return`select distinct publication from publications where entity = '${e}'`},this.queryKnowledge=async(e,t)=>{let n=`${this.flatmapAPI}knowledge/query/`,r=await fetch(n,{method:`POST`,headers:{Accept:`application/json`},body:JSON.stringify({sql:e,params:t})});if(!r.ok)throw Error(`Cannot access ${n}`);let i=await r.json();if(`error`in i)throw TypeError(i.error);return i.values}};async function vg(e){let t=sessionStorage.getItem(`flatmap-knowledge`);if(t){let n=JSON.parse(t).filter(e=>e.references&&e.references.length).filter(t=>t.references.includes(e));if(n.length)return n.map(e=>e.id)}return[]}async function yg(e,t,n){let r=`select knowledge from knowledge
|
|
17
17
|
where source="${bg(e)}" and
|
|
18
18
|
knowledge like "%${t}%" order by source desc`;return(await n.queryKnowledge(r)).map(e=>JSON.parse(e)).map(e=>e.id)}function bg(e){return xg(e.mapMetadata)}function xg(e){let t=``;if(e?.connectivity){let n=e.connectivity;`knowledge-source`in n?t=n[`knowledge-source`]:`npo`in n&&(t=`${n.npo.release}-npo`)}return t}async function Sg(e,t){let n=bg(e),r=`select knowledge from knowledge
|
|
19
19
|
where source="${n}"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abi-software/flatmapvuer",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^24.20.0"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"./src/*": "./src/*"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@abi-software/map-utilities": "1.
|
|
53
|
+
"@abi-software/map-utilities": "1.13.0",
|
|
54
54
|
"@abi-software/sparc-annotation": "0.3.2",
|
|
55
55
|
"@abi-software/svg-sprite": "1.4.0",
|
|
56
56
|
"@element-plus/icons-vue": "^2.3.2",
|
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
|
-
|
|
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/"
|
|
@@ -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);
|