@jbrowse/img 4.1.3 → 4.1.5
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/esm/bin.js +118 -14
- package/package.json +7 -7
- package/esm/cli.d.ts +0 -1
- package/esm/cli.js +0 -95
package/esm/bin.js
CHANGED
|
@@ -1,15 +1,119 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import yargs from 'yargs';
|
|
4
|
+
import { hideBin } from 'yargs/helpers';
|
|
5
|
+
import { convert, parseArgv, renderRegion, setupEnv, standardizeArgv, } from './index.js';
|
|
6
|
+
const trackTypes = [
|
|
7
|
+
'bam',
|
|
8
|
+
'cram',
|
|
9
|
+
'bigwig',
|
|
10
|
+
'vcfgz',
|
|
11
|
+
'gffgz',
|
|
12
|
+
'hic',
|
|
13
|
+
'bigbed',
|
|
14
|
+
'bedgz',
|
|
15
|
+
];
|
|
16
|
+
const knownOptions = new Set([
|
|
17
|
+
...trackTypes,
|
|
18
|
+
'fasta',
|
|
19
|
+
'aliases',
|
|
20
|
+
'assembly',
|
|
21
|
+
'config',
|
|
22
|
+
'session',
|
|
23
|
+
'loc',
|
|
24
|
+
'out',
|
|
25
|
+
'width',
|
|
26
|
+
'noRasterize',
|
|
27
|
+
'defaultSession',
|
|
28
|
+
'tracks',
|
|
29
|
+
'cytobands',
|
|
30
|
+
'help',
|
|
31
|
+
'version',
|
|
32
|
+
]);
|
|
33
|
+
const yargsInstance = yargs(hideBin(process.argv))
|
|
34
|
+
.scriptName('jb2export')
|
|
35
|
+
.usage('$0 [options]')
|
|
36
|
+
.option('fasta', {
|
|
37
|
+
type: 'string',
|
|
38
|
+
description: 'Path to indexed FASTA file',
|
|
39
|
+
})
|
|
40
|
+
.option('aliases', {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Path to reference name aliases file',
|
|
43
|
+
})
|
|
44
|
+
.option('assembly', {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Path to assembly JSON or name in config',
|
|
47
|
+
})
|
|
48
|
+
.option('config', {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'Path to JBrowse config.json',
|
|
51
|
+
})
|
|
52
|
+
.option('session', {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'Path to session JSON',
|
|
55
|
+
})
|
|
56
|
+
.option('loc', {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Location to render (e.g., chr1:1-1000 or "all")',
|
|
59
|
+
})
|
|
60
|
+
.option('out', {
|
|
61
|
+
type: 'string',
|
|
62
|
+
description: 'Output file path (SVG or PNG)',
|
|
63
|
+
})
|
|
64
|
+
.option('width', {
|
|
65
|
+
type: 'number',
|
|
66
|
+
description: 'Width of output in pixels',
|
|
67
|
+
default: 1500,
|
|
68
|
+
})
|
|
69
|
+
.option('noRasterize', {
|
|
70
|
+
type: 'boolean',
|
|
71
|
+
description: 'Disable rasterization of pileup/coverage',
|
|
72
|
+
default: false,
|
|
73
|
+
})
|
|
74
|
+
.option('defaultSession', {
|
|
75
|
+
type: 'boolean',
|
|
76
|
+
description: 'Use default session from config',
|
|
77
|
+
default: false,
|
|
78
|
+
})
|
|
79
|
+
.example('$0 --fasta ref.fa --bam reads.bam --loc chr1:1-10000 --out out.svg', 'Render BAM alignments')
|
|
80
|
+
.example('$0 --fasta ref.fa --vcfgz variants.vcf.gz --loc chr1:1-50000 --out out.png', 'Render VCF variants')
|
|
81
|
+
.epilogue('Track options: --bam, --cram, --bigwig, --vcfgz, --gffgz, --hic, --bigbed, --bedgz')
|
|
82
|
+
.strict(false)
|
|
83
|
+
.help();
|
|
84
|
+
async function main() {
|
|
85
|
+
const argv = await yargsInstance.argv;
|
|
86
|
+
setupEnv();
|
|
87
|
+
const args = process.argv.slice(2);
|
|
88
|
+
const parsed = parseArgv(args);
|
|
89
|
+
const standardized = standardizeArgv(parsed, trackTypes);
|
|
90
|
+
for (const [key] of parsed) {
|
|
91
|
+
if (!knownOptions.has(key)) {
|
|
92
|
+
console.warn(`Warning: unknown option "--${key}"`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const opts = {
|
|
96
|
+
fasta: argv.fasta,
|
|
97
|
+
aliases: argv.aliases,
|
|
98
|
+
assembly: argv.assembly,
|
|
99
|
+
config: argv.config,
|
|
100
|
+
session: argv.session,
|
|
101
|
+
loc: argv.loc,
|
|
102
|
+
width: argv.width,
|
|
103
|
+
noRasterize: argv.noRasterize,
|
|
104
|
+
defaultSession: argv.defaultSession ? 'true' : undefined,
|
|
105
|
+
trackList: standardized.trackList,
|
|
106
|
+
};
|
|
107
|
+
const result = await renderRegion(opts);
|
|
108
|
+
const outFile = argv.out || standardized.out;
|
|
109
|
+
if (!outFile) {
|
|
110
|
+
console.log(result);
|
|
111
|
+
}
|
|
112
|
+
else if (outFile.endsWith('.png')) {
|
|
113
|
+
convert(result, { out: outFile, pngwidth: String(argv.width || 2048) });
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
fs.writeFileSync(outFile, result);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
await main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/img",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.5",
|
|
4
4
|
"main": "esm/index.js",
|
|
5
5
|
"types": "esm/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@emotion/cache": "^11.14.0",
|
|
27
27
|
"@emotion/react": "^11.14.0",
|
|
28
|
-
"@types/jsdom": "^
|
|
28
|
+
"@types/jsdom": "^27.0.0",
|
|
29
29
|
"@types/yargs": "^17.0.35",
|
|
30
30
|
"canvas": "^3.2.1",
|
|
31
|
-
"jsdom": "
|
|
32
|
-
"react": "^19.2.
|
|
33
|
-
"react-dom": "^19.2.
|
|
31
|
+
"jsdom": "28.0.0",
|
|
32
|
+
"react": "^19.2.4",
|
|
33
|
+
"react-dom": "^19.2.4",
|
|
34
34
|
"tmp": "^0.2.5",
|
|
35
35
|
"yargs": "^18.0.0",
|
|
36
|
-
"@jbrowse/
|
|
37
|
-
"@jbrowse/
|
|
36
|
+
"@jbrowse/plugin-linear-genome-view": "^4.1.5",
|
|
37
|
+
"@jbrowse/react-linear-genome-view2": "^4.1.5"
|
|
38
38
|
},
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
package/esm/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function main(): Promise<void>;
|
package/esm/cli.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import yargs from 'yargs';
|
|
3
|
-
import { hideBin } from 'yargs/helpers';
|
|
4
|
-
import { convert, parseArgv, renderRegion, setupEnv, standardizeArgv, } from './index.js';
|
|
5
|
-
const trackTypes = [
|
|
6
|
-
'bam',
|
|
7
|
-
'cram',
|
|
8
|
-
'bigwig',
|
|
9
|
-
'vcfgz',
|
|
10
|
-
'gffgz',
|
|
11
|
-
'hic',
|
|
12
|
-
'bigbed',
|
|
13
|
-
'bedgz',
|
|
14
|
-
];
|
|
15
|
-
const yargsInstance = yargs(hideBin(process.argv))
|
|
16
|
-
.scriptName('jb2export')
|
|
17
|
-
.usage('$0 [options]')
|
|
18
|
-
.option('fasta', {
|
|
19
|
-
type: 'string',
|
|
20
|
-
description: 'Path to indexed FASTA file',
|
|
21
|
-
})
|
|
22
|
-
.option('aliases', {
|
|
23
|
-
type: 'string',
|
|
24
|
-
description: 'Path to reference name aliases file',
|
|
25
|
-
})
|
|
26
|
-
.option('assembly', {
|
|
27
|
-
type: 'string',
|
|
28
|
-
description: 'Path to assembly JSON or name in config',
|
|
29
|
-
})
|
|
30
|
-
.option('config', {
|
|
31
|
-
type: 'string',
|
|
32
|
-
description: 'Path to JBrowse config.json',
|
|
33
|
-
})
|
|
34
|
-
.option('session', {
|
|
35
|
-
type: 'string',
|
|
36
|
-
description: 'Path to session JSON',
|
|
37
|
-
})
|
|
38
|
-
.option('loc', {
|
|
39
|
-
type: 'string',
|
|
40
|
-
description: 'Location to render (e.g., chr1:1-1000 or "all")',
|
|
41
|
-
})
|
|
42
|
-
.option('out', {
|
|
43
|
-
type: 'string',
|
|
44
|
-
description: 'Output file path (SVG or PNG)',
|
|
45
|
-
})
|
|
46
|
-
.option('width', {
|
|
47
|
-
type: 'number',
|
|
48
|
-
description: 'Width of output in pixels',
|
|
49
|
-
default: 1500,
|
|
50
|
-
})
|
|
51
|
-
.option('noRasterize', {
|
|
52
|
-
type: 'boolean',
|
|
53
|
-
description: 'Disable rasterization of pileup/coverage',
|
|
54
|
-
default: false,
|
|
55
|
-
})
|
|
56
|
-
.option('defaultSession', {
|
|
57
|
-
type: 'boolean',
|
|
58
|
-
description: 'Use default session from config',
|
|
59
|
-
default: false,
|
|
60
|
-
})
|
|
61
|
-
.example('$0 --fasta ref.fa --bam reads.bam --loc chr1:1-10000 --out out.svg', 'Render BAM alignments')
|
|
62
|
-
.example('$0 --fasta ref.fa --vcfgz variants.vcf.gz --loc chr1:1-50000 --out out.png', 'Render VCF variants')
|
|
63
|
-
.epilogue('Track options: --bam, --cram, --bigwig, --vcfgz, --gffgz, --hic, --bigbed, --bedgz')
|
|
64
|
-
.strict(false)
|
|
65
|
-
.help();
|
|
66
|
-
export async function main() {
|
|
67
|
-
const argv = await yargsInstance.argv;
|
|
68
|
-
setupEnv();
|
|
69
|
-
const args = process.argv.slice(2);
|
|
70
|
-
const parsed = parseArgv(args);
|
|
71
|
-
const standardized = standardizeArgv(parsed, trackTypes);
|
|
72
|
-
const opts = {
|
|
73
|
-
fasta: argv.fasta,
|
|
74
|
-
aliases: argv.aliases,
|
|
75
|
-
assembly: argv.assembly,
|
|
76
|
-
config: argv.config,
|
|
77
|
-
session: argv.session,
|
|
78
|
-
loc: argv.loc,
|
|
79
|
-
width: argv.width,
|
|
80
|
-
noRasterize: argv.noRasterize,
|
|
81
|
-
defaultSession: argv.defaultSession ? 'true' : undefined,
|
|
82
|
-
trackList: standardized.trackList,
|
|
83
|
-
};
|
|
84
|
-
const result = await renderRegion(opts);
|
|
85
|
-
const outFile = argv.out || standardized.out;
|
|
86
|
-
if (!outFile) {
|
|
87
|
-
console.log(result);
|
|
88
|
-
}
|
|
89
|
-
else if (outFile.endsWith('.png')) {
|
|
90
|
-
convert(result, { out: outFile, pngwidth: String(argv.width || 2048) });
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
fs.writeFileSync(outFile, result);
|
|
94
|
-
}
|
|
95
|
-
}
|