imerss-bioinfo 1.10.0 → 1.12.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.
Files changed (37) hide show
  1. package/build.js +113 -60
  2. package/docs/css/imerss-bbea.css +171 -0
  3. package/docs/css/imerss-core.css +311 -0
  4. package/docs/css/imerss-viz-lib.css +697 -0
  5. package/docs/css/imerss-viz.css +548 -0
  6. package/docs/css/xetthecum.css +0 -69
  7. package/docs/js/imerss-viz-all.js +7 -2
  8. package/docs/js/imerss-viz-all.js.map +1 -1
  9. package/docs/js/imerss-viz-lib.js +78 -0
  10. package/docs/js/imerss-viz-lib.js.map +1 -0
  11. package/docs/js/imerss-viz-new.js +2 -0
  12. package/docs/js/imerss-viz-new.js.map +1 -0
  13. package/indexBeasOBA.html +143 -0
  14. package/indexWithMapXetthecum.html +1 -0
  15. package/package.json +7 -5
  16. package/src/assignBNames.js +40 -17
  17. package/src/assignNames.js +34 -16
  18. package/src/assigniNatImages.js +101 -0
  19. package/src/buildSource/Xetthecum WoL.html +46 -0
  20. package/src/buildSource/index.html +20 -20
  21. package/src/buildSource/indexBeasOBA.html +96 -0
  22. package/src/client/css/imerss-bbea.css +80 -10
  23. package/src/client/css/imerss-core.css +26 -2
  24. package/src/client/css/xetthecum.css +0 -69
  25. package/src/client/html/imerss-viz-nomap-wol.html +87 -0
  26. package/src/client/js/colour.js +13 -0
  27. package/src/client/js/imerss-viz.js +3 -3
  28. package/src/client/js/new/imerss-new.js +727 -258
  29. package/src/client/js/new/newChecklist.js +237 -47
  30. package/src/geom/geoJSON.js +7 -7
  31. package/src/iNaturalist/taxonAPI.js +12 -5
  32. package/src/inatObs.js +13 -0
  33. package/src/lib/hash-table.js +954 -0
  34. package/src/lib/signals-core.min.js +1 -0
  35. package/src/marmalise.js +22 -1
  36. package/src/taxonomise.js +11 -11
  37. package/test/testiNatDisambig.js +2 -1
package/build.js CHANGED
@@ -2,10 +2,12 @@
2
2
  "use strict";
3
3
 
4
4
  const readline = require("readline"),
5
+ glob = require("glob"),
5
6
  fs = require("fs-extra");
6
7
 
7
8
  const fluid = require("infusion");
8
9
  const terser = require("terser");
10
+ const path = require("path");
9
11
 
10
12
  const buildIndex = {
11
13
  excludes: [
@@ -16,6 +18,7 @@ const buildIndex = {
16
18
  "src/auxBuild/restoreJQuery.js",
17
19
  "src/lib/jquery-ui-widgets-tabs.js",
18
20
  "src/lib/lz4.js",
21
+ "src/lib/signals-core.min.js",
19
22
  "src/client/js/imerss-viz.js",
20
23
  "src/client/js/autocomplete.js",
21
24
  "src/client/js/colour.js",
@@ -29,6 +32,16 @@ const buildIndex = {
29
32
  "src/client/js/checklist.js",
30
33
  "src/client/js/xetthecum.js"
31
34
  ],
35
+ newSource: [
36
+ "src/lib/hash-table.js",
37
+ "src/lib/signals-core.min.js",
38
+ "src/client/js/colour.js",
39
+ "src/client/js/renderSVG.js",
40
+ "src/client/js/new/imerss-new.js",
41
+ "src/client/js/autocomplete.js",
42
+ "src/client/js/tabs.js",
43
+ "src/client/js/new/newChecklist.js"
44
+ ],
32
45
  codeHeader: "",
33
46
  codeFooter: "", // "\njQuery.noConflict()",
34
47
  copy: [{
@@ -44,47 +57,11 @@ const buildIndex = {
44
57
  src: "src/client/html",
45
58
  dest: "docs/html"
46
59
  }, {
47
- src: "src/client/css/imerss-viz-wp-overrides.css",
48
- dest: "docs/css/imerss-viz-wp-overrides.css"
49
- }, {
50
- src: "src/client/css/xetthecum.css",
51
- dest: "docs/css/xetthecum.css"
52
- }, {
53
- src: "src/client/css/xetthecum-shared.css",
54
- dest: "docs/css/xetthecum-shared.css"
55
- }, {
56
- src: "src/client/css/xetthecum-external.css",
57
- dest: "docs/css/xetthecum-external.css"
58
- }, {
59
- src: "src/client/css/pepiowelh.css",
60
- dest: "docs/css/pepiowelh.css"
61
- }, {
62
- src: "src/buildSource/Galiano Life List.html",
63
- dest: "docs/Galiano Life List.html"
64
- }, {
65
- src: "src/buildSource/Comprehensive Lists.html",
66
- dest: "docs/Comprehensive Lists.html"
60
+ src: "src/client/css/*.css",
61
+ dest: "docs/css"
67
62
  }, {
68
- src: "src/buildSource/Squamish Life List.html",
69
- dest: "docs/Squamish Life List.html"
70
- }, {
71
- src: "src/buildSource/dataPaperSunburstAndMap.html",
72
- dest: "docs/dataPaperSunburstAndMap.html"
73
- }, {
74
- src: "src/buildSource/Data Paper Part I Visualisation.html",
75
- dest: "docs/Data Paper Part I Visualisation.html"
76
- }, {
77
- src: "src/buildSource/Valdes Island Biodiversity.html",
78
- dest: "docs/Valdes Island Biodiversity.html"
79
- }, {
80
- src: "src/buildSource/Xetthecum.html",
81
- dest: "docs/Xetthecum.html"
82
- }, {
83
- src: "src/buildSource/Pe'pi'ow'elh.html",
84
- dest: "docs/Pe'pi'ow'elh.html"
85
- }, {
86
- src: "src/buildSource/index.html",
87
- dest: "docs/index.html"
63
+ src: "src/buildSource/*.html",
64
+ dest: "docs/"
88
65
  }, {
89
66
  src: "data/dataPaper-I/Life.json.lz4",
90
67
  dest: "docs/data/dataPaper-I/Life.json.lz4"
@@ -112,6 +89,12 @@ const buildIndex = {
112
89
  }, {
113
90
  src: "data/Pepiowelh/Life.json.lz4",
114
91
  dest: "docs/data/Pepiowelh/Life.json.lz4"
92
+ }, {
93
+ src: "data/b-team/plant-pollinators-OBA-assigned-subset.csv",
94
+ dest: "docs/data/b-team/plant-pollinators-OBA-assigned-subset.csv"
95
+ }, {
96
+ src: "data/b-team/plant-pollinators-OBA-assigned-taxa.csv",
97
+ dest: "docs/data/b-team/plant-pollinators-OBA-assigned-taxa.csv"
115
98
  }]
116
99
  };
117
100
 
@@ -135,6 +118,46 @@ const readLines = function (filename) {
135
118
  return togo;
136
119
  };
137
120
 
121
+ // These two taken from reknit.js
122
+
123
+ const copyGlob = function (sourcePattern, targetDir) {
124
+ console.log("copyGlob ", sourcePattern);
125
+ const fileNames = glob.sync(sourcePattern);
126
+ console.log("Got files ", fileNames);
127
+ fileNames.forEach(filePath => {
128
+ const fileName = path.basename(filePath);
129
+ const destinationPath = path.join(targetDir, fileName);
130
+
131
+ fs.ensureDirSync(path.dirname(destinationPath));
132
+ fs.copyFileSync(filePath, destinationPath);
133
+ console.log(`Copied file: ${fileName}`);
134
+ });
135
+ };
136
+
137
+ /** Copy dependencies into docs directory for GitHub pages **/
138
+
139
+ const copyDep = function (source, target, replaceSource, replaceTarget) {
140
+ const targetPath = fluid.module.resolvePath(target);
141
+ const sourceModule = fluid.module.refToModuleName(source);
142
+ if (sourceModule && sourceModule !== "maxwell") {
143
+ require(sourceModule);
144
+ }
145
+ const sourcePath = fluid.module.resolvePath(source);
146
+ if (replaceSource) {
147
+ const text = fs.readFileSync(sourcePath, "utf8");
148
+ const replaced = text.replace(replaceSource, replaceTarget);
149
+ fs.writeFileSync(targetPath, replaced, "utf8");
150
+ console.log(`Copied file: ${targetPath}`);
151
+ } else if (sourcePath.includes("*")) {
152
+ copyGlob(sourcePath, targetPath);
153
+ } else {
154
+ fs.ensureDirSync(path.dirname(targetPath));
155
+ fs.copySync(sourcePath, targetPath);
156
+ console.log(`Copied file: ${targetPath}`);
157
+ }
158
+ };
159
+
160
+
138
161
  const filesToContentHash = function (allFiles, extension) {
139
162
  const extFiles = allFiles.filter(function (file) {
140
163
  return file.endsWith(extension);
@@ -154,15 +177,15 @@ const computeAllFiles = function (buildIndex, nodeFiles) {
154
177
  return withExcludes.concat(buildIndex.localSource);
155
178
  };
156
179
 
157
- const buildFromFiles = function (buildIndex, nodeFiles) {
180
+ const buildFromFiles = async function (buildIndex, nodeFiles) {
158
181
  const allFiles = computeAllFiles(buildIndex, nodeFiles);
159
- console.log("allFiles " + allFiles);
182
+ console.log("allFiles ", allFiles);
160
183
  nodeFiles.concat(buildIndex.localSource);
161
184
 
162
185
  const jsHash = filesToContentHash(allFiles, ".js");
163
186
  const fullJsHash = fluid.extend({header: buildIndex.codeHeader}, jsHash, {footer: buildIndex.codeFooter});
164
187
  fluid.log("Minifying " + Object.keys(fullJsHash).length + " JS files ... ");
165
- const promise = terser.minify(fullJsHash, {
188
+ const minifiedAll = await terser.minify(fullJsHash, {
166
189
  mangle: false,
167
190
  sourceMap: {
168
191
  filename: "imerss-viz-all.js",
@@ -170,30 +193,60 @@ const buildFromFiles = function (buildIndex, nodeFiles) {
170
193
  root: "../.."
171
194
  }
172
195
  });
173
- promise.then(function (minified) {
174
- fs.removeSync("docs");
175
- fs.ensureDirSync("docs/js");
176
- fs.writeFileSync("docs/js/imerss-viz-all.js", minified.code, "utf8");
177
- fs.writeFileSync("docs/js/imerss-viz-all.js.map", minified.map);
178
-
179
- const cssHash = filesToContentHash(allFiles, ".css");
180
- const cssConcat = String.prototype.concat.apply("", Object.values(cssHash));
181
-
182
- fs.ensureDirSync("docs/css");
183
- fs.writeFileSync("docs/css/imerss-viz-all.css", cssConcat);
184
- buildIndex.copy.forEach(function (oneCopy) {
185
- fs.copySync(oneCopy.src, oneCopy.dest);
186
- });
187
- fluid.log("Copied " + (buildIndex.copy.length + 3) + " files to " + fs.realpathSync("docs"));
196
+ // imerss-viz-lib.js contains just upstream libraries we depend on, to support reasonably easy deploy of "new" framework
197
+ const libJsHash = filesToContentHash(nodeFiles, ".js");
198
+ console.log("nodeFiles ", nodeFiles);
199
+ fluid.log("Minifying " + Object.keys(libJsHash).length + " JS files ... ");
200
+ const minifiedLib = await terser.minify(libJsHash, {
201
+ mangle: false,
202
+ sourceMap: {
203
+ filename: "imerss-viz-lib.js",
204
+ url: "imerss-viz-lib.js.map",
205
+ root: "../.."
206
+ }
207
+ });
208
+ const newJsHash = filesToContentHash(buildIndex.newSource, ".js");
209
+ console.log("newFiles " + buildIndex.newSource);
210
+ fluid.log("Minifying " + Object.keys(newJsHash).length + " JS files ... ");
211
+ const newLib = await terser.minify(newJsHash, {
212
+ mangle: false,
213
+ sourceMap: {
214
+ filename: "imerss-viz-new.js",
215
+ url: "imerss-viz-new.js.map",
216
+ root: "../.."
217
+ }
218
+ });
219
+
220
+ fs.removeSync("docs");
221
+ fs.ensureDirSync("docs/js");
222
+ fs.writeFileSync("docs/js/imerss-viz-all.js", minifiedAll.code, "utf8");
223
+ fs.writeFileSync("docs/js/imerss-viz-all.js.map", minifiedAll.map);
224
+ fs.writeFileSync("docs/js/imerss-viz-lib.js", minifiedLib.code, "utf8");
225
+ fs.writeFileSync("docs/js/imerss-viz-lib.js.map", minifiedLib.map);
226
+ fs.writeFileSync("docs/js/imerss-viz-new.js", newLib.code, "utf8");
227
+ fs.writeFileSync("docs/js/imerss-viz-new.js.map", newLib.map);
228
+
229
+ const cssHash = filesToContentHash(allFiles, ".css");
230
+ const cssConcat = String.prototype.concat.apply("", Object.values(cssHash));
231
+
232
+ const cssLibHash = filesToContentHash(nodeFiles, ".css");
233
+ const cssLibConcat = String.prototype.concat.apply("", Object.values(cssLibHash));
234
+
235
+ fs.ensureDirSync("docs/css");
236
+ fs.writeFileSync("docs/css/imerss-viz-all.css", cssConcat);
237
+ fs.writeFileSync("docs/css/imerss-viz-lib.css", cssLibConcat);
238
+ buildIndex.copy.forEach(function (oneCopy) {
239
+ copyDep(oneCopy.src, oneCopy.dest);
188
240
  });
241
+ fluid.log("Copied " + (buildIndex.copy.length + 3) + " files to " + fs.realpathSync("docs"));
189
242
  };
190
243
 
191
244
  fluid.setLogging(true);
192
245
 
193
246
  const linesPromise = readLines("gh-pages-nm.txt");
194
247
 
195
- linesPromise.then(function (lines) {
196
- buildFromFiles(buildIndex, lines);
248
+ linesPromise.then(async function (lines) {
249
+ await buildFromFiles(buildIndex, lines);
197
250
  }, function (error) {
198
251
  console.log(error);
199
252
  });
@@ -0,0 +1,171 @@
1
+
2
+ /* Why is this "column" in core? What does it look like ... */
3
+ .fl-imerss-map-and-taxa {
4
+ flex-direction: row;
5
+ }
6
+
7
+ .fl-imerss-checklists {
8
+ display: flex;
9
+ flex-direction: row;
10
+ height: 60%;
11
+ overflow: hidden;
12
+ }
13
+
14
+ .fl-imerss-checklists * {
15
+ box-sizing: border-box;
16
+ }
17
+
18
+ /* Grabbed definition for default "checked" to apply to indeterminate checkboxes */
19
+ .pretty input:indeterminate~.state label:after {
20
+ background-color: #bdc3c7!important;
21
+ transform: scale(.6);
22
+ }
23
+
24
+ .pretty .state label:after, .pretty .state label:before {
25
+ width: calc(1em + 0px);
26
+ height: calc(1em + 0px);
27
+ }
28
+
29
+ .pretty.p-icon .state .icon {
30
+ width: calc(1em + 0px);
31
+ height: calc(1em + 0px);
32
+ }
33
+
34
+ .pretty {
35
+ margin-right: 0.3em;
36
+ }
37
+
38
+ .fl-imerss-pollinators {
39
+ width: 30%;
40
+ min-width: 30%;
41
+ }
42
+
43
+ .fl-imerss-interactions {
44
+ padding: 0.5em;
45
+ width: 40%;
46
+ height: 100%;
47
+ display: flex;
48
+ flex-direction: column;
49
+ }
50
+
51
+ .fl-imerss-plants {
52
+ width: 30%;
53
+ min-width: 30%;
54
+ }
55
+
56
+ .fl-imerss-interactions-holder {
57
+ height: 100%;
58
+ display: flex;
59
+ flex-direction: column;
60
+ }
61
+
62
+ .fl-imerss-int-left {
63
+ flex: 0 0 180px;
64
+ }
65
+
66
+ .fl-imerss-int-right {
67
+ flex: 0 0 3em;
68
+ }
69
+
70
+ .fl-imerss-int-h-middle {
71
+ overflow-x: scroll;
72
+ }
73
+
74
+ .fl-imerss-int-top {
75
+ flex: 0 0 3em;
76
+ }
77
+
78
+ .fl-imerss-int-v-middle {
79
+ flex: 1 1 auto;
80
+ overflow-y: hidden;
81
+ }
82
+
83
+ .fl-imerss-int-bottom {
84
+ flex: 0 0 180px;
85
+ }
86
+
87
+
88
+ .fl-imerss-int-row {
89
+ display: flex;
90
+ flex-direction: row;
91
+ }
92
+
93
+ .fld-imerss-poll-names {
94
+ position: relative;
95
+ flex: 1 1 auto;
96
+ display: flex;
97
+ align-items: end;
98
+ margin-right: calc(var(--imerss-scrollbar-width) + 4px);
99
+ overflow-x: hidden;
100
+ }
101
+
102
+ .fld-imerss-poll-counts {
103
+ position: relative;
104
+ display: flex;
105
+ align-items: end;
106
+ overflow-x: hidden;
107
+ margin-right: calc(var(--imerss-scrollbar-width) + 4px);
108
+ }
109
+
110
+ .fld-imerss-plant-names {
111
+ margin-bottom: calc(var(--imerss-scrollbar-width) + 4px);
112
+ }
113
+
114
+ .fld-imerss-plant-counts {
115
+ margin-left: 4px;
116
+ margin-bottom: calc(var(--imerss-scrollbar-width) + 4px);
117
+ }
118
+
119
+ .fld-imerss-plant-names, .fld-imerss-plant-counts {
120
+ position: relative;
121
+ overflow-y: scroll;
122
+ overflow-x: hidden;
123
+ }
124
+
125
+ .fld-imerss-plant-names::-webkit-scrollbar, .fld-imerss-plant-counts::-webkit-scrollbar {
126
+ display: none; /* Safari and Chrome */
127
+ }
128
+
129
+ .fld-imerss-poll-names .fl-imerss-int-label {
130
+ writing-mode: tb-rl;
131
+ transform: rotate(180deg);
132
+ bottom: 2em; /* No idea why they stick off the bottom otherwise */
133
+ }
134
+
135
+ .fl-imerss-int-label {
136
+ position: absolute;
137
+ white-space: nowrap;
138
+ font-size: 14px;
139
+ }
140
+
141
+ .fl-imerss-int-count {
142
+ position: absolute;
143
+ }
144
+
145
+ .fld-imerss-plant-counts .fl-imerss-int-count {
146
+ /* Colour taken from Young et al 2021 */
147
+ background-color: #4c92c3;
148
+ border: 1px solid black;
149
+ }
150
+
151
+ .fld-imerss-poll-counts .fl-imerss-int-count {
152
+ background-color: #ff7c4a;
153
+ border: 1px solid black;
154
+ }
155
+
156
+ .fld-imerss-int-poll-label {
157
+ padding-top: 10px;
158
+ font-size: 20px;
159
+ writing-mode: tb-rl;
160
+ transform: rotate(180deg);
161
+ padding-top: 2em;
162
+ }
163
+
164
+ .fld-imerss-int-plant-label {
165
+ font-size: 20px;
166
+ }
167
+
168
+ .fl-imerss-int-tooltip {
169
+ font-size: 15px;
170
+ }
171
+