@jbrowse/cli 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 (71) hide show
  1. package/README.md +451 -72
  2. package/dist/base.js +0 -3
  3. package/dist/bin.js +2 -1
  4. package/dist/cliFetch.js +3 -0
  5. package/dist/commands/add-assembly/index.js +46 -19
  6. package/dist/commands/add-assembly/utils.js +204 -290
  7. package/dist/commands/add-connection.js +73 -79
  8. package/dist/commands/add-track-json.js +24 -12
  9. package/dist/commands/add-track-utils/adapter-utils.js +189 -288
  10. package/dist/commands/add-track-utils/file-operations.js +27 -11
  11. package/dist/commands/add-track-utils/multiwig.js +47 -0
  12. package/dist/commands/add-track-utils/track-config.js +66 -25
  13. package/dist/commands/add-track-utils/validators.js +36 -20
  14. package/dist/commands/add-track.js +200 -62
  15. package/dist/commands/admin-server/index.js +39 -50
  16. package/dist/commands/admin-server/utils.js +238 -126
  17. package/dist/commands/create.js +18 -34
  18. package/dist/commands/make-density/density-generator.js +180 -0
  19. package/dist/commands/make-density/index.js +139 -0
  20. package/dist/commands/make-pif/index.js +133 -11
  21. package/dist/commands/make-pif/pif-generator.js +243 -43
  22. package/dist/commands/process-utils.js +13 -2
  23. package/dist/commands/remove-track.js +20 -13
  24. package/dist/commands/set-default-session.js +35 -31
  25. package/dist/commands/shared/config-operations.js +3 -10
  26. package/dist/commands/shared/density.js +12 -0
  27. package/dist/commands/shared/sort-utils.js +67 -10
  28. package/dist/commands/shared/validators.js +38 -3
  29. package/dist/commands/sort-bed.js +2 -33
  30. package/dist/commands/sort-gff.js +2 -33
  31. package/dist/commands/text-index/adapter-utils.js +19 -26
  32. package/dist/commands/text-index/aggregate.js +40 -34
  33. package/dist/commands/text-index/command.js +37 -7
  34. package/dist/commands/text-index/config-utils.js +62 -85
  35. package/dist/commands/text-index/file-list.js +32 -18
  36. package/dist/commands/text-index/index.js +4 -4
  37. package/dist/commands/text-index/indexing-utils.js +44 -96
  38. package/dist/commands/text-index/per-track.js +44 -31
  39. package/dist/commands/text-index/validators.js +1 -1
  40. package/dist/commands/upgrade.js +20 -32
  41. package/dist/commands/validate/configManifest.generated.js +7613 -0
  42. package/dist/commands/validate/configSchema.generated.js +20400 -0
  43. package/dist/commands/validate/displayDefaultKeys.js +28 -0
  44. package/dist/commands/validate/index.js +113 -0
  45. package/dist/commands/validate/liftConfig.js +34 -0
  46. package/dist/commands/validate/markRules/aggregateFieldName.js +9 -0
  47. package/dist/commands/validate/markRules/autoBin.js +27 -0
  48. package/dist/commands/validate/markRules/colorScale.js +244 -0
  49. package/dist/commands/validate/markRules/cssColorsLevel4.js +162 -0
  50. package/dist/commands/validate/markRules/jexlStrings.js +23 -0
  51. package/dist/commands/validate/markRules/markProblems.js +532 -0
  52. package/dist/commands/validate/markRules/markRuleFacts.js +6 -0
  53. package/dist/commands/validate/markRules/markSpecs.js +96 -0
  54. package/dist/commands/validate/markRules/markVocabulary.js +57 -0
  55. package/dist/commands/validate/markRules/shapeNameList.js +7 -0
  56. package/dist/commands/validate/markRules/stepChannels.js +55 -0
  57. package/dist/commands/validate/schemaValidate.js +425 -0
  58. package/dist/commands/validate/suggest.js +35 -0
  59. package/dist/commands/validate/types.js +6 -0
  60. package/dist/commands/validate/validateConfig.js +502 -0
  61. package/dist/index.js +104 -50
  62. package/dist/types/common.js +3 -27
  63. package/dist/utils.js +309 -128
  64. package/dist/version.js +1 -1
  65. package/package.json +8 -14
  66. package/bin/run +0 -4
  67. package/bundle/index.js +0 -3686
  68. package/dist/commands/make-pif/cigar-utils.js +0 -24
  69. package/dist/commands/make-pif/file-utils.js +0 -30
  70. package/dist/commands/track-utils.js +0 -74
  71. package/dist/util.js +0 -35
@@ -1,24 +0,0 @@
1
- const cigarRegex = new RegExp(/([MIDNSHPX=])/);
2
- export function parseCigar(cigar = '') {
3
- return cigar.split(cigarRegex).slice(0, -1);
4
- }
5
- export function flipCigar(cigar) {
6
- const arr = [];
7
- for (let i = cigar.length - 2; i >= 0; i -= 2) {
8
- arr.push(cigar[i]);
9
- const op = cigar[i + 1];
10
- if (op === 'D') {
11
- arr.push('I');
12
- }
13
- else if (op === 'I') {
14
- arr.push('D');
15
- }
16
- else {
17
- arr.push(op);
18
- }
19
- }
20
- return arr;
21
- }
22
- export function swapIndelCigar(cigar) {
23
- return cigar.replaceAll('D', 'K').replaceAll('I', 'D').replaceAll('K', 'I');
24
- }
@@ -1,30 +0,0 @@
1
- import fs from 'fs';
2
- import readline from 'readline';
3
- import { createGunzip } from 'zlib';
4
- export function getReadline(filename) {
5
- const stream = fs.createReadStream(filename);
6
- return readline.createInterface({
7
- input: /.b?gz$/.exec(filename) ? stream.pipe(createGunzip()) : stream,
8
- });
9
- }
10
- export function getStdReadline() {
11
- return readline.createInterface({
12
- input: process.stdin,
13
- });
14
- }
15
- export function createWriteWithBackpressure(stream) {
16
- return (data) => {
17
- // If the stream buffer is full (write returns false), we need to wait for drain
18
- if (!stream.write(data)) {
19
- return new Promise(resolve => {
20
- const drainHandler = () => {
21
- stream.removeListener?.('drain', drainHandler);
22
- resolve();
23
- };
24
- stream.once?.('drain', drainHandler);
25
- });
26
- }
27
- // If write returns true, the buffer is not full, so we can continue immediately
28
- return Promise.resolve();
29
- };
30
- }
@@ -1,74 +0,0 @@
1
- import path from 'path';
2
- import { readJsonFile } from "../utils.js";
3
- import { guessFileNames, guessTrackType, } from "./add-track-utils/adapter-utils.js";
4
- import { loadFile } from "./add-track-utils/file-operations.js";
5
- import { buildTrackConfig } from "./add-track-utils/track-config.js";
6
- import { validateTrackId } from "./add-track-utils/validators.js";
7
- import { findAndUpdateOrAdd, saveConfigAndReport as saveConfigAndReportBase, } from "./shared/config-operations.js";
8
- export async function loadTrackConfig(targetConfigPath) {
9
- return await readJsonFile(targetConfigPath);
10
- }
11
- export async function processTrackFiles({ location, index, bed1, bed2, load, configDir, subDir, force, }) {
12
- if (load) {
13
- await Promise.all(Object.values(guessFileNames({ location, index, bed1, bed2 }))
14
- .filter(f => !!f)
15
- .map(src => loadFile({
16
- src,
17
- destDir: configDir,
18
- mode: load,
19
- subDir,
20
- force,
21
- })));
22
- }
23
- }
24
- export function addTrackToConfig({ configContents, trackConfig, trackId, force, overwrite, }) {
25
- validateTrackId(configContents, trackId, force, overwrite);
26
- const { updatedItems, wasOverwritten } = findAndUpdateOrAdd({
27
- items: configContents.tracks || [],
28
- newItem: trackConfig,
29
- idField: 'trackId',
30
- getId: item => item.trackId,
31
- allowOverwrite: force || overwrite || false,
32
- itemType: 'track',
33
- });
34
- return {
35
- updatedConfig: { ...configContents, tracks: updatedItems },
36
- wasOverwritten,
37
- };
38
- }
39
- export async function saveTrackConfigAndReport({ config, targetConfigPath, name, trackId, wasOverwritten, }) {
40
- await saveConfigAndReportBase({
41
- config,
42
- target: targetConfigPath,
43
- itemType: 'track',
44
- itemName: name,
45
- itemId: trackId,
46
- wasOverwritten,
47
- });
48
- }
49
- export function buildTrackParams({ flags, location, adapter, configContents, }) {
50
- const trackType = flags.trackType || guessTrackType(adapter.type);
51
- const trackId = flags.trackId || path.basename(location, path.extname(location));
52
- const name = flags.name || trackId;
53
- const assemblyNames = flags.assemblyNames || configContents.assemblies?.[0]?.name || '';
54
- return {
55
- trackType,
56
- trackId,
57
- name,
58
- assemblyNames,
59
- };
60
- }
61
- export function createTrackConfiguration({ location, trackParams, flags, adapter, configContents, }) {
62
- return buildTrackConfig({
63
- location,
64
- trackType: trackParams.trackType,
65
- trackId: trackParams.trackId,
66
- name: trackParams.name,
67
- assemblyNames: trackParams.assemblyNames,
68
- category: flags.category,
69
- description: flags.description,
70
- config: flags.config,
71
- adapter,
72
- configContents,
73
- });
74
- }
package/dist/util.js DELETED
@@ -1,35 +0,0 @@
1
- import { createReadStream } from 'fs';
2
- import { stat } from 'fs/promises';
3
- import path from 'path';
4
- import { Readable } from 'stream';
5
- import { createRemoteStream, isURL } from "./types/common.js";
6
- export async function getLocalOrRemoteStream(uri, out) {
7
- if (isURL(uri)) {
8
- const result = await createRemoteStream(uri);
9
- return {
10
- totalBytes: +(result.headers.get('Content-Length') || 0),
11
- stream: result.body,
12
- };
13
- }
14
- else {
15
- const filename = path.isAbsolute(uri) ? uri : path.join(out, uri);
16
- const stats = await stat(filename);
17
- const nodeStream = createReadStream(filename);
18
- return {
19
- totalBytes: stats.size,
20
- stream: Readable.toWeb(nodeStream),
21
- };
22
- }
23
- }
24
- export function decodeURIComponentNoThrow(uri) {
25
- if (!uri.includes('%')) {
26
- return uri;
27
- }
28
- try {
29
- return decodeURIComponent(uri);
30
- }
31
- catch {
32
- // avoid throwing exception on a failure to decode URI component
33
- return uri;
34
- }
35
- }