@jbrowse/cli 5.0.0-beta.11 → 5.0.0-beta.13

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.
@@ -24,7 +24,7 @@ what it cannot draw in a corner notice rather than refusing the track.
24
24
  This command runs the display's own rule list over every "marks" list in the
25
25
  file: an error where a mark draws nothing, never draws or a step cannot run,
26
26
  and a warning where a slot waits unread or the marks draw in an arrangement
27
- the author may not have meant. With --json each finding carries the stable
27
+ the author may not have meant. With --json each finding has the stable
28
28
  "rule" id of the rule that made it.
29
29
 
30
30
  Types registered by plugins are not known to this command, so they come through
@@ -21,8 +21,8 @@ export const IDENTITY_SCALE = 'identity';
21
21
  const CATEGORICAL_PRESET = { scale: 'categorical' };
22
22
  /**
23
23
  * The fields whose values have names, an order and colours of their own on
24
- * every display, beneath each display's own presets. Red forward and blue
25
- * reverse is what the synteny ribbons paint too. The SV classes are
24
+ * every display, beneath each display's own presets. The synteny ribbons
25
+ * paint strand from this range too. The SV classes are
26
26
  * `svClassOf`'s, deletion red and duplication blue as dbVar and gnomAD-SV
27
27
  * paint them, insertion the pileup's purple, and the rest kept apart under
28
28
  * deuteranopia and protanopia. A record with no class files under `''`, so
@@ -166,6 +166,37 @@ export function scaleEndProblems({ domainMin, domainMax, domainQuantile }, { rev
166
166
  export function noticeLines(setting, problems) {
167
167
  return problems.map(({ slot, message }) => `${setting}.${slot}: ${message}`);
168
168
  }
169
+ function numberOf(value) {
170
+ return typeof value === 'number' ? value : undefined;
171
+ }
172
+ function stringOf(value) {
173
+ return typeof value === 'string' ? value : undefined;
174
+ }
175
+ function listOf(value) {
176
+ return Array.isArray(value) ? value : undefined;
177
+ }
178
+ /** A quantitative scale's ends among the members `member` reads, each a number or unset. */
179
+ export function scaleEndsOf(member) {
180
+ return {
181
+ domainMin: numberOf(member('domainMin')),
182
+ domainMax: numberOf(member('domainMax')),
183
+ domainQuantile: numberOf(member('domainQuantile')),
184
+ };
185
+ }
186
+ /**
187
+ * The members `colorProblems` reads among the ones `member` reads, each of the
188
+ * type it reads or unset, so a config snapshot and a config node answer alike.
189
+ */
190
+ export function colorSlotsOf(member) {
191
+ return {
192
+ ...scaleEndsOf(member),
193
+ field: stringOf(member('field')) ?? '',
194
+ scale: stringOf(member('scale')),
195
+ domain: listOf(member('domain')),
196
+ range: listOf(member('range')),
197
+ labels: listOf(member('labels')),
198
+ };
199
+ }
169
200
  function pinned(entry) {
170
201
  return entry !== '' && Number.isFinite(Number(entry));
171
202
  }
@@ -39,7 +39,7 @@ export const BIN_OVERLAP_FIELD = 'overlap';
39
39
  export const DEFAULT_COVERAGE_AS = 'coverage';
40
40
  export const DEFAULT_FLATTEN_FIELD = 'subfeatures';
41
41
  export const DEFAULT_CELLS_FIELD = 'seq';
42
- /** What a `cells` step writes: `state` on every cell, `base` on a mismatch or an insertion, `match` off a gap, `length` on an insertion. */
42
+ /** What a `cells` step writes: `state` on every cell, `base` on a mismatch or an insertion, `match` off a gap or a reference `N`, `length` on an insertion. */
43
43
  export const CELLS_FIELDS = ['state', 'base', 'match', 'length'];
44
44
  export const DEFAULT_PILEUP_AS = 'row';
45
45
  export const DEFAULT_PILEUP_FIELDS = ['start', 'end'];
@@ -68,7 +68,7 @@ function describe(schema) {
68
68
  if (name === 'JexlString') {
69
69
  return 'a "jexl:" expression';
70
70
  }
71
- if (name === 'CssColor') {
71
+ if (name === 'CssColor' || name === 'CssColorEntry') {
72
72
  return 'a CSS color (a name like "red", "#rrggbb", "rgb()" or "hsl()")';
73
73
  }
74
74
  if (name) {
@@ -378,7 +378,7 @@ function explain(data, errors, problems, depth) {
378
378
  break;
379
379
  }
380
380
  case 'pattern':
381
- emit(where, error.schemaPath.endsWith('/CssColor/pattern')
381
+ emit(where, /\/CssColor(?:Entry)?\/pattern$/.test(error.schemaPath)
382
382
  ? `expected ${describe({ $ref: '#/$defs/CssColor' })}, got ${JSON.stringify(error.data)}`
383
383
  : `expected a string matching /${String(parent.pattern)}/, got ${JSON.stringify(error.data)}`);
384
384
  break;
@@ -12,7 +12,7 @@ import { fileNameOf, isLooseTrackConfig, matchFormat, } from '@jbrowse/add-track
12
12
  import { configManifest } from './configManifest.generated.js';
13
13
  import { displayDefaultsForTrackType } from './displayDefaultKeys.js';
14
14
  import { isRecord, liftToSnapshot } from './liftConfig.js';
15
- import { colorProblems, scaleEndProblems } from './markRules/colorScale.js';
15
+ import { colorProblems, colorSlotsOf, scaleEndProblems, scaleEndsOf, } from './markRules/colorScale.js';
16
16
  import { markProblems } from './markRules/markProblems.js';
17
17
  import { hasDeclaredShape, rootConfigurationSlots, schemaProblems, } from './schemaValidate.js';
18
18
  import { didYouMean } from './suggest.js';
@@ -290,7 +290,7 @@ function declaredEntries(lifted, display, slot, slots) {
290
290
  return (slots.find(s => s.name === slot)?.defaultEntries ?? []);
291
291
  }
292
292
  return Array.isArray(list)
293
- ? list.map((entry, i) => hasDeclaredShape(written[i], `${SLOTS_POINTER}/${slot}/items`)
293
+ ? list.map((entry, i) => hasDeclaredShape([written[i]], `${SLOTS_POINTER}/${slot}`)
294
294
  ? entry
295
295
  : undefined)
296
296
  : [];
@@ -344,18 +344,9 @@ function pushOnce(report, problem) {
344
344
  report.problems.push(problem);
345
345
  }
346
346
  }
347
- function numberOf(value) {
348
- return typeof value === 'number' ? value : undefined;
349
- }
350
- function scaleEndsOf(scale) {
351
- return {
352
- domainMin: numberOf(scale.domainMin),
353
- domainMax: numberOf(scale.domainMax),
354
- domainQuantile: numberOf(scale.domainQuantile),
355
- };
356
- }
357
347
  function scalesOf(scales) {
358
- return isRecord(scales.y) ? { y: scaleEndsOf(scales.y) } : {};
348
+ const { y } = scales;
349
+ return isRecord(y) ? { y: scaleEndsOf(name => y[name]) } : {};
359
350
  }
360
351
  function declaredMembers(written, slot) {
361
352
  const declared = new Set((slot.subSlots ?? []).map(s => s.name));
@@ -385,19 +376,15 @@ function checkScaleSlots(display, slots, where, report) {
385
376
  }
386
377
  const members = declaredMembers(written, slot);
387
378
  if (slot.fieldPresets) {
388
- for (const problem of colorProblems({
389
- ...scaleEndsOf(members),
390
- field: typeof members.field === 'string' ? members.field : '',
391
- scale: typeof members.scale === 'string' ? members.scale : undefined,
392
- domain: Array.isArray(members.domain) ? members.domain : undefined,
393
- range: Array.isArray(members.range) ? members.range : undefined,
394
- labels: Array.isArray(members.labels) ? members.labels : undefined,
395
- }, slot.fieldPresets)) {
379
+ for (const problem of colorProblems(colorSlotsOf(name => name === 'field'
380
+ ? (members.field ?? slot.fieldDefault)
381
+ : members[name]), slot.fieldPresets)) {
396
382
  warn(`${where}.${slot.name}`, problem);
397
383
  }
398
384
  }
399
- if (slot.name === 'scales' && isRecord(members.y)) {
400
- for (const problem of scaleEndProblems(scaleEndsOf(members.y))) {
385
+ const { y } = members;
386
+ if (slot.name === 'scales' && isRecord(y)) {
387
+ for (const problem of scaleEndProblems(scaleEndsOf(name => y[name]))) {
401
388
  warn(`${where}.scales.y`, problem);
402
389
  }
403
390
  }
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '5.0.0-beta.11';
1
+ export const version = '5.0.0-beta.13';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/cli",
3
- "version": "5.0.0-beta.11",
3
+ "version": "5.0.0-beta.13",
4
4
  "type": "module",
5
5
  "description": "A command line tool for working with JBrowse 2",
6
6
  "keywords": [
@@ -31,9 +31,9 @@
31
31
  "cli-progress": "^3.12.0",
32
32
  "serve-handler": "^6.1.7",
33
33
  "tmp": "^0.2.7",
34
- "@jbrowse/add-track-core": "^5.0.0-beta.11",
35
- "@jbrowse/text-indexing-core": "^5.0.0-beta.11",
36
- "@jbrowse/cigar-utils": "^5.0.0-beta.11"
34
+ "@jbrowse/cigar-utils": "^5.0.0-beta.13",
35
+ "@jbrowse/add-track-core": "^5.0.0-beta.13",
36
+ "@jbrowse/text-indexing-core": "^5.0.0-beta.13"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"