@jbrowse/plugin-config 4.3.0 → 5.0.0-beta.10

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 (74) hide show
  1. package/esm/ConfigurationEditorWidget/components/AddNewField.d.ts +6 -0
  2. package/esm/ConfigurationEditorWidget/components/AddNewField.js +29 -0
  3. package/esm/ConfigurationEditorWidget/components/BooleanEditor.d.ts +3 -2
  4. package/esm/ConfigurationEditorWidget/components/BooleanEditor.js +6 -4
  5. package/esm/ConfigurationEditorWidget/components/CallbackEditor.d.ts +4 -2
  6. package/esm/ConfigurationEditorWidget/components/CallbackEditor.js +24 -42
  7. package/esm/ConfigurationEditorWidget/components/ColorEditor.d.ts +5 -12
  8. package/esm/ConfigurationEditorWidget/components/ColorEditor.js +47 -22
  9. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.d.ts +2 -3
  10. package/esm/ConfigurationEditorWidget/components/ConfigurationEditor.js +168 -29
  11. package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.d.ts +1 -1
  12. package/esm/ConfigurationEditorWidget/components/ConfigurationTextField.js +10 -2
  13. package/esm/ConfigurationEditorWidget/components/EntryListEditor.d.ts +17 -0
  14. package/esm/ConfigurationEditorWidget/components/EntryListEditor.js +35 -0
  15. package/esm/ConfigurationEditorWidget/components/HeadingComponent.d.ts +1 -1
  16. package/esm/ConfigurationEditorWidget/components/IntegerEditor.d.ts +10 -0
  17. package/esm/ConfigurationEditorWidget/components/IntegerEditor.js +9 -0
  18. package/esm/ConfigurationEditorWidget/components/JsonEditor.d.ts +2 -1
  19. package/esm/ConfigurationEditorWidget/components/JsonEditor.js +24 -41
  20. package/esm/ConfigurationEditorWidget/components/MapEntryCard.d.ts +8 -0
  21. package/esm/ConfigurationEditorWidget/components/MapEntryCard.js +23 -0
  22. package/esm/ConfigurationEditorWidget/components/MapSlotEditor.d.ts +8 -0
  23. package/esm/ConfigurationEditorWidget/components/MapSlotEditor.js +18 -0
  24. package/esm/ConfigurationEditorWidget/components/NumberEditor.d.ts +5 -4
  25. package/esm/ConfigurationEditorWidget/components/NumberEditor.js +15 -15
  26. package/esm/ConfigurationEditorWidget/components/NumberMapEditor.d.ts +4 -4
  27. package/esm/ConfigurationEditorWidget/components/NumberMapEditor.js +7 -31
  28. package/esm/ConfigurationEditorWidget/components/SlotEditor.d.ts +4 -5
  29. package/esm/ConfigurationEditorWidget/components/SlotEditor.js +88 -49
  30. package/esm/ConfigurationEditorWidget/components/StringArrayEditor.d.ts +16 -10
  31. package/esm/ConfigurationEditorWidget/components/StringArrayEditor.js +22 -25
  32. package/esm/ConfigurationEditorWidget/components/StringArrayMapEditor.d.ts +3 -6
  33. package/esm/ConfigurationEditorWidget/components/StringArrayMapEditor.js +14 -39
  34. package/esm/ConfigurationEditorWidget/components/StringMapEditor.d.ts +10 -0
  35. package/esm/ConfigurationEditorWidget/components/StringMapEditor.js +13 -0
  36. package/esm/ConfigurationEditorWidget/components/TypeSelector.d.ts +2 -2
  37. package/esm/ConfigurationEditorWidget/components/TypeSelector.js +2 -2
  38. package/esm/ConfigurationEditorWidget/components/singularSlotName.d.ts +13 -0
  39. package/esm/ConfigurationEditorWidget/components/singularSlotName.js +23 -0
  40. package/esm/ConfigurationEditorWidget/components/useSlotEditorStyles.d.ts +2 -2
  41. package/esm/ConfigurationEditorWidget/components/useSlotEditorStyles.js +6 -1
  42. package/esm/ConfigurationEditorWidget/index.js +4 -4
  43. package/esm/ConfigurationEditorWidget/model.d.ts +8 -1
  44. package/esm/ConfigurationEditorWidget/model.js +40 -1
  45. package/esm/FromConfigAdapter/FromConfigAdapter.d.ts +6 -1
  46. package/esm/FromConfigAdapter/FromConfigAdapter.js +31 -1
  47. package/esm/FromConfigAdapter/configSchema.d.ts +32 -4
  48. package/esm/FromConfigAdapter/configSchema.js +34 -2
  49. package/esm/FromConfigAdapter/index.js +2 -2
  50. package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.d.ts +8 -0
  51. package/esm/FromConfigRegionsAdapter/FromConfigRegionsAdapter.js +10 -25
  52. package/esm/FromConfigRegionsAdapter/configSchema.d.ts +38 -4
  53. package/esm/FromConfigRegionsAdapter/configSchema.js +39 -2
  54. package/esm/FromConfigRegionsAdapter/index.js +2 -2
  55. package/esm/FromConfigSequenceAdapter/FromConfigSequenceAdapter.d.ts +15 -2
  56. package/esm/FromConfigSequenceAdapter/FromConfigSequenceAdapter.js +32 -40
  57. package/esm/FromConfigSequenceAdapter/configSchema.d.ts +37 -4
  58. package/esm/FromConfigSequenceAdapter/configSchema.js +38 -2
  59. package/esm/FromConfigSequenceAdapter/index.js +2 -2
  60. package/esm/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.d.ts +5 -4
  61. package/esm/NcbiSequenceReportAliasAdapter/NcbiSequenceReportAliasAdapter.js +28 -24
  62. package/esm/NcbiSequenceReportAliasAdapter/configSchema.d.ts +69 -10
  63. package/esm/NcbiSequenceReportAliasAdapter/configSchema.js +82 -18
  64. package/esm/NcbiSequenceReportAliasAdapter/index.js +3 -2
  65. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.d.ts +4 -3
  66. package/esm/RefNameAliasAdapter/RefNameAliasAdapter.js +22 -28
  67. package/esm/RefNameAliasAdapter/configSchema.d.ts +70 -12
  68. package/esm/RefNameAliasAdapter/configSchema.js +89 -18
  69. package/esm/RefNameAliasAdapter/index.js +3 -2
  70. package/esm/aliasUtils.d.ts +4 -0
  71. package/esm/aliasUtils.js +19 -0
  72. package/esm/index.d.ts +2 -2
  73. package/esm/index.js +7 -7
  74. package/package.json +11 -15
@@ -1,19 +1,77 @@
1
+ import type { Instance } from '@jbrowse/mobx-state-tree';
2
+ export declare function normalizeSnapshot(snap: Record<string, unknown>): Record<string, unknown>;
3
+ /**
4
+ * #config RefNameAliasAdapter
5
+ * can read "chromAliases" type files from UCSC or any tab separated file of
6
+ * refName aliases
7
+ *
8
+ * #example
9
+ * Goes on an ASSEMBLY, under `refNameAliases` — not on a track. Writing
10
+ * `refNameAliases: { uri: '...' }` is shorthand for exactly this adapter:
11
+ * ```js
12
+ * {
13
+ * name: 'hg38',
14
+ * sequence: {
15
+ * type: 'ReferenceSequenceTrack',
16
+ * trackId: 'hg38-ReferenceSequenceTrack',
17
+ * adapter: {
18
+ * type: 'BgzipFastaAdapter',
19
+ * uri: 'https://example.com/hg38.fa.gz',
20
+ * },
21
+ * },
22
+ * refNameAliases: {
23
+ * adapter: {
24
+ * type: 'RefNameAliasAdapter',
25
+ * uri: 'https://example.com/hg38.chromAlias.txt',
26
+ * },
27
+ * },
28
+ * }
29
+ * ```
30
+ *
31
+ * #example named column
32
+ * When the primary column — the one whose values match your FASTA — is not the
33
+ * first, name it. `refNameColumnHeaderName` reads the last `#`-prefixed line as
34
+ * the header; `refNameColumn` takes a zero-based index instead.
35
+ * ```js
36
+ * {
37
+ * name: 'hg38',
38
+ * sequence: {
39
+ * type: 'ReferenceSequenceTrack',
40
+ * trackId: 'hg38-ReferenceSequenceTrack',
41
+ * adapter: {
42
+ * type: 'BgzipFastaAdapter',
43
+ * uri: 'https://example.com/hg38.fa.gz',
44
+ * },
45
+ * },
46
+ * refNameAliases: {
47
+ * adapter: {
48
+ * type: 'RefNameAliasAdapter',
49
+ * uri: 'https://example.com/aliases.txt',
50
+ * refNameColumnHeaderName: 'ucsc',
51
+ * },
52
+ * },
53
+ * }
54
+ * ```
55
+ */
1
56
  declare const RefNameAliasAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
- location: {
3
- type: string;
4
- defaultValue: {
5
- uri: string;
6
- locationType: string;
7
- };
57
+ type: {
58
+ type: "string";
59
+ } & {
60
+ defaultValue: string;
61
+ };
62
+ readonly location: {
63
+ type: "maybeFileLocation";
8
64
  };
9
- refNameColumn: {
10
- type: string;
65
+ readonly refNameColumn: {
66
+ type: "number";
67
+ } & {
11
68
  defaultValue: number;
12
69
  };
13
- refNameColumnHeaderName: {
14
- type: string;
15
- description: string;
70
+ readonly refNameColumnHeaderName: {
71
+ type: "string";
72
+ } & {
16
73
  defaultValue: string;
17
74
  };
18
- }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
75
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined, true, import("@jbrowse/core/configuration").ConfigurationSchemaRequirement<Partial<Record<string, string[]>>, string>, any>>;
76
+ export type RefNameAliasAdapterConfig = Instance<typeof RefNameAliasAdapter>;
19
77
  export default RefNameAliasAdapter;
@@ -1,34 +1,105 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
- function x() { }
1
+ import { ConfigurationSchema, expandUriShorthand, } from '@jbrowse/core/configuration';
2
+ export function normalizeSnapshot(snap) {
3
+ return expandUriShorthand(snap, 'location');
4
+ }
5
+ /**
6
+ * #config RefNameAliasAdapter
7
+ * can read "chromAliases" type files from UCSC or any tab separated file of
8
+ * refName aliases
9
+ *
10
+ * #example
11
+ * Goes on an ASSEMBLY, under `refNameAliases` — not on a track. Writing
12
+ * `refNameAliases: { uri: '...' }` is shorthand for exactly this adapter:
13
+ * ```js
14
+ * {
15
+ * name: 'hg38',
16
+ * sequence: {
17
+ * type: 'ReferenceSequenceTrack',
18
+ * trackId: 'hg38-ReferenceSequenceTrack',
19
+ * adapter: {
20
+ * type: 'BgzipFastaAdapter',
21
+ * uri: 'https://example.com/hg38.fa.gz',
22
+ * },
23
+ * },
24
+ * refNameAliases: {
25
+ * adapter: {
26
+ * type: 'RefNameAliasAdapter',
27
+ * uri: 'https://example.com/hg38.chromAlias.txt',
28
+ * },
29
+ * },
30
+ * }
31
+ * ```
32
+ *
33
+ * #example named column
34
+ * When the primary column — the one whose values match your FASTA — is not the
35
+ * first, name it. `refNameColumnHeaderName` reads the last `#`-prefixed line as
36
+ * the header; `refNameColumn` takes a zero-based index instead.
37
+ * ```js
38
+ * {
39
+ * name: 'hg38',
40
+ * sequence: {
41
+ * type: 'ReferenceSequenceTrack',
42
+ * trackId: 'hg38-ReferenceSequenceTrack',
43
+ * adapter: {
44
+ * type: 'BgzipFastaAdapter',
45
+ * uri: 'https://example.com/hg38.fa.gz',
46
+ * },
47
+ * },
48
+ * refNameAliases: {
49
+ * adapter: {
50
+ * type: 'RefNameAliasAdapter',
51
+ * uri: 'https://example.com/aliases.txt',
52
+ * refNameColumnHeaderName: 'ucsc',
53
+ * },
54
+ * },
55
+ * }
56
+ * ```
57
+ */
3
58
  const RefNameAliasAdapter = ConfigurationSchema('RefNameAliasAdapter', {
59
+ /**
60
+ * #slot
61
+ * location of the alias table: a UCSC `chromAlias.txt`, or any
62
+ * tab-separated file whose rows each list the alternate names of one
63
+ * reference sequence (`chr1<TAB>1<TAB>NC_000001.11`). The table lets a
64
+ * `1`-named file load against a `chr1`-named assembly.
65
+ */
4
66
  location: {
5
- type: 'fileLocation',
6
- defaultValue: {
7
- uri: '/path/to/my/aliases.txt',
8
- locationType: 'UriLocation',
9
- },
67
+ type: 'maybeFileLocation',
10
68
  },
69
+ /**
70
+ * #slot
71
+ * by default, the "ref names that match the fasta" are assumed to be in the
72
+ * first column (0), change this variable if needed
73
+ */
11
74
  refNameColumn: {
12
75
  type: 'number',
13
76
  defaultValue: 0,
77
+ advanced: true,
14
78
  },
79
+ /**
80
+ * #slot
81
+ * refNameColumnHeaderName
82
+ */
15
83
  refNameColumnHeaderName: {
16
84
  type: 'string',
17
85
  description: 'alternative to refNameColumn, instead looks at header (starts with # and finds column name)',
18
86
  defaultValue: '',
87
+ advanced: true,
19
88
  },
20
89
  }, {
21
90
  explicitlyTyped: true,
22
- preProcessSnapshot: snap => {
23
- return snap.uri
24
- ? {
25
- ...snap,
26
- location: {
27
- uri: snap.uri,
28
- baseUri: snap.baseUri,
29
- },
30
- }
31
- : snap;
32
- },
91
+ /**
92
+ * #preProcessSnapshot
93
+ *
94
+ *
95
+ * preprocessor to allow minimal config:
96
+ * ```json
97
+ * {
98
+ * "type": "RefNameAliasAdapter",
99
+ * "uri": "yourfile.chromAlias.txt"
100
+ * }
101
+ * ```
102
+ */
103
+ preProcessSnapshot: normalizeSnapshot,
33
104
  });
34
105
  export default RefNameAliasAdapter;
@@ -1,10 +1,11 @@
1
1
  import { AdapterType } from '@jbrowse/core/pluggableElementTypes';
2
- import configSchema from "./configSchema.js";
2
+ import configSchema, { normalizeSnapshot } from './configSchema.js';
3
3
  export default function RefNameAliasAdapterF(pluginManager) {
4
4
  pluginManager.addAdapterType(() => new AdapterType({
5
5
  name: 'RefNameAliasAdapter',
6
+ normalizeSnapshot,
6
7
  configSchema,
7
- getAdapterClass: () => import("./RefNameAliasAdapter.js").then(r => r.default),
8
+ getAdapterClass: () => import('./RefNameAliasAdapter.js').then(r => r.default),
8
9
  adapterMetadata: {
9
10
  hiddenFromGUI: true,
10
11
  },
@@ -0,0 +1,4 @@
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
+ import type { BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
3
+ import type { FileLocation } from '@jbrowse/core/util/types';
4
+ export declare function readAliasRows(loc: FileLocation | undefined, pluginManager?: PluginManager, opts?: BaseOptions): Promise<string[][]>;
@@ -0,0 +1,19 @@
1
+ import { fetchAndMaybeUnzipText } from '@jbrowse/core/util';
2
+ import { openLocation } from '@jbrowse/core/util/io';
3
+ // Reads a tab-separated alias file into rows of columns, dropping blank lines.
4
+ // Returns [] when no file is configured.
5
+ export async function readAliasRows(loc, pluginManager, opts) {
6
+ if (!loc) {
7
+ return [];
8
+ }
9
+ // fetchAndMaybeUnzipText rather than readFile('utf8') so the read reports byte
10
+ // progress (readFile's utf8 path takes res.text(), which can't) and so a
11
+ // gzipped chromAlias works. UCSC's chromAlias files are the slowest of the
12
+ // four parallel assembly loads on a big assembly, so this is the one whose
13
+ // progress the spinner most often ends up showing
14
+ const text = await fetchAndMaybeUnzipText(openLocation(loc, pluginManager), opts, 'Downloading chromosome aliases');
15
+ return text
16
+ .split(/\n|\r\n|\r/)
17
+ .filter(line => !!line.trim())
18
+ .map(line => line.split('\t'));
19
+ }
package/esm/index.d.ts CHANGED
@@ -3,9 +3,9 @@ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  declare const LazyConfigurationEditorComponent: import("react").LazyExoticComponent<({ model, }: {
4
4
  model: {
5
5
  target?: import("@jbrowse/core/configuration").AnyConfigurationModel;
6
+ expandedDisplayId?: string;
6
7
  };
7
- session?: import("@jbrowse/core/util").AbstractSessionModel;
8
- }) => import("react/jsx-runtime").JSX.Element>;
8
+ }) => import("react").JSX.Element>;
9
9
  export default class ConfigurationPlugin extends Plugin {
10
10
  name: string;
11
11
  install(pluginManager: PluginManager): void;
package/esm/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { lazy } from 'react';
2
2
  import Plugin from '@jbrowse/core/Plugin';
3
- import ConfigurationEditorWidgetF from "./ConfigurationEditorWidget/index.js";
4
- import FromConfigAdapterF from "./FromConfigAdapter/index.js";
5
- import FromConfigRegionsAdapterF from "./FromConfigRegionsAdapter/index.js";
6
- import FromConfigSequenceAdapterF from "./FromConfigSequenceAdapter/index.js";
7
- import NcbiSequenceReportAliasAdapterF from "./NcbiSequenceReportAliasAdapter/index.js";
8
- import RefNameAliasAdapterF from "./RefNameAliasAdapter/index.js";
9
- const LazyConfigurationEditorComponent = lazy(() => import("./ConfigurationEditorWidget/components/ConfigurationEditor.js"));
3
+ import ConfigurationEditorWidgetF from './ConfigurationEditorWidget/index.js';
4
+ import FromConfigAdapterF from './FromConfigAdapter/index.js';
5
+ import FromConfigRegionsAdapterF from './FromConfigRegionsAdapter/index.js';
6
+ import FromConfigSequenceAdapterF from './FromConfigSequenceAdapter/index.js';
7
+ import NcbiSequenceReportAliasAdapterF from './NcbiSequenceReportAliasAdapter/index.js';
8
+ import RefNameAliasAdapterF from './RefNameAliasAdapter/index.js';
9
+ const LazyConfigurationEditorComponent = lazy(() => import('./ConfigurationEditorWidget/components/ConfigurationEditor.js'));
10
10
  export default class ConfigurationPlugin extends Plugin {
11
11
  name = 'ConfigurationPlugin';
12
12
  install(pluginManager) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-config",
3
- "version": "4.3.0",
3
+ "version": "5.0.0-beta.10",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 config utilities",
6
6
  "keywords": [
@@ -21,18 +21,17 @@
21
21
  "esm"
22
22
  ],
23
23
  "dependencies": {
24
- "@jbrowse/mobx-state-tree": "^5.6.0",
25
- "@mui/icons-material": "^7.3.11",
26
- "@mui/material": "^7.3.11",
27
- "mobx": "^6.15.3",
28
- "mobx-react": "^9.2.1",
29
- "pluralize": "^8.0.0",
24
+ "@jbrowse/mobx-state-tree": "^6.6.1",
25
+ "@mui/icons-material": "^9.4.0",
26
+ "@mui/material": "^9.4.0",
27
+ "mobx": "^7.0.5",
28
+ "mobx-react": "^10.0.2",
30
29
  "rxjs": "^7.8.2",
31
- "@jbrowse/core": "^4.3.0"
30
+ "@jbrowse/core": "^5.0.0-beta.10"
32
31
  },
33
32
  "peerDependencies": {
34
- "react": ">=18.0.0",
35
- "react-dom": ">=18.0.0"
33
+ "react": ">=19.0.0",
34
+ "react-dom": ">=19.0.0"
36
35
  },
37
36
  "publishConfig": {
38
37
  "access": "public"
@@ -42,14 +41,11 @@
42
41
  "build": "pnpm run /^build:/",
43
42
  "test": "cd ../..; jest --passWithNoTests plugins/config",
44
43
  "prebuild": "pnpm clean",
45
- "build:esm": "tsc -p tsconfig.build.esm.json",
44
+ "build:esm": "node ../../node_modules/typescript7/bin/tsc --build tsconfig.build.esm.json",
46
45
  "clean": "rimraf esm *.tsbuildinfo"
47
46
  },
48
47
  "types": "esm/index.d.ts",
49
48
  "exports": {
50
- ".": {
51
- "types": "./esm/index.d.ts",
52
- "import": "./esm/index.js"
53
- }
49
+ ".": "./esm/index.js"
54
50
  }
55
51
  }