@jbrowse/cli 4.3.0 → 5.0.0-beta.2
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/README.md +413 -57
- package/bin/run +1 -1
- package/bundle/index.js +550 -2659
- package/dist/base.js +0 -3
- package/dist/bin.js +2 -1
- package/dist/cliFetch.js +3 -0
- package/dist/commands/add-assembly/index.js +46 -19
- package/dist/commands/add-assembly/utils.js +204 -290
- package/dist/commands/add-connection.js +73 -79
- package/dist/commands/add-track-json.js +24 -12
- package/dist/commands/add-track-utils/adapter-utils.js +222 -288
- package/dist/commands/add-track-utils/file-operations.js +27 -11
- package/dist/commands/add-track-utils/multiwig.js +47 -0
- package/dist/commands/add-track-utils/track-config.js +68 -25
- package/dist/commands/add-track-utils/validators.js +36 -20
- package/dist/commands/add-track.js +201 -62
- package/dist/commands/admin-server/index.js +30 -49
- package/dist/commands/admin-server/utils.js +235 -125
- package/dist/commands/create.js +18 -34
- package/dist/commands/make-density/density-generator.js +180 -0
- package/dist/commands/make-density/index.js +139 -0
- package/dist/commands/make-pif/index.js +128 -11
- package/dist/commands/make-pif/pif-generator.js +249 -43
- package/dist/commands/process-utils.js +13 -2
- package/dist/commands/remove-track.js +20 -13
- package/dist/commands/set-default-session.js +35 -31
- package/dist/commands/shared/config-operations.js +3 -10
- package/dist/commands/shared/density.js +12 -0
- package/dist/commands/shared/sort-utils.js +67 -10
- package/dist/commands/shared/validators.js +38 -3
- package/dist/commands/sort-bed.js +2 -33
- package/dist/commands/sort-gff.js +2 -33
- package/dist/commands/text-index/adapter-utils.js +6 -23
- package/dist/commands/text-index/aggregate.js +40 -34
- package/dist/commands/text-index/command.js +35 -7
- package/dist/commands/text-index/config-utils.js +60 -83
- package/dist/commands/text-index/file-list.js +32 -18
- package/dist/commands/text-index/index.js +4 -4
- package/dist/commands/text-index/indexing-utils.js +49 -73
- package/dist/commands/text-index/per-track.js +44 -31
- package/dist/commands/text-index/validators.js +1 -1
- package/dist/commands/upgrade.js +20 -32
- package/dist/commands/validate/configManifest.generated.js +5765 -0
- package/dist/commands/validate/displayDefaultKeys.js +28 -0
- package/dist/commands/validate/index.js +97 -0
- package/dist/commands/validate/suggest.js +35 -0
- package/dist/commands/validate/types.js +6 -0
- package/dist/commands/validate/validateConfig.js +522 -0
- package/dist/index.js +104 -50
- package/dist/types/common.js +3 -27
- package/dist/utils.js +309 -128
- package/dist/version.js +1 -1
- package/package.json +8 -10
- package/dist/commands/make-pif/cigar-utils.js +0 -24
- package/dist/commands/make-pif/file-utils.js +0 -30
- package/dist/commands/track-utils.js +0 -74
- package/dist/util.js +0 -35
package/dist/base.js
CHANGED
package/dist/bin.js
CHANGED
package/dist/cliFetch.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { debug, printHelp } from
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
3
|
+
import { debug, printHelp, requirePositional } from '../../utils.js';
|
|
4
|
+
import { loadFiles } from '../add-track-utils/file-operations.js';
|
|
5
|
+
import { validateLoadOption } from '../add-track-utils/validators.js';
|
|
6
|
+
import { saveConfigAndReport } from '../shared/config-operations.js';
|
|
7
|
+
import { addAssemblyToConfig, enhanceAssembly, getAssembly, loadOrCreateConfig, parseSequenceType, resolveTargetPath, } from './utils.js';
|
|
4
8
|
export async function run(args) {
|
|
5
9
|
const options = {
|
|
6
10
|
type: {
|
|
@@ -40,7 +44,6 @@ export async function run(args) {
|
|
|
40
44
|
type: 'string',
|
|
41
45
|
description: 'Type of aliases defined by --refNameAliases; if "custom", --refNameAliases is either a JSON file location or inline JSON that defines a custom sequence adapter',
|
|
42
46
|
choices: ['aliases', 'custom'],
|
|
43
|
-
dependsOn: ['refNameAliases'],
|
|
44
47
|
},
|
|
45
48
|
refNameColors: {
|
|
46
49
|
type: 'string',
|
|
@@ -65,18 +68,14 @@ export async function run(args) {
|
|
|
65
68
|
description: 'Required flag when using a local file. Choose how to manage the data directory. Copy, symlink, or move the data directory to the JBrowse directory. Or use inPlace to modify the config without doing any file operations',
|
|
66
69
|
choices: ['copy', 'symlink', 'move', 'inPlace'],
|
|
67
70
|
},
|
|
68
|
-
skipCheck: {
|
|
69
|
-
type: 'boolean',
|
|
70
|
-
description: "Don't check whether or not the sequence file or URL exists or if you are in a JBrowse directory",
|
|
71
|
-
},
|
|
72
|
-
overwrite: {
|
|
73
|
-
type: 'boolean',
|
|
74
|
-
description: 'Overwrite existing assembly if one with the same name exists',
|
|
75
|
-
},
|
|
76
71
|
force: {
|
|
77
72
|
type: 'boolean',
|
|
78
73
|
short: 'f',
|
|
79
|
-
description: '
|
|
74
|
+
description: 'Overwrite existing assembly and skip file existence checks',
|
|
75
|
+
},
|
|
76
|
+
config: {
|
|
77
|
+
type: 'string',
|
|
78
|
+
description: 'Any extra config settings to add to the assembly',
|
|
80
79
|
},
|
|
81
80
|
};
|
|
82
81
|
const { positionals, values: runFlags } = parseArgs({
|
|
@@ -85,6 +84,13 @@ export async function run(args) {
|
|
|
85
84
|
allowPositionals: true,
|
|
86
85
|
});
|
|
87
86
|
const description = 'Add an assembly to a JBrowse 2 configuration';
|
|
87
|
+
const usage = 'jbrowse add-assembly <sequence> [options]';
|
|
88
|
+
const notes = '--config takes inline JSON (not a file path) that is merged into the ' +
|
|
89
|
+
'generated assembly config, so you can set fields the dedicated flags do ' +
|
|
90
|
+
'not cover. A "sequence" object in it is merged into the generated ' +
|
|
91
|
+
'ReferenceSequenceTrack rather than replacing it, e.g. --config ' +
|
|
92
|
+
'\'{"sequence":{"formatAbout":{"hideUris":true}}}\' hides file URIs in the ' +
|
|
93
|
+
"assembly's About dialog.";
|
|
88
94
|
const examples = [
|
|
89
95
|
'# add assembly to installation in current directory. assumes .fai file also exists, and copies GRCh38.fa and GRCh38.fa.fai to current directory',
|
|
90
96
|
'$ jbrowse add-assembly GRCh38.fa --load copy',
|
|
@@ -109,32 +115,53 @@ export async function run(args) {
|
|
|
109
115
|
'',
|
|
110
116
|
'# add a bgzip indexed fasta inferred by fa.gz extension. assumes .fa.gz.gzi and .fa.gz.fai files also exists',
|
|
111
117
|
'$ jbrowse add-assembly myfile.fa.gz --load copy',
|
|
118
|
+
'',
|
|
119
|
+
'# hide file URIs in the assembly About dialog',
|
|
120
|
+
'$ jbrowse add-assembly GRCh38.fa --load copy --config \'{"sequence":{"formatAbout":{"hideUris":true}}}\'',
|
|
112
121
|
];
|
|
113
122
|
if (runFlags.help) {
|
|
114
123
|
printHelp({
|
|
115
124
|
description,
|
|
116
125
|
examples,
|
|
117
|
-
|
|
126
|
+
notes,
|
|
127
|
+
usage,
|
|
118
128
|
options,
|
|
119
129
|
});
|
|
120
130
|
return;
|
|
121
131
|
}
|
|
122
|
-
|
|
132
|
+
validateLoadOption(runFlags.load);
|
|
133
|
+
const type = parseSequenceType(runFlags.type);
|
|
134
|
+
const argsSequence = positionals[0];
|
|
135
|
+
requirePositional(argsSequence, 'sequence', usage);
|
|
123
136
|
const output = runFlags.target || runFlags.out || '.';
|
|
137
|
+
const flags = { ...runFlags, type };
|
|
124
138
|
debug(`Sequence location is: ${argsSequence}`);
|
|
125
139
|
const target = await resolveTargetPath(output);
|
|
126
|
-
const baseAssembly = await getAssembly({
|
|
127
|
-
|
|
140
|
+
const { assembly: baseAssembly, filesToLoad: sequenceFiles } = await getAssembly({
|
|
141
|
+
runFlags: flags,
|
|
142
|
+
argsSequence,
|
|
143
|
+
});
|
|
144
|
+
const { assembly, filesToLoad: aliasFiles } = await enhanceAssembly(baseAssembly, flags);
|
|
128
145
|
const configContents = await loadOrCreateConfig(target);
|
|
129
146
|
const { config: updatedConfig, wasOverwritten } = await addAssemblyToConfig({
|
|
130
147
|
config: configContents,
|
|
131
148
|
assembly,
|
|
132
|
-
runFlags,
|
|
149
|
+
runFlags: flags,
|
|
150
|
+
});
|
|
151
|
+
await loadFiles({
|
|
152
|
+
files: [...sequenceFiles, ...aliasFiles],
|
|
153
|
+
destDir: path.dirname(target),
|
|
154
|
+
mode: flags.load,
|
|
155
|
+
force: flags.force,
|
|
133
156
|
});
|
|
134
157
|
await saveConfigAndReport({
|
|
135
158
|
config: updatedConfig,
|
|
136
159
|
target,
|
|
137
|
-
assembly,
|
|
160
|
+
itemType: 'assembly',
|
|
161
|
+
itemName: assembly.name,
|
|
162
|
+
itemId: assembly.name,
|
|
138
163
|
wasOverwritten,
|
|
139
164
|
});
|
|
165
|
+
console.log(`\nNext, add tracks to this assembly (replace with your data file):\n` +
|
|
166
|
+
` jbrowse add-track myfile.bam -a ${assembly.name} --load copy`);
|
|
140
167
|
}
|