@abi-software/flatmapvuer 0.5.7 → 0.5.9-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "0.5.7",
3
+ "version": "0.5.9-beta.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/flatmapvuer.common.js",
6
6
  "files": [
package/src/App.vue CHANGED
@@ -123,6 +123,7 @@ export default {
123
123
  "Kember":{taxo: "ABI:1000001", displayWarning:true},
124
124
  "Pig":{taxo: "NCBITaxon:9823", iconClass:"mapicon-icon_pig", displayWarning:true},
125
125
  "Cat":{taxo: "NCBITaxon:9685", iconClass:"mapicon-icon_cat", displayWarning:true},
126
+ "Sample":{taxo: "NCBITaxon:1", displayWarning:true},
126
127
  "Functional Connectivity": {taxo: "FunctionalConnectivity", displayWarning:true},
127
128
  },
128
129
  tooltipContent: undefined,
@@ -0,0 +1,344 @@
1
+ <template>
2
+ <el-main class="main">
3
+ <div class="block">
4
+ <el-row class="info-field">
5
+ <span class="title">Feature Annotations</span>
6
+ </el-row>
7
+ <template v-if="annotationEntry">
8
+ <el-row
9
+ v-for="(key, label) in displayPair"
10
+ v-show="annotationEntry[key]"
11
+ class="dialog-text"
12
+ :key="key"
13
+ >
14
+ <strong>{{ label }}: </strong> {{ annotationEntry[key] }}
15
+ </el-row>
16
+ <template v-if="prevSubs.length > 0">
17
+ <div v-show="showSubmissions" class="hide" @click="showSubmissions = false">
18
+ Hide previous submissions
19
+ <i class="el-icon-arrow-up"></i>
20
+ </div>
21
+ <div v-show="!showSubmissions" class="hide" @click="showSubmissions = true">
22
+ Show previous submissions
23
+ <i class="el-icon-arrow-down"></i>
24
+ </div>
25
+ <template v-if="showSubmissions">
26
+ <el-row class="dialog-spacer"></el-row>
27
+ <el-row class="dialog-text">
28
+ <strong class="sub-title">Previous submissions:</strong>
29
+ </el-row>
30
+ <div class="entry" v-for="(sub, index) in prevSubs" :key="index">
31
+ <el-row class="dialog-text">
32
+ <strong>{{ sub.timestamp }}</strong> Anonoymous
33
+ </el-row>
34
+ <el-row class="dialog-text">
35
+ <strong>Evidence: </strong> {{ sub.evidence.join(', ') }}
36
+ </el-row>
37
+ <el-row class="dialog-text">
38
+ <strong>Comment: </strong> {{ sub.comment }}
39
+ </el-row>
40
+ </div>
41
+ </template>
42
+ </template>
43
+ <el-row class="dialog-spacer"></el-row>
44
+ <el-row v-if="!editing">
45
+ <i
46
+ class="el-icon-edit standard-icon"
47
+ @click="editing = true"
48
+ />
49
+ </el-row>
50
+ <template v-else>
51
+ <el-row class="dialog-text">
52
+ <strong class="sub-title">Suggest changes:</strong>
53
+ </el-row>
54
+ <el-row class="dialog-text">
55
+ <strong>Evidvence:</strong>
56
+ </el-row>
57
+ <el-row v-for="(value, index) in evidence" :key="value">
58
+ <el-col :span="20">
59
+ {{ evidence[index] }}
60
+ </el-col>
61
+ <el-col :span="4">
62
+ <i
63
+ class="el-icon-close standard-icon"
64
+ @click="removeEvidence(index)"
65
+ />
66
+ </el-col>
67
+ </el-row>
68
+ <el-row>
69
+ <el-input
70
+ size="mini"
71
+ placeholder="Enter"
72
+ v-model="newEvidence"
73
+ @change="evidenceEntered($event)"
74
+ >
75
+ <el-select
76
+ :popper-append-to-body="false"
77
+ v-model="evidencePrefix"
78
+ placeholder="Select"
79
+ class="select-box"
80
+ popper-class="flatmap_dropdown"
81
+ slot="prepend"
82
+ >
83
+ <el-option v-for="item in evidencePrefixes" :key="item" :label="item" :value="item">
84
+ <el-row>
85
+ <el-col :span="12">{{ item }}</el-col>
86
+ </el-row>
87
+ </el-option>
88
+ </el-select>
89
+ </el-input>
90
+ </el-row>
91
+ <el-row>
92
+ <strong>Comment:</strong>
93
+ </el-row>
94
+ <el-row class="dialog-text">
95
+
96
+ <el-input
97
+ type="textarea"
98
+ :autosize="{ minRows: 2, maxRows: 4}"
99
+ placeholder="Enter"
100
+ v-model="comment"
101
+ />
102
+ </el-row>
103
+ <el-row class="dialog-text">
104
+ <el-button
105
+ class="button"
106
+ type="primary"
107
+ plain
108
+ @click="submit"
109
+ >
110
+ Submit
111
+ </el-button>
112
+ </el-row>
113
+ </template>
114
+ </template>
115
+ </div>
116
+ </el-main>
117
+ </template>
118
+
119
+
120
+ <script>
121
+ /* eslint-disable no-alert, no-console */
122
+ /* eslint-disable no-alert, no-console */
123
+ import Vue from "vue";
124
+ import { Button, Col, Input, Main, Row, Select } from "element-ui";
125
+ import lang from "element-ui/lib/locale/lang/en";
126
+ import locale from "element-ui/lib/locale";
127
+ locale.use(lang);
128
+ Vue.use(Button);
129
+ Vue.use(Col);
130
+ Vue.use(Input);
131
+ Vue.use(Main);
132
+ Vue.use(Row);
133
+ Vue.use(Select);
134
+
135
+ export default {
136
+ name: "AnnotationTool",
137
+ props: {
138
+ annotationEntry: {
139
+ type: Object,
140
+ },
141
+ },
142
+ data: function() {
143
+ return {
144
+ displayPair: {
145
+ "Feature": "id",
146
+ "Tooltip": "label",
147
+ "Models": "models",
148
+ "Name": "name",
149
+ "Map layer": "layer",
150
+ },
151
+ editing: false,
152
+ evidencePrefixes: [
153
+ "DOI:",
154
+ "PMID:",
155
+ ],
156
+ evidencePrefix: "DOI:",
157
+ evidence: [ ],
158
+ newEvidence: '',
159
+ comment: '',
160
+ submissions: [ ],
161
+ showSubmissions: true
162
+ }
163
+ },
164
+ computed: {
165
+ prevSubs: function() {
166
+ return this.submissions.filter(sub => {
167
+ if (this.annotationEntry) {
168
+ if (sub.id === this.annotationEntry.id &&
169
+ sub.layer === this.annotationEntry.layer) {
170
+ return true;
171
+ }
172
+ }
173
+ return false;
174
+ });
175
+ }
176
+ },
177
+ methods: {
178
+ evidenceEntered: function(value) {
179
+ if (value) {
180
+ this.evidence.push(this.evidencePrefix + value);
181
+ this.newEvidence = "";
182
+ }
183
+ },
184
+ submit: function() {
185
+ const now = new Date();
186
+ if ((this.evidence.length > 0) || this.comment) {
187
+ this.submissions.push( {
188
+ id: this.annotationEntry['id'],
189
+ layer: this.annotationEntry['layer'],
190
+ evidence: this.evidence,
191
+ comment: this.comment,
192
+ timestamp: now.toLocaleString(),
193
+ });
194
+ this.resetSubmission();
195
+ }
196
+ },
197
+ removeEvidence: function(index) {
198
+ this.evidence.splice(index, 1);
199
+ },
200
+ resetSubmission: function() {
201
+ this.editing = false;
202
+ this.evidence = [];
203
+ this.newFeature = '';
204
+ this.comment = '';
205
+ },
206
+ },
207
+ watch: {
208
+ annotationEntry: {
209
+ handler: function() {
210
+ this.resetSubmission();
211
+ },
212
+ immediate: false,
213
+ deep: false,
214
+ }
215
+ }
216
+ };
217
+ </script>
218
+
219
+ <style scoped lang="scss">
220
+ @import "~element-ui/packages/theme-chalk/src/button";
221
+ @import "~element-ui/packages/theme-chalk/src/col";
222
+ @import "~element-ui/packages/theme-chalk/src/input";
223
+ @import "~element-ui/packages/theme-chalk/src/main";
224
+ @import "~element-ui/packages/theme-chalk/src/row";
225
+ @import "~element-ui/packages/theme-chalk/src/select";
226
+
227
+ .info-field {
228
+ display:flex;
229
+ }
230
+
231
+ .block {
232
+ margin-bottom: 0.5em;
233
+ }
234
+
235
+ .button {
236
+ padding-top:5px;
237
+ padding-bottom:5px;
238
+ }
239
+
240
+ .standard-icon {
241
+ color: $app-primary-color;
242
+ &:hover {
243
+ cursor: pointer;
244
+ }
245
+ }
246
+
247
+ .dialog-text {
248
+ color: rgb(48, 49, 51);
249
+ font-size: 14px;
250
+ font-weight: normal;
251
+ line-height: 20px;
252
+ }
253
+
254
+ .main {
255
+ font-size: 14px;
256
+ text-align: left;
257
+ line-height: 1.5em;
258
+ font-family: Asap, sans-serif,Helvetica;
259
+ font-weight: 400;
260
+ /* outline: thin red solid; */
261
+ padding: 1em !important;
262
+ overflow-x: hidden;
263
+ overflow-y: auto;
264
+ min-width: 20rem;
265
+ max-height: 400px;
266
+ scrollbar-width: thin;
267
+
268
+ &::-webkit-scrollbar {
269
+ width: 4px;
270
+ }
271
+
272
+ &::-webkit-scrollbar-thumb {
273
+ border-radius: 10px;
274
+ box-shadow: inset 0 0 6px #c0c4cc;
275
+ }
276
+ }
277
+
278
+ .title {
279
+ font-size: 18px;
280
+ font-weight: 500;
281
+ font-weight: bold;
282
+ padding-bottom: 8px;
283
+ color: rgb(131, 0, 191);
284
+ }
285
+
286
+ .sub-title {
287
+ font-size: 16px;
288
+ }
289
+
290
+
291
+ .dialog-spacer {
292
+ border-bottom: 1px solid #e4e7ed;
293
+ margin-bottom: 10px;
294
+ }
295
+
296
+ .submit {
297
+ color: $app-primary-color;
298
+ &:hover {
299
+ cursor: pointer;
300
+ }
301
+ }
302
+
303
+ .entry ~ .entry {
304
+ border-top: 1px solid #e4e7ed;
305
+ margin-top: 10px;
306
+ }
307
+
308
+ .hide{
309
+ color: $app-primary-color;
310
+ cursor: pointer;
311
+ margin-right: 6px;
312
+ margin-top: 3px;
313
+ }
314
+
315
+ ::v-deep .el-input__inner, ::v-deep .el-textarea__inner{
316
+ font-family: Asap, sans-serif;
317
+ }
318
+
319
+ .select-box {
320
+ width:80px;
321
+ background-color: var(--white);
322
+ font-weight: 500;
323
+ color:rgb(48, 49, 51);;
324
+ ::v-deep .el-input__inner {
325
+ height:30px;
326
+ color: rgb(48, 49, 51);
327
+ }
328
+ ::v-deep .el-input__icon {
329
+ line-height:30px
330
+ }
331
+ }
332
+
333
+ ::v-deep .flatmap_dropdown {
334
+ min-width: 80px!important;
335
+ .el-select-dropdown__item {
336
+ white-space: nowrap;
337
+ text-align: left;
338
+ &.selected {
339
+ color: $app-primary-color;
340
+ font-weight: normal;
341
+ }
342
+ }
343
+ }
344
+ </style>
@@ -280,6 +280,24 @@
280
280
  trigger="click"
281
281
  popper-class="background-popper"
282
282
  >
283
+ <el-row class="backgroundText">Viewing Mode</el-row>
284
+
285
+ <el-row class="backgroundControl">
286
+ <el-select
287
+ :popper-append-to-body="false"
288
+ v-model="viewingMode"
289
+ placeholder="Select"
290
+ class="select-box"
291
+ popper-class="flatmap_dropdown"
292
+ >
293
+ <el-option v-for="item in viewingModes" :key="item" :label="item" :value="item">
294
+ <el-row>
295
+ <el-col :span="12">{{ item }}</el-col>
296
+ </el-row>
297
+ </el-option>
298
+ </el-select>
299
+ </el-row>
300
+ <el-row class="backgroundSpacer"></el-row>
283
301
  <el-row class="backgroundText">Organs display</el-row>
284
302
  <el-row class="backgroundControl">
285
303
  <el-radio-group v-model="colourRadio" class="flatmap-radio" @change="setColour">
@@ -353,7 +371,9 @@
353
371
  <Tooltip
354
372
  ref="tooltip"
355
373
  class="tooltip"
374
+ :annotationEntry="annotationEntry"
356
375
  :entry="tooltipEntry"
376
+ :annotationDisplay="viewingMode === 'Annotation'"
357
377
  />
358
378
  </div>
359
379
  </div>
@@ -373,7 +393,8 @@ import {
373
393
  Loading,
374
394
  Radio,
375
395
  RadioGroup,
376
- Row
396
+ Row,
397
+ Select,
377
398
  } from "element-ui";
378
399
  import lang from "element-ui/lib/locale/lang/en";
379
400
  import locale from "element-ui/lib/locale";
@@ -387,6 +408,7 @@ Vue.use(Loading.directive);
387
408
  Vue.use(Radio);
388
409
  Vue.use(RadioGroup);
389
410
  Vue.use(Row);
411
+ Vue.use(Select);
390
412
  const ResizeSensor = require("css-element-queries/src/ResizeSensor");
391
413
 
392
414
  const processTaxon = (flatmapAPI, taxonIdentifiers) => {
@@ -657,13 +679,22 @@ export default {
657
679
  // checkNeuronClicked shows a neuron path pop up if a path was recently clicked
658
680
  checkAndCreatePopups: async function(data) {
659
681
  // Call flatmap database to get the connection data
660
- let results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(data)
661
- // The line below only creates the tooltip if some data was found on the path
662
- // result 0 is the connection, result 1 is the pubmed results from flatmap
663
- if(results[0] || results[1] ||( data.feature.hyperlinks && data.feature.hyperlinks.length > 0)){
664
- this.resourceForTooltip = data.resource[0];
665
- this.createTooltipFromNeuronCuration(data);
666
- }
682
+ if (this.viewingMode === "Annotation") {
683
+ const annotation = this.mapImp.annotation( this.mapImp.modelFeatureIds(data.resource[0]));
684
+ if (annotation) {
685
+ this.annotationEntry = {...annotation};
686
+ this.displayTooltip(data.resource[0]);
687
+ } else {
688
+ this.annotation = { };
689
+ }
690
+ } else {
691
+ let results = await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(data)
692
+ // The line below only creates the tooltip if some data was found on the path
693
+ // result 0 is the connection, result 1 is the pubmed results from flatmap
694
+ if(results[0] || results[1] ||( data.feature.hyperlinks && data.feature.hyperlinks.length > 0)){
695
+ this.createTooltipFromNeuronCuration(data);
696
+ }
697
+ }
667
698
  },
668
699
  popUpCssHacks: function() {
669
700
  // Below is a hack to remove flatmap tooltips while popup is open
@@ -679,7 +710,7 @@ export default {
679
710
  },
680
711
  createTooltipFromNeuronCuration: async function(data) {
681
712
  this.tooltipEntry = await this.flatmapQueries.createTooltipData(data);
682
- this.displayTooltip();
713
+ this.displayTooltip(data.resource[0]);
683
714
  },
684
715
  // Keeping this as an API
685
716
  showPopup: function(featureId, node, options) {
@@ -748,9 +779,9 @@ export default {
748
779
  }, 500);
749
780
  }
750
781
  },
751
- displayTooltip: function() {
782
+ displayTooltip: function(feature) {
752
783
  this.mapImp.showPopup(
753
- this.mapImp.modelFeatureIds(this.resourceForTooltip)[0],
784
+ this.mapImp.modelFeatureIds(feature)[0],
754
785
  this.$refs.tooltip.$el,
755
786
  { className: "flatmapvuer-popover", positionAtLastClick: true }
756
787
  );
@@ -1112,6 +1143,9 @@ export default {
1112
1143
  },
1113
1144
  data: function() {
1114
1145
  return {
1146
+ annotationEntry: {
1147
+
1148
+ },
1115
1149
  layers: [],
1116
1150
  pathways: [],
1117
1151
  sckanDisplay: [
@@ -1149,14 +1183,19 @@ export default {
1149
1183
  flatmapMarker: flatmapMarker,
1150
1184
  tooltipEntry: createUnfilledTooltipData(),
1151
1185
  connectivityTooltipVisible: false,
1152
- resourceForTooltip: undefined,
1153
1186
  drawerOpen: false,
1187
+ annotationRadio: false,
1154
1188
  colourRadio: true,
1155
1189
  outlinesRadio: true,
1156
1190
  minimapResizeShow: false,
1157
1191
  minimapSmall: false,
1158
1192
  currentActive: "",
1159
1193
  currentHover: "",
1194
+ viewingMode: "Exploration",
1195
+ viewingModes: [
1196
+ "Annotation",
1197
+ "Exploration",
1198
+ ]
1160
1199
  };
1161
1200
  },
1162
1201
  watch: {
@@ -1203,6 +1242,7 @@ export default {
1203
1242
  @import "~element-ui/packages/theme-chalk/src/button";
1204
1243
  @import "~element-ui/packages/theme-chalk/src/loading";
1205
1244
  @import "~element-ui/packages/theme-chalk/src/row";
1245
+ @import "~element-ui/packages/theme-chalk/src/select";
1206
1246
 
1207
1247
  .beta-popovers {
1208
1248
  position: absolute;
@@ -1227,7 +1267,7 @@ export default {
1227
1267
  }
1228
1268
 
1229
1269
  .latest-map-text {
1230
- color: $app-primary-color;;
1270
+ color: $app-primary-color;
1231
1271
  font-family: Asap, sans-serif;
1232
1272
  font-size: 12px;
1233
1273
  margin-top: 5px;
@@ -1461,7 +1501,7 @@ export default {
1461
1501
  background-color: #ffffff;
1462
1502
  border: 1px solid $app-primary-color;
1463
1503
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
1464
- height: 200px;
1504
+ height: 270px;
1465
1505
  width: 175px;
1466
1506
  min-width: 175px;
1467
1507
  &.el-popper[x-placement^="top"] {
@@ -1511,7 +1551,7 @@ export default {
1511
1551
 
1512
1552
  .backgroundControl {
1513
1553
  display: flex;
1514
- margin-top: 16px;
1554
+ margin-top: 12px;
1515
1555
  }
1516
1556
 
1517
1557
  .backgroundChoice {
@@ -1749,7 +1789,7 @@ export default {
1749
1789
  margin-right: 0px;
1750
1790
  }
1751
1791
  }
1752
- .el-radio__input {
1792
+ ::v-deep .el-radio__input {
1753
1793
  &.is-checked {
1754
1794
  & + .el-radio__label {
1755
1795
  color: $app-primary-color;
@@ -1759,6 +1799,9 @@ export default {
1759
1799
  background: $app-primary-color;
1760
1800
  }
1761
1801
  }
1802
+ .el-radio__inner:hover {
1803
+ border-color: $app-primary-color;
1804
+ }
1762
1805
  }
1763
1806
  }
1764
1807
 
@@ -1837,5 +1880,37 @@ export default {
1837
1880
  }
1838
1881
  }
1839
1882
  }
1883
+
1884
+ .select-box {
1885
+ border-radius: 4px;
1886
+ border: 1px solid rgb(144, 147, 153);
1887
+ background-color: var(--white);
1888
+ font-weight: 500;
1889
+ color:rgb(48, 49, 51);;
1890
+ ::v-deep .el-input__inner {
1891
+ height:30px;
1892
+ color: rgb(48, 49, 51);
1893
+ }
1894
+ ::v-deep .el-input__inner {
1895
+ &is-focus, &:focus {
1896
+ border: 1px solid $app-primary-color;
1897
+ }
1898
+ }
1899
+ ::v-deep .el-input__icon {
1900
+ line-height:30px
1901
+ }
1902
+ }
1903
+
1904
+ ::v-deep .flatmap_dropdown {
1905
+ min-width: 160px!important;
1906
+ .el-select-dropdown__item {
1907
+ white-space: nowrap;
1908
+ text-align: left;
1909
+ &.selected {
1910
+ color: $app-primary-color;
1911
+ font-weight: normal;
1912
+ }
1913
+ }
1914
+ }
1840
1915
  </style>
1841
1916
 
@@ -476,14 +476,16 @@ export default {
476
476
  border: 1px solid rgb(144, 147, 153);
477
477
  background-color: var(--white);
478
478
  font-weight: 500;
479
- color:rgb(48, 49, 51);;
479
+ color:rgb(48, 49, 51);
480
480
  left: 16px;
481
481
  top: 44px;
482
482
  position: absolute;
483
483
  ::v-deep .el-input__inner {
484
484
  color: rgb(48, 49, 51);
485
485
  padding-top: 0.25em;
486
- .is-focus {
486
+ }
487
+ ::v-deep .el-input__inner {
488
+ &is-focus, &:focus {
487
489
  border: 1px solid $app-primary-color;
488
490
  }
489
491
  }