@abi-software/map-side-bar 1.1.16 → 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.16",
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,41 @@
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
+ <img class="key-image" v-if="sample.thumbnail" :src="getFileFromPath(sample.thumbnail)">
27
+ {{sample.heading}}
28
+
29
+ </span>
30
+ <div v-bind:key="i+'_4'" v-if="sampleDetails[i]">
31
+ {{sample.description}}
32
+ <a v-bind:key="i+'_5'" v-if="sampleDetails[i]" :href="generateFileLink(sample.path)" target="_blank">View Source</a>
33
+ </div>
34
+ <br v-bind:key="i+'_2'"/>
35
+ </template>
36
+ </div>
37
+ </el-card>
38
+ </div>
16
39
  </div>
17
40
  </template>
18
41
 
@@ -24,6 +47,7 @@ import { Link, Icon, Card, Button, Select, Input } from "element-ui";
24
47
  import lang from "element-ui/lib/locale/lang/en";
25
48
  import locale from "element-ui/lib/locale";
26
49
  import EventBus from "./EventBus"
50
+ import hardcoded_info from './hardcoded-context-info'
27
51
 
28
52
  locale.use(lang);
29
53
  Vue.use(Link);
@@ -34,7 +58,6 @@ Vue.use(Select);
34
58
  Vue.use(Input);
35
59
 
36
60
 
37
-
38
61
  export default {
39
62
  name: "contextCard",
40
63
  props: {
@@ -47,16 +70,33 @@ export default {
47
70
  data: function () {
48
71
  return {
49
72
  contextData: {},
50
- showDetails: true
73
+ showDetails: true,
74
+ showContextCard: true,
75
+ sampleDetails: {},
76
+ loading: false
51
77
  };
52
78
  },
53
79
  watch: {
54
- 'entry.contextCardUrl'(val){
55
- this.getContextFile(val)
80
+ 'entry.contextCardUrl': {
81
+ handler(val){
82
+ if (val) {
83
+ // used for hardcoding data
84
+ if (val === true){
85
+ this.contextData = hardcoded_info[this.entry.discoverId]
86
+ } else {
87
+ this.getContextFile(val)
88
+ this.showContextCard = true
89
+ }
90
+ } else {
91
+ this.showContextCard = false
92
+ }
93
+ },
94
+ immediate: true
56
95
  }
57
96
  },
58
97
  methods: {
59
98
  getContextFile: function (contextFileUrl) {
99
+ this.loading = true
60
100
  fetch(contextFileUrl)
61
101
  .then((response) =>{
62
102
  if (!response.ok){
@@ -67,17 +107,41 @@ export default {
67
107
  })
68
108
  .then((data) => {
69
109
  this.contextData = data
70
- console.log(this.contextData)
110
+ this.loading = false
71
111
  })
72
112
  .catch(() => {
73
113
  //set defaults if we hit an error
74
114
  this.thumbnail = require('@/../assets/missing-image.svg')
75
115
  this.discoverId = undefined
116
+ this.loading = false
76
117
  });
77
118
  },
119
+ removeDoubleFilesPath: function(path){
120
+ if (path.includes('files/')){
121
+ return path.replace('files/', '')
122
+ } else {
123
+ return path
124
+ }
125
+ },
126
+ toggleSampleDetails: function(i){
127
+ if (this.sampleDetails[i] === undefined){
128
+ Vue.set(this.sampleDetails, i, true)
129
+ } else {
130
+ Vue.set(this.sampleDetails, i, !this.sampleDetails[i])
131
+ }
132
+ },
78
133
  getFileFromPath: function(path){
134
+ // for hardcoded data
135
+ if(this.entry.contextCardUrl === true){
136
+ return path
137
+ }
138
+ path = this.removeDoubleFilesPath(path)
79
139
  return `${this.entry.apiLocation}s3-resource/${this.entry.discoverId}/${this.entry.version}/files/${path}`
80
140
  },
141
+ generateFileLink(path){
142
+ return `https://sparc.science/file/${this.entry.discoverId}/${this.entry.version}?path=${encodeURI(path)}`
143
+
144
+ },
81
145
  openViewFile: function(view){
82
146
 
83
147
  // note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
@@ -85,10 +149,6 @@ export default {
85
149
  this.entry.type = 'Scaffold View'
86
150
  EventBus.$emit("PopoverActionClick", this.entry)
87
151
  }
88
-
89
- },
90
- mounted: function(){
91
- this.getContextFile(this.entry.contextCardUrl)
92
152
  }
93
153
  };
94
154
  </script>
@@ -103,14 +163,32 @@ export default {
103
163
 
104
164
  .context-card{
105
165
  background-color: white;
166
+ max-height: 10 50px;
167
+ padding: 8px;
168
+ }
169
+
170
+ .context-card-item{
171
+ cursor: pointer;
172
+ padding-bottom: 8px;
173
+ }
174
+
175
+ .key-image {
176
+ width: 25px;
177
+ height: auto;
178
+ }
179
+
180
+ .context-card >>> .el-card__body {
181
+ padding: 0px;
182
+ display: flex;
183
+ width: 516px;
106
184
  }
107
185
 
108
186
  .context-image{
109
- width: 250px
187
+ width: 250px;
188
+ height: auto;
110
189
  }
111
190
 
112
191
  .card {
113
- padding-top: 18px;
114
192
  margin-bottom: 18px;
115
193
  position: relative;
116
194
  border: solid 1px #e4e7ed;
@@ -126,7 +204,16 @@ export default {
126
204
  padding-left: 6px;
127
205
  }
128
206
 
207
+ .cursor-pointer {
208
+ cursor: pointer;
209
+ height: 25px;
210
+ }
211
+
129
212
  .title{
130
213
  font-weight: bold;
131
214
  }
215
+
216
+ .subtitle{
217
+ font-weight: bold;
218
+ }
132
219
  </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
  >
@@ -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,74 @@
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
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/orange.png"
16
+ },
17
+ {
18
+ "annotation": "",
19
+ "description": "Spatial location of isolated ICNS mapped onto a generic heart scaffold",
20
+ "doi": "",
21
+ "heading": "ICNS from subject M54-5",
22
+ "id": "Sample 2",
23
+ "path": "",
24
+ "view": "View 2",
25
+ "thumbnail": "https://raw.githubusercontent.com/ABI-Software/map-sidebar/main/assets/temp-pics/teal.png"
26
+ }
27
+ ],
28
+ "version": "0.1.0",
29
+ },
30
+ 221: {
31
+ "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.",
32
+ "heading": "Digital tracings of enteric plexus",
33
+ "id": "sparc.science.context_data",
34
+ "samples": [
35
+ {
36
+ "annotation": "",
37
+ "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",
38
+ "doi": "",
39
+ "heading": "Digital tracing for subject M11",
40
+ "id": "Sample 1",
41
+ "path": "files/derivative/sub-M11/sam-pCm11/digital-traces/pC PHPS XFP M11 20XZ 180425_180713_2_NL_20.xml",
42
+ "view": "View 1"
43
+ },
44
+ {
45
+ "annotation": "",
46
+ "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. ",
47
+ "doi": "",
48
+ "heading": "Digital tracing for subject M16",
49
+ "id": "Sample 2",
50
+ "path": "files/derivative/sub-M16/sam-pCm16/digital-traces/pC PHPS XFP M16 20XZ 180425_180524.xml",
51
+ "view": "View 2"
52
+ }
53
+ ],
54
+ "version": "0.1.0",
55
+ "views": [
56
+ {
57
+ "annotation": "--",
58
+ "description": "Digital tracing of neurons for subject M11.",
59
+ "id": "View 1",
60
+ "path": "files/derivative/Scaffolds/M11_view.json",
61
+ "sample": "Sample 1",
62
+ "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M11_thumbnail.jpeg"
63
+ },
64
+ {
65
+ "annotation": "--",
66
+ "description": "Digital tracing of neurons for subject M16.",
67
+ "id": "View 2",
68
+ "path": "files/derivative/Scaffolds/M16_view.json",
69
+ "sample": "Sample 2",
70
+ "thumbnail": "https://api.sparc.science/s3-resource/221/2/files/derivative/Scaffolds/M16_thumbnail.jpeg"
71
+ }
72
+ ]
73
+ }
74
+ }