@abi-software/map-side-bar 1.1.13 → 1.1.14

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/map-side-bar",
3
- "version": "1.1.13",
3
+ "version": "1.1.14",
4
4
  "main": "./dist/map-side-bar.common.js",
5
5
  "files": [
6
6
  "dist/*",
package/src/App.vue CHANGED
@@ -18,36 +18,50 @@
18
18
  // optionally import default styles
19
19
  import SideBar from './components/SideBar'
20
20
 
21
- let testContext = {
22
- "version": "0.1.0",
23
- "heading": "Generic mouse colon scaffold",
24
- "description": "Annotated mouse colon scaffold available for registration of segmented neural anatomical-functional mapping of enteric neural circuits.",
25
- "samples": [],
26
- "views": [
27
- {
28
- "annotation": "UBERON:0008971",
29
- "id": "View 1",
30
- "path": "derivative/distalColon_view.json",
31
- "sample": "--",
32
- "thumbnail": "derivative/distalColon_thumbnail.jpeg"
33
- },
34
- {
35
- "annotation": "UBERON:0008972",
36
- "id": "View 2",
37
- "path": "derivative/proximalColon_view.json",
38
- "sample": "--",
39
- "thumbnail": "derivative/proximalColon_thumbnail.jpeg"
40
- },
41
- {
42
- "annotation": "UBERON:0001157",
43
- "id": "View 3",
44
- "path": "derivative/transverseColon_view.json",
45
- "sample": "--",
46
- "thumbnail": "derivative/transverseColon_thumbnail.jpeg"
47
- }
48
- ]
49
- }
50
-
21
+ // let testContext = {
22
+ // "description": "3D digital tracings of the enteric plexus obtained from seven subjects (M11, M16, M162, M163, M164, M168) are mapped randomly on mouse proximal colon. The data depicts individual neural wiring patterns in enteric microcircuits, and revealed both neuron and fiber units wired in a complex organization.",
23
+ // "heading": "Digital tracings of enteric plexus",
24
+ // "id": "sparc.science.context_data",
25
+ // "samples": [
26
+ // {
27
+ // "annotation": "",
28
+ // "description": "Neuronal soma and fibers in a myenteric ganglion in this subject are annotated into the following groups to highlight their interactions:\n\nNeuron1,2,3 Connex: Connections between 3 neurons and cross-ganglionic fibers\n\nNeuron4_Connex: A small neuron contacts fibers passing the ganglion\n\nNeuron5: Multiple projections of a neuron in an myenteric ganglion\n\nNeuron5,3,7 Connex: Connections between 3 neurons, nerve fibers, IGNEx (complex type of intraganglionic nerve endings) and fibers in the circular muscles.\n\nNeuron8,9,10 Connex: Connections of 3 neurons with each other and with long passing fibers. \n\nIntraganglionic Nerve Ending (IGNE): Digital traces of neurites consist of complex intraganglionic nerve endings. The blue fiber has branched terminals, more likely the afferent nerve endings; the violet and cyan terminals also interweave into the fiber nest; the orange, pink and peach fibers and one process of the neuron cross the IGNE to make 1-2 conjunctions. \n",
29
+ // "doi": "",
30
+ // "heading": "Digital tracing for subject M11",
31
+ // "id": "Sample 1",
32
+ // "path": "files/derivative/sub-M11/sam-pCm11/digital-traces/pC PHPS XFP M11 20XZ 180425_180713_2_NL_20.xml",
33
+ // "view": "View 1"
34
+ // },
35
+ // {
36
+ // "annotation": "",
37
+ // "description": "This digital trace demonstrates some types of wiring. A long process of the green neuron terminates in the intraganglionic nerve endings (IGNE) while in contact with a nerve fiber (cyan), soma of a neuron (peach) and processes of 3 neurons (magenta, yellow and red). Two neurons and one fiber are traced to an IGNE. ",
38
+ // "doi": "",
39
+ // "heading": "Digital tracing for subject M16",
40
+ // "id": "Sample 2",
41
+ // "path": "files/derivative/sub-M16/sam-pCm16/digital-traces/pC PHPS XFP M16 20XZ 180425_180524.xml",
42
+ // "view": "View 2"
43
+ // }
44
+ // ],
45
+ // "version": "0.1.0",
46
+ // "views": [
47
+ // {
48
+ // "annotation": "--",
49
+ // "description": "Digital tracing of neurons for subject M11.",
50
+ // "id": "View 1",
51
+ // "path": "files/derivative/Scaffolds/M11_view.json",
52
+ // "sample": "Sample 1",
53
+ // "thumbnail": "files/derivative/Scaffolds/M11_thumbnail.jpeg"
54
+ // },
55
+ // {
56
+ // "annotation": "--",
57
+ // "description": "Digital tracing of neurons for subject M16.",
58
+ // "id": "View 2",
59
+ // "path": "files/derivative/Scaffolds/M16_view.json",
60
+ // "sample": "Sample 2",
61
+ // "thumbnail": "files/derivative/Scaffolds/M16_thumbnail.jpeg"
62
+ // }
63
+ // ]
64
+ // }
51
65
  export default {
52
66
  name: 'app',
53
67
  components: {
@@ -65,33 +79,7 @@ export default {
65
79
  data: function(){
66
80
  return {
67
81
  tabArray: [{title: 'Flatmap', id:1},{title: 'Heart Scaffold', id:2},{title: 'Stomach Scaffold', id:3}],
68
- contextArray: [testContext,{
69
- title: "Neural paths mapped to a heart scaffold",
70
- description: "Points are mapped to their positions on a 3d heart that is mapped to the data.",
71
- bannerImage: 'https://image.prntscr.com/image/aNIksBFARaKwlKhpnDCKbA.png',
72
- keys: [{
73
- image: "https://image.prntscr.com/image/VqNcZ8fSQJu5TJEf9ahwvA.png",
74
- text: "Neural path"
75
- }],
76
- },{
77
- title: "ICN fitted Scaffold",
78
- description: "Points are mapped to their positions on a 3d heart that is mapped to the data.",
79
- bannerImage: 'https://image.prntscr.com/image/BKgqmjSaQjK-B9hy_W7haQ.png',
80
- keys: [{
81
- image: "https://image.prntscr.com/image/DO_ZZXl7RtOXgVDv-Vw6yA.png",
82
- text: "Data type 1"
83
- },{
84
- image: "https://image.prntscr.com/image/tsnuRyFZTbmYfSjrMHTK8w.png",
85
- text: "Data type 2"
86
- },{
87
- image: "https://image.prntscr.com/image/DO_ZZXl7RtOXgVDv-Vw6yA.png",
88
- text: "Data type 3"
89
- },{
90
- image: "https://image.prntscr.com/image/tsnuRyFZTbmYfSjrMHTK8w.png",
91
- text: "Data type 4"
92
- }
93
- ]
94
- }],
82
+ contextArray: [null,null,null],
95
83
  sideBarVisibility: true,
96
84
  envVars: {
97
85
  API_LOCATION: process.env.VUE_APP_API_LOCATION,
@@ -120,7 +108,7 @@ export default {
120
108
  this.$refs.sideBar.addFilter({facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'})
121
109
  },
122
110
  multiFacets: function(){
123
- this.$refs.sideBar.openSearch('', [{facet: 'Male', term:'Sex', facetPropPath:'attributes.subject.sex.value'}, {facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'}])
111
+ this.$refs.sideBar.openSearch([{facet: 'Male', term:'Sex', facetPropPath:'attributes.subject.sex.value'}, {facet: 'Heart', term:'Anatomical structure', facetPropPath: 'anatomy.organ.name'}], '')
124
112
  },
125
113
  neuronSearch: function(){
126
114
  this.$refs.sideBar.openNeuronSearch('neuron-type-keast-10')
@@ -2,14 +2,14 @@
2
2
  <div class="context-card-container" ref="container">
3
3
  <div v-show="showDetails" class="hide" @click="showDetails = !showDetails">Hide information<i class="el-icon-arrow-up"></i></div>
4
4
  <div v-show="!showDetails" class="hide" @click="showDetails = !showDetails">Show information<i class="el-icon-arrow-down"></i></div>
5
- <el-card v-show="showDetails" class="context-card card" :body-style="{ padding: '0px', 'background-color': 'white', display: 'flex', width: '516px'}">
6
- <img :src="entry.bannerImage" class="context-image card-left">
5
+ <el-card v-if="showDetails && Object.keys(contextData).length !== 0" class="context-card card" :body-style="{ padding: '0px', 'background-color': 'white', display: 'flex', width: '516px'}">
6
+ <img :src="entry.banner" class="context-image card-left">
7
7
  <div class="card-right">
8
- <div class="title">{{entry.title}}</div>
9
- <div>{{entry.description}}</div>
10
- <template v-for="key in entry.keys">
11
- <br v-bind:key="key.text"/>
12
- <span v-bind:key="key.text + 1"><img :src="key.image" style="height: 20px;"> {{key.text}}</span>
8
+ <div class="title">{{contextData.heading}}</div>
9
+ <div>{{contextData.description}}</div>
10
+ <template v-for="(key, i) in contextData.views">
11
+ <br v-bind:key="i"/>
12
+ <span v-bind:key="i+'_1'"><img :src="getFileFromPath(key.thumbnail) " style="height: 25px;"> {{key.description}}</span>
13
13
  </template>
14
14
  </div>
15
15
  </el-card>
@@ -45,6 +45,7 @@ export default {
45
45
  },
46
46
  data: function () {
47
47
  return {
48
+ contextData: {},
48
49
  showDetails: true
49
50
  };
50
51
  },
@@ -52,7 +53,32 @@ export default {
52
53
 
53
54
  },
54
55
  methods: {
56
+ getContextFile: function (contextFileUrl) {
57
+ fetch(contextFileUrl)
58
+ .then((response) =>{
59
+ if (!response.ok){
60
+ throw Error(response.statusText)
61
+ } else {
62
+ return response.json()
63
+ }
64
+ })
65
+ .then((data) => {
66
+ this.contextData = data
67
+ console.log(this.contextData)
68
+ })
69
+ .catch(() => {
70
+ //set defaults if we hit an error
71
+ this.thumbnail = require('@/../assets/missing-image.svg')
72
+ this.discoverId = undefined
73
+ });
74
+ },
75
+ getFileFromPath: function(path){
76
+ return `${this.entry.apiLocation}s3-resource/${this.entry.discoverId}/${this.entry.version}/files/${path}`
77
+ },
55
78
  },
79
+ mounted: function(){
80
+ this.getContextFile(this.entry.contextCardUrl)
81
+ }
56
82
  };
57
83
  </script>
58
84
 
@@ -17,6 +17,9 @@
17
17
  <div>
18
18
  <el-button v-if="entry.scaffolds" @click="openScaffold" size="mini" class="button" icon="el-icon-view">View scaffold</el-button>
19
19
  </div>
20
+ <div>
21
+ <el-button v-if="entry.contextualInformation" @click="openContext" size="mini" class="button" icon="el-icon-view">View context data</el-button>
22
+ </div>
20
23
  <div>
21
24
  <el-button v-if="hasCSVFile" @click="openPlot" size="mini" class="button" icon="el-icon-view">View plot</el-button>
22
25
  </div>
@@ -42,7 +45,6 @@ import { Button, Icon } from "element-ui";
42
45
  import lang from "element-ui/lib/locale/lang/en";
43
46
  import locale from "element-ui/lib/locale";
44
47
  import EventBus from "./EventBus"
45
- import scaffoldMetaMap from './scaffold-meta-map';
46
48
  import speciesMap from "./species-map";
47
49
 
48
50
  locale.use(lang);
@@ -140,9 +142,26 @@ export default {
140
142
  title: "View 3D scaffold",
141
143
  type: "Scaffold",
142
144
  discoverId: this.discoverId,
143
- contextCard: scaffoldMetaMap[this.discoverId] ? scaffoldMetaMap[this.discoverId].contextCard : undefined
145
+ apiLocation: this.envVars.API_LOCATION,
146
+ version: this.version,
147
+ contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
148
+ banner: this.thumbnail
144
149
  }
145
- EventBus.$emit("PopoverActionClick", action)
150
+ this.propogateCardAction(action)
151
+ },
152
+ openContext: function(){
153
+ let action = {
154
+ label: capitalise(this.label),
155
+ resource: 'not used',
156
+ title: "View 3D scaffold",
157
+ type: "Scaffold",
158
+ discoverId: this.discoverId,
159
+ apiLocation: this.envVars.API_LOCATION,
160
+ version: this.version,
161
+ contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
162
+ banner: this.thumbnail
163
+ }
164
+ this.propogateCardAction(action)
146
165
  },
147
166
  openPlot: function(){
148
167
  let action = {
@@ -151,8 +170,12 @@ export default {
151
170
  title: "View plot",
152
171
  type: "Plot",
153
172
  discoverId: this.discoverId,
173
+ apiLocation: this.envVars.API_LOCATION,
174
+ version: this.version,
175
+ contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
176
+ banner: this.thumbnail
154
177
  }
155
- EventBus.$emit("PopoverActionClick", action)
178
+ this.propogateCardAction(action)
156
179
  },
157
180
  openDataset: function(){
158
181
  window.open(this.dataLocation,'_blank');
@@ -195,7 +218,10 @@ export default {
195
218
  label: undefined,
196
219
  resource: resource,
197
220
  dataset: this.dataLocation,
198
- datasetId: this.discoverId,
221
+ apiLocation: this.envVars.API_LOCATION,
222
+ version: this.version,
223
+ contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
224
+ banner: this.thumbnail,
199
225
  title: "View simulation",
200
226
  name: this.entry.name,
201
227
  description: this.entry.description,
@@ -203,6 +229,13 @@ export default {
203
229
  }
204
230
  EventBus.$emit("PopoverActionClick", action)
205
231
  },
232
+ propogateCardAction: function(action){
233
+ EventBus.$emit("PopoverActionClick", action)
234
+ if (action.contextCardUrl) {
235
+ this.$emit('contextUpdate', action)
236
+ }
237
+
238
+ },
206
239
  getScaffoldPath: function(discoverId, version, scaffoldPath){
207
240
  let id = discoverId
208
241
  let path = `${this.envVars.API_LOCATION}s3-resource/${id}/${version}/files/${scaffoldPath}`
@@ -28,7 +28,7 @@
28
28
  >No results found - Please change your search / filter criteria.</div>
29
29
  <div class="error-feedback" v-if="sciCrunchError">{{sciCrunchError}}</div>
30
30
  <div v-for="o in results" :key="o.id" class="step-item">
31
- <DatasetCard :entry="o" :envVars="envVars"></DatasetCard>
31
+ <DatasetCard :entry="o" :envVars="envVars" @contextUpdate="contextCardUpdate"></DatasetCard>
32
32
  </div>
33
33
  <el-pagination
34
34
  class="pagination"
@@ -101,7 +101,8 @@ var initial_state = {
101
101
  pageModel: 1,
102
102
  start: 0,
103
103
  hasSearched: false,
104
- sciCrunchError: false
104
+ sciCrunchError: false,
105
+ contextCardEntry: undefined
105
106
  };
106
107
 
107
108
  export default {
@@ -120,10 +121,6 @@ export default {
120
121
  type: Object,
121
122
  default: () => initial_state
122
123
  },
123
- contextCardEntry: {
124
- type: Object,
125
- default: undefined
126
- },
127
124
  envVars: {
128
125
  type: Object,
129
126
  default: () => {}
@@ -153,6 +150,9 @@ export default {
153
150
  }
154
151
  },
155
152
  methods: {
153
+ contextCardUpdate: function(val){
154
+ this.contextCardEntry = val
155
+ },
156
156
  openSearch: function(filter, search='') {
157
157
  this.searchInput = search;
158
158
  this.resetPageNavigation();
@@ -277,6 +277,7 @@ export default {
277
277
  doi: element.doi,
278
278
  publishDate: element.publishDate,
279
279
  scaffolds: element['abi-scaffold-metadata-file'] ? element['abi-scaffold-metadata-file'] : undefined,
280
+ contextualInformation: element['abi-contextual-information'].length > 0 ? element['abi-contextual-information'] : undefined,
280
281
  additionalLinks: element.additionalLinks,
281
282
  simulation: element.additionalLinks
282
283
  ? element.additionalLinks[0].description == 'Repository'