@abi-software/flatmapvuer 1.10.3-beta.0 → 1.10.3-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.10.3-beta.0",
3
+ "version": "1.10.3-beta.2",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -2067,7 +2067,17 @@ export default {
2067
2067
  const featureId = data[0].feature?.featureId;
2068
2068
  const annotation = this.mapImp.annotations.get(featureId);
2069
2069
  const anatomicalNodes = annotation?.['anatomical-nodes'];
2070
- const uniqueResource = anatomicalNodes ? JSON.parse(anatomicalNodes[0]) : transformResources;
2070
+ let anatomicalNode;
2071
+ let uniqueResource = transformResources;
2072
+ const models = annotation?.['models'];
2073
+ if (anatomicalNodes?.length) {
2074
+ anatomicalNode = anatomicalNodes[anatomicalNodes.length - 1];
2075
+ }
2076
+ if (anatomicalNode) {
2077
+ uniqueResource = JSON.parse(anatomicalNode);
2078
+ } else if (models) {
2079
+ uniqueResource = [models, []];
2080
+ }
2071
2081
 
2072
2082
  // if (this.connectionType === 'Origin') {
2073
2083
  // Competency Query API
@@ -2986,6 +2996,23 @@ export default {
2986
2996
  }
2987
2997
  const connectionFilters = [];
2988
2998
  const flatmapKnowledge = _flatmapKnowledge || this.getFlatmapKnowledge();
2999
+ const mapKnowledge = this.mapImp.pathways.paths;
3000
+ flatmapKnowledge.forEach((knowledge) => {
3001
+ const id = knowledge.id;
3002
+ if (id) {
3003
+ const matchObj = mapKnowledge[id];
3004
+ if (matchObj) {
3005
+ const mapConnectivity = matchObj.connectivity;
3006
+ const mapNodePhenotypes = matchObj['node-phenotypes'];
3007
+ knowledge.connectivity = [...knowledge.connectivity, ...mapConnectivity];
3008
+ for (let key in knowledge['node-phenotypes']) {
3009
+ if (mapNodePhenotypes[key]) {
3010
+ knowledge['node-phenotypes'][key].push(...mapNodePhenotypes[key]);
3011
+ }
3012
+ }
3013
+ }
3014
+ }
3015
+ })
2989
3016
  const originItems = await extractOriginItems(this.flatmapAPI, flatmapKnowledge);
2990
3017
  const viaItems = await extractViaItems(this.flatmapAPI, flatmapKnowledge);
2991
3018
  const destinationItems = await extractDestinationItems(this.flatmapAPI, flatmapKnowledge);
@@ -2994,7 +3021,7 @@ export default {
2994
3021
  const key = JSON.stringify(item.key);
2995
3022
  return {
2996
3023
  key: `flatmap.connectivity.source.${facet}.${key}`,
2997
- label: item.label
3024
+ label: item.label || key
2998
3025
  };
2999
3026
  }
3000
3027
 
@@ -3008,6 +3035,18 @@ export default {
3008
3035
  childrenList = destinationItems.map((item) => transformItem(facet, item));
3009
3036
  }
3010
3037
 
3038
+ // Those without label but key should be below
3039
+ childrenList = childrenList.sort((a, b) => {
3040
+ const isAlpha = (str) => /^[a-zA-Z]/.test(str);
3041
+ const aAlpha = isAlpha(a.label);
3042
+ const bAlpha = isAlpha(b.label);
3043
+
3044
+ if (aAlpha && !bAlpha) return -1;
3045
+ if (!aAlpha && bAlpha) return 1;
3046
+
3047
+ return a.label.localeCompare(b.label);
3048
+ });
3049
+
3011
3050
  connectionFilters.push({
3012
3051
  key: `flatmap.connectivity.source.${facet}`,
3013
3052
  label: facet,