@abi-software/map-side-bar 1.1.15 → 1.1.17-beta.1

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.15",
3
+ "version": "1.1.17-beta.1",
4
4
  "main": "./dist/map-side-bar.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -0,0 +1,28 @@
1
+ {
2
+ "description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
3
+ "heading": "Mapped ICN samples",
4
+ "id": "sparc.science.context_data",
5
+ "samples": [
6
+ {
7
+ "annotation": "",
8
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
9
+ "doi": "",
10
+ "heading": "ICNS from subject M54-8",
11
+ "id": "Sample 1",
12
+ "path": "",
13
+ "view": "View 1",
14
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
15
+ },
16
+ {
17
+ "annotation": "",
18
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
19
+ "doi": "",
20
+ "heading": "ICNS from subject M54-5",
21
+ "id": "Sample 2",
22
+ "path": "",
23
+ "view": "View 2",
24
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
25
+ }
26
+ ],
27
+ "version": "0.1.0",
28
+ }
@@ -1,18 +1,44 @@
1
1
  <template>
2
2
  <div class="context-card-container" ref="container">
3
- <div v-show="showDetails" class="hide" @click="showDetails = !showDetails">Hide information<i class="el-icon-arrow-up"></i></div>
4
- <div v-show="!showDetails" class="hide" @click="showDetails = !showDetails">Show information<i class="el-icon-arrow-down"></i></div>
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
- <div class="card-right">
8
- <div class="title">{{contextData.heading}}</div>
9
- <div>{{contextData.description}}</div>
10
- <template v-for="(view, i) in contextData.views">
11
- <br v-bind:key="i"/>
12
- <span v-bind:key="i+'_1'" @click="openViewFile(view)" style="cursor:pointer;"><img :src="getFileFromPath(view.thumbnail)" style="height: 25px;"> {{view.description}}</span>
13
- </template>
14
- </div>
15
- </el-card>
3
+ <div v-show="showContextCard">
4
+ <div v-show="showDetails" class="hide" @click="showDetails = !showDetails">Hide information<i class="el-icon-arrow-up"></i></div>
5
+ <div v-show="!showDetails" class="hide" @click="showDetails = !showDetails">Show information<i class="el-icon-arrow-down"></i></div>
6
+ <el-card v-if="showDetails && Object.keys(contextData).length !== 0" v-loading="loading" class="context-card card" >
7
+ <div class="card-left">
8
+ <img :src="entry.banner" class="context-image">
9
+ </div>
10
+ <div class="card-right">
11
+ <div class="title">{{contextData.heading}}</div>
12
+ <div>{{contextData.description}}</div>
13
+ <br/>
14
+ <div v-if="contextData.views" class="subtitle">Scaffold Views</div>
15
+ <template v-for="(view, i) in contextData.views">
16
+ <span v-bind:key="i+'_1'" @click="openViewFile(view)" class="context-card-item">
17
+ <img class="key-image" :src="getFileFromPath(view.thumbnail)">
18
+ {{view.description}}
19
+ </span>
20
+ <br v-bind:key="i"/>
21
+ </template>
22
+ <div style="margin-bottom: 16px;"/>
23
+ <div v-if="contextData.samples" class="subtitle">Samples on Scaffold</div>
24
+ <template v-for="(sample, i) in contextData.samples">
25
+ <span v-bind:key="i+'_3'" class="context-card-item" @click="toggleSampleDetails(i)">
26
+ <div v-bind:key="i+'_6'" style="display: flex">
27
+ <div v-if="sample.color" class="color-box" :style="'background-color:'+ sample.color"></div>
28
+ <img class="key-image" v-else-if="sample.thumbnail" :src="getFileFromPath(sample.thumbnail)">
29
+ {{sample.heading}}
30
+ <i class="el-icon-warning-outline info"></i>
31
+ </div>
32
+ </span>
33
+ <div v-bind:key="i+'_4'" v-if="sampleDetails[i]">
34
+ {{sample.description}}
35
+ <a v-bind:key="i+'_5'" v-if="sampleDetails[i]" :href="generateFileLink(sample.path)" target="_blank">View Source</a>
36
+ </div>
37
+ <br v-bind:key="i+'_2'"/>
38
+ </template>
39
+ </div>
40
+ </el-card>
41
+ </div>
16
42
  </div>
17
43
  </template>
18
44
 
@@ -24,6 +50,7 @@ import { Link, Icon, Card, Button, Select, Input } from "element-ui";
24
50
  import lang from "element-ui/lib/locale/lang/en";
25
51
  import locale from "element-ui/lib/locale";
26
52
  import EventBus from "./EventBus"
53
+ import hardcoded_info from './hardcoded-context-info'
27
54
 
28
55
  locale.use(lang);
29
56
  Vue.use(Link);
@@ -34,7 +61,6 @@ Vue.use(Select);
34
61
  Vue.use(Input);
35
62
 
36
63
 
37
-
38
64
  export default {
39
65
  name: "contextCard",
40
66
  props: {
@@ -47,16 +73,33 @@ export default {
47
73
  data: function () {
48
74
  return {
49
75
  contextData: {},
50
- showDetails: true
76
+ showDetails: true,
77
+ showContextCard: true,
78
+ sampleDetails: {},
79
+ loading: false
51
80
  };
52
81
  },
53
82
  watch: {
54
- 'entry.contextCardUrl'(val){
55
- this.getContextFile(val)
83
+ 'entry.contextCardUrl': {
84
+ handler(val){
85
+ if (val) {
86
+ // used for hardcoding data
87
+ if (val === true){
88
+ this.contextData = hardcoded_info[this.entry.discoverId]
89
+ } else {
90
+ this.getContextFile(val)
91
+ this.showContextCard = true
92
+ }
93
+ } else {
94
+ this.showContextCard = false
95
+ }
96
+ },
97
+ immediate: true
56
98
  }
57
99
  },
58
100
  methods: {
59
101
  getContextFile: function (contextFileUrl) {
102
+ this.loading = true
60
103
  fetch(contextFileUrl)
61
104
  .then((response) =>{
62
105
  if (!response.ok){
@@ -67,27 +110,48 @@ export default {
67
110
  })
68
111
  .then((data) => {
69
112
  this.contextData = data
70
- console.log(this.contextData)
113
+ this.loading = false
71
114
  })
72
115
  .catch(() => {
73
116
  //set defaults if we hit an error
74
117
  this.thumbnail = require('@/../assets/missing-image.svg')
75
118
  this.discoverId = undefined
119
+ this.loading = false
76
120
  });
77
121
  },
122
+ removeDoubleFilesPath: function(path){
123
+ if (path.includes('files/')){
124
+ return path.replace('files/', '')
125
+ } else {
126
+ return path
127
+ }
128
+ },
129
+ toggleSampleDetails: function(i){
130
+ if (this.sampleDetails[i] === undefined){
131
+ Vue.set(this.sampleDetails, i, true)
132
+ } else {
133
+ Vue.set(this.sampleDetails, i, !this.sampleDetails[i])
134
+ }
135
+ },
78
136
  getFileFromPath: function(path){
137
+ // for hardcoded data
138
+ if(this.entry.contextCardUrl === true){
139
+ return path
140
+ }
141
+ path = this.removeDoubleFilesPath(path)
79
142
  return `${this.entry.apiLocation}s3-resource/${this.entry.discoverId}/${this.entry.version}/files/${path}`
80
143
  },
144
+ generateFileLink(path){
145
+ return `https://sparc.science/file/${this.entry.discoverId}/${this.entry.version}?path=${encodeURI(path)}`
146
+
147
+ },
81
148
  openViewFile: function(view){
82
149
 
83
150
  // note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
84
151
  this.entry.viewUrl = view.path.split('/')[view.path.split('/').length-1]
152
+ this.entry.type = 'Scaffold View'
85
153
  EventBus.$emit("PopoverActionClick", this.entry)
86
154
  }
87
-
88
- },
89
- mounted: function(){
90
- this.getContextFile(this.entry.contextCardUrl)
91
155
  }
92
156
  };
93
157
  </script>
@@ -102,14 +166,40 @@ export default {
102
166
 
103
167
  .context-card{
104
168
  background-color: white;
169
+ max-height: 10 50px;
170
+ padding: 8px;
171
+ }
172
+
173
+ .context-card-item{
174
+ cursor: pointer;
175
+ padding-bottom: 8px;
176
+ }
177
+
178
+ .key-image {
179
+ width: 25px;
180
+ height: auto;
181
+ }
182
+
183
+ .context-card >>> .el-card__body {
184
+ padding: 0px;
185
+ display: flex;
186
+ width: 516px;
105
187
  }
106
188
 
107
189
  .context-image{
108
- width: 250px
190
+ width: 250px;
191
+ height: auto;
192
+ }
193
+
194
+ .color-box {
195
+ width: 16px;
196
+ height: 16px;
197
+ border: solid 1px #8300bf;
198
+ border-radius: 2px;
199
+ margin-right: 8px;
109
200
  }
110
201
 
111
202
  .card {
112
- padding-top: 18px;
113
203
  margin-bottom: 18px;
114
204
  position: relative;
115
205
  border: solid 1px #e4e7ed;
@@ -125,7 +215,22 @@ export default {
125
215
  padding-left: 6px;
126
216
  }
127
217
 
218
+ .cursor-pointer {
219
+ cursor: pointer;
220
+ height: 25px;
221
+ }
222
+
223
+ .info{
224
+ transform: rotate(180deg);
225
+ color: #8300bf;
226
+ margin-left: 8px;
227
+ }
228
+
128
229
  .title{
129
230
  font-weight: bold;
130
231
  }
232
+
233
+ .subtitle{
234
+ font-weight: bold;
235
+ }
131
236
  </style>
@@ -17,9 +17,6 @@
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>
23
20
  <div>
24
21
  <el-button v-if="hasCSVFile" @click="openPlot" size="mini" class="button" icon="el-icon-view">View plot</el-button>
25
22
  </div>
@@ -46,11 +43,13 @@ import lang from "element-ui/lib/locale/lang/en";
46
43
  import locale from "element-ui/lib/locale";
47
44
  import EventBus from "./EventBus"
48
45
  import speciesMap from "./species-map";
46
+ import hardcoded_info from './hardcoded-context-info'
49
47
 
50
48
  locale.use(lang);
51
49
  Vue.use(Button);
52
50
  Vue.use(Icon);
53
51
 
52
+
54
53
  const capitalise = function(string){
55
54
  return string.replace(/\b\w/g, v => v.toUpperCase());
56
55
  }
@@ -147,19 +146,8 @@ export default {
147
146
  contextCardUrl: this.entry.contextualInformation ? this.getFileFromPath(this.discoverId, this.version,this.entry.contextualInformation) : undefined,
148
147
  banner: this.thumbnail
149
148
  }
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
149
+ if (hardcoded_info[this.discoverId]){
150
+ action.contextCardUrl = true
163
151
  }
164
152
  this.propogateCardAction(action)
165
153
  },
@@ -23,7 +23,7 @@
23
23
  <el-popover
24
24
  title="How do filters work?"
25
25
  width="250"
26
- trigger="click"
26
+ trigger="hover"
27
27
  :append-to-body=false
28
28
  popper-class="popover"
29
29
  >
@@ -177,18 +177,7 @@ export default {
177
177
  this.createCascaderItemValue(facet.label, facetItem.label);
178
178
  });
179
179
  });
180
- let dataFacet = {...this.facets[2]}
181
- let newChildren = dataFacet.children.filter( el=> {
182
- if (el.label === 'Scaffold' || el.label === 'Simulation' || el.label === 'Show all'){
183
- return el
184
- }
185
- })
186
- newChildren.push({label:'Image'})
187
- dataFacet.children = newChildren
188
- window.newChildren = newChildren
189
- window.ff = dataFacet
190
- dataFacet.label = 'Data type'
191
- this.facets.push(dataFacet)
180
+ this.createDataTypeFacet()
192
181
  })
193
182
  .finally(() => {
194
183
  resolve();
@@ -208,17 +197,28 @@ export default {
208
197
  // Check for show all in selected cascade options
209
198
  event = this.showAllEventModifier(event);
210
199
 
211
- // Move results from arrays to object
212
- let filters = event.filter( selection => selection !== undefined).map( fs => ({
200
+ // Create results for the filter update
201
+ let filterKeys = event.filter( selection => selection !== undefined).map( fs => ({
213
202
  facetPropPath: fs[0],
214
203
  facet: fs[1].split("/")[1],
215
204
  term: fs[1].split("/")[0],
216
205
  }))
217
206
 
207
+ // Move results from arrays to object for use on scicrunch (note that we remove 'duplicate' as that is only needed for filter keys)
208
+ let filters = event.filter( selection => selection !== undefined).map( fs => {
209
+ let propPath = fs[0].includes('duplicate') ? fs[0].split('duplicate')[0] : fs[0]
210
+ return {
211
+ facetPropPath: propPath,
212
+ facet: fs[1].split("/")[1],
213
+ term: fs[1].split("/")[0],
214
+ }
215
+ })
216
+
217
+
218
218
  this.$emit('loading', true) // let sidebarcontent wait for the requests
219
219
 
220
220
  this.$emit("filterResults", filters); // emit filters for apps above sidebar
221
- this.setCascader(filters); //update our cascader v-model if we modified the event
221
+ this.setCascader(filterKeys); //update our cascader v-model if we modified the event
222
222
  this.makeCascadeLabelsClickable();
223
223
  }
224
224
  },
@@ -287,6 +287,28 @@ export default {
287
287
  }
288
288
  return event;
289
289
  },
290
+ createDataTypeFacet: function(){
291
+ let dataFacet = {...this.facets[2]} // copy the 'Experiemental approach' facet
292
+ let count = this.facets.at(-1).id // get the last id count
293
+
294
+ // Step through the children that are valid data types, switch thier values
295
+ let newChildren = dataFacet.children.filter( el=> {
296
+ if (el.label === 'Scaffold' || el.label === 'Simulation' || el.label === 'Show all'){
297
+ el.key = el.label
298
+ el.id = count
299
+ el.value = el.value.replace('Experimental approach', 'Data type')
300
+ count++
301
+ return el
302
+ }
303
+ })
304
+ dataFacet.id = count
305
+ dataFacet.key = 'Data type'
306
+ // Add 'duplicate' so that the key is unique. This is removed in the cascade event for filtering
307
+ dataFacet.value += 'duplicate'
308
+ dataFacet.children = newChildren
309
+ dataFacet.label = 'Data type'
310
+ this.facets.push(dataFacet)
311
+ },
290
312
  cascadeExpandChange: function (event) {
291
313
  //work around as the expand item may change on modifying the cascade props
292
314
  this.__expandItem__ = event;
@@ -485,4 +507,51 @@ export default {
485
507
  .cascader >>> .el-cascader-node__label {
486
508
  text-align: left;
487
509
  }
510
+
511
+ .filters >>> .el-popover {
512
+ background: #f3ecf6 !important;
513
+ border: 1px solid #8300BF;
514
+ border-radius: 4px;
515
+ color: #303133 !important;
516
+ font-size: 12px;
517
+ line-height: 18px;
518
+
519
+
520
+ }
521
+
522
+ .filters >>> .el-popover[x-placement^="top"] .popper__arrow {
523
+ border-top-color: #8300BF;
524
+ border-bottom-width: 0;
525
+ }
526
+ .filters >>> .el-popover[x-placement^="top"] .popper__arrow::after {
527
+ border-top-color: #f3ecf6;
528
+ border-bottom-width: 0;
529
+ }
530
+
531
+ .filters >>> .el-popover[x-placement^="bottom"] .popper__arrow {
532
+ border-top-width: 0;
533
+ border-bottom-color: #8300BF;
534
+ }
535
+ .filters >>> .el-popover[x-placement^="bottom"] .popper__arrow::after {
536
+ border-top-width: 0;
537
+ border-bottom-color: #f3ecf6;
538
+ }
539
+
540
+ .filters >>> .el-popover[x-placement^="right"] .popper__arrow {
541
+ border-right-color: #8300BF;
542
+ border-left-width: 0;
543
+ }
544
+ .filters >>> .el-popover[x-placement^="right"] .popper__arrow::after {
545
+ border-right-color: #f3ecf6;
546
+ border-left-width: 0;
547
+ }
548
+
549
+ .filters >>> .el-popover[x-placement^="left"] .popper__arrow {
550
+ border-right-width: 0;
551
+ border-left-color: #8300BF;
552
+ }
553
+ .filters >>> .el-popover[x-placement^="left"] .popper__arrow::after {
554
+ border-right-width: 0;
555
+ border-left-color: #f3ecf6;
556
+ }
488
557
  </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <el-card :body-style="bodyStyle" class="content-card">
3
3
  <div slot="header" class="header">
4
- <context-card v-if="contextCardEntry" :entry="contextCardEntry" />
4
+ <context-card v-if="contextCardEntry && contextCardEnabled" :entry="contextCardEntry" />
5
5
  <el-input
6
6
  class="search-input"
7
7
  placeholder="Search"
@@ -102,7 +102,8 @@ var initial_state = {
102
102
  start: 0,
103
103
  hasSearched: false,
104
104
  sciCrunchError: false,
105
- contextCardEntry: undefined
105
+ contextCardEntry: undefined,
106
+ contextCardEnabled: true
106
107
  };
107
108
 
108
109
  export default {
@@ -0,0 +1,76 @@
1
+ export default {
2
+ 77: {
3
+ "description": "This dataset contains single cell scale anatomical map of the rat intrinsic cardiac nervous system (ICNS) across four male and three female hearts. These cell clusters can be seen by the yellow data points on the image as well as spherical markers on the 3D heart scaffold. The dataset provides an integrative framework to visualise the spatial distribution of ICNS across different hearts.",
4
+ "heading": "Mapped ICN samples",
5
+ "id": "sparc.science.context_data",
6
+ "samples": [
7
+ {
8
+ "annotation": "",
9
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
10
+ "doi": "",
11
+ "heading": "ICNS from subject M54-8",
12
+ "id": "Sample 1",
13
+ "path": "",
14
+ "view": "View 1",
15
+ "color": "#FFFF00",
16
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
17
+ },
18
+ {
19
+ "annotation": "",
20
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
21
+ "doi": "",
22
+ "heading": "ICNS from subject M54-5",
23
+ "id": "Sample 2",
24
+ "path": "",
25
+ "view": "View 2",
26
+ "color": "#FFA500",
27
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
28
+ }
29
+ ],
30
+ "version": "0.1.0",
31
+ },
32
+ 221: {
33
+ "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.",
34
+ "heading": "Digital tracings of enteric plexus",
35
+ "id": "sparc.science.context_data",
36
+ "samples": [
37
+ {
38
+ "annotation": "",
39
+ "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",
40
+ "doi": "",
41
+ "heading": "Digital tracing for subject M11",
42
+ "id": "Sample 1",
43
+ "path": "files/derivative/sub-M11/sam-pCm11/digital-traces/pC PHPS XFP M11 20XZ 180425_180713_2_NL_20.xml",
44
+ "view": "View 1"
45
+ },
46
+ {
47
+ "annotation": "",
48
+ "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. ",
49
+ "doi": "",
50
+ "heading": "Digital tracing for subject M16",
51
+ "id": "Sample 2",
52
+ "path": "files/derivative/sub-M16/sam-pCm16/digital-traces/pC PHPS XFP M16 20XZ 180425_180524.xml",
53
+ "view": "View 2"
54
+ }
55
+ ],
56
+ "version": "0.1.0",
57
+ "views": [
58
+ {
59
+ "annotation": "--",
60
+ "description": "Digital tracing of neurons for subject M11.",
61
+ "id": "View 1",
62
+ "path": "files/derivative/Scaffolds/M11_view.json",
63
+ "sample": "Sample 1",
64
+ "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M11_thumbnail.jpeg"
65
+ },
66
+ {
67
+ "annotation": "--",
68
+ "description": "Digital tracing of neurons for subject M16.",
69
+ "id": "View 2",
70
+ "path": "files/derivative/Scaffolds/M16_view.json",
71
+ "sample": "Sample 2",
72
+ "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M16_thumbnail.jpeg"
73
+ }
74
+ ]
75
+ }
76
+ }