react-msaview-cli 9.0.0 → 9.1.0

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 (3) hide show
  1. package/README.md +103 -62
  2. package/dist/index.js +24097 -23728
  3. package/package.json +5 -4
package/README.md CHANGED
@@ -10,14 +10,15 @@ The CLI has two groups of commands, and the second draws what the first writes:
10
10
  a RefSeq transcript's exon model (`genestructure`), and relate rows to 3D
11
11
  structures (`residue-mappings`).
12
12
  - **Render**: draw the alignment, its tree, and those annotations to a
13
- standalone SVG (`export-svg`). The command runs the web viewer's renderer
14
- headlessly, so the figure matches what the app shows.
13
+ standalone SVG, PNG or PDF (`export-svg`). The command runs the web viewer's
14
+ renderer headlessly, so the figure matches what the app shows.
15
15
 
16
16
  ## Prerequisites
17
17
 
18
18
  - NodeJS v22+
19
19
 
20
- `export-svg`, `interpro` and `residue-mappings` need nothing else.
20
+ `export-svg`, `interpro` and `residue-mappings` need nothing else, except that
21
+ `export-svg` writes PNG and PDF through `rsvg-convert` from librsvg.
21
22
  `interproscan` needs a backend to scan with: the EBI web API (the default, no
22
23
  install), Docker, Singularity, or a local InterProScan (see
23
24
  [interproscan](#interproscan)).
@@ -73,23 +74,31 @@ GPCR examples in
73
74
  react-msaview-cli export-svg --msa <file> [options]
74
75
  ```
75
76
 
76
- | Option | Description | Default |
77
- | ------------------------ | ---------------------------------------------- | --------------- |
78
- | `--spec <file.json>` | View spec or snapshot (see below) | |
79
- | `--msa <file>` | MSA file (FASTA, Stockholm, Clustal, A3M, EMF) | _required_ |
80
- | `--tree <file>` | Newick tree file | |
81
- | `--gff <file>` | Domain or exon GFF, or InterProScan JSON | |
82
- | `-o, --output <file>` | Output SVG file path | `alignment.svg` |
83
- | `--color-scheme <name>` | Color scheme | `maeditor` |
84
- | `--col-width <px>` | Width of one alignment column | `12` |
85
- | `--row-height <px>` | Height of one alignment row | `16` |
86
- | `--width <px>` | Viewport width, which sets the tree area | `1200` |
87
- | `--height <px>` | Viewport height | `600` |
88
- | `--tree-area-width <px>` | Tree panel width in pixels | |
89
- | `--format <name>` | Force the MSA format instead of sniffing it | |
90
- | `--tracks <list>` | Tracks to draw above the alignment, by id | none |
91
- | `--viewport` | Draw the viewport instead of the whole thing | |
92
- | `--minimap` | Include the minimap bar (`--viewport` only) | |
77
+ <!-- options:export-svg -->
78
+
79
+ | Option | Description | Default |
80
+ | ------------------------ | ------------------------------------------------------------------------------------------------------ | --------------------------------- |
81
+ | `--spec <file.json>` | View spec or snapshot, with any layer from docs/layers.md; the flags below override it | |
82
+ | `--props <file.json>` | MSAViewer props as the R and Python widgets send them, in place of `--spec` | |
83
+ | `--msa <file>` | MSA file (FASTA, Stockholm, Clustal, A3M, EMF); required without `--spec` or `--props` | |
84
+ | `--format <name>` | Force the MSA format (stockholm, fasta, a3m, clustal, emf) instead of sniffing it | |
85
+ | `--tree <file>` | Newick tree file | |
86
+ | `--gff <file>` | Domain or exon GFF, or InterProScan JSON | |
87
+ | `-o, --output <file>` | Output file; `.svg`, `.png` or `.pdf` picks the format, and PNG and PDF need rsvg-convert from librsvg | `alignment.svg` |
88
+ | `--scale <n>` | Pixels per SVG unit in a PNG | `2` |
89
+ | `--color-scheme <name>` | Color scheme | `maeditor` |
90
+ | `--theme <light\|dark>` | Page and text colors | the `--props` theme, else `light` |
91
+ | `--width <px>` | Viewport width, which sets the tree area | `1200` |
92
+ | `--height <px>` | Viewport height | `600` |
93
+ | `--tree-area-width <px>` | Tree panel width in pixels | fit to the labels |
94
+ | `--col-width <px>` | Width of one alignment column | `12` |
95
+ | `--row-height <px>` | Height of one alignment row | `16` |
96
+ | `--tracks <list>` | Tracks to draw above the alignment, by id (`conservation,position-ruler`), or `all` | none |
97
+ | `--viewport` | Draw the `--width` x `--height` viewport at the top left instead of the entire alignment | |
98
+ | `--minimap` | Include the minimap bar (`--viewport` only) | |
99
+ | `--force` | Export past the 500,000-letter limit, where the export can run out of memory | |
100
+
101
+ <!-- /options -->
93
102
 
94
103
  ### Tracks
95
104
 
@@ -169,14 +178,22 @@ so conserved columns stand out by color. `nucleotide`, `clustalx_dna`,
169
178
  The SVG grows with the alignment: a 10-row by 856-column figure is about 700KB.
170
179
  The background is one embedded image where @napi-rs/canvas is installed, and a
171
180
  rectangle per cell where it is not. The letters, the tree and the annotations
172
- are vector either way. To convert to PNG or PDF for a journal:
181
+ are vector either way.
182
+
183
+ An `-o` ending in `.png` or `.pdf` converts the SVG with `rsvg-convert` from
184
+ librsvg (`apt install librsvg2-bin`, `brew install librsvg`). A PDF keeps the
185
+ letters, the tree and the annotations vector. `--scale` sets the pixels per SVG
186
+ unit of a PNG, 2 by default:
173
187
 
174
188
  ```bash
175
- rsvg-convert -w 2000 alignment.svg -o alignment.png
176
- inkscape alignment.svg --export-filename=alignment.pdf
189
+ react-msaview-cli export-svg --msa kinases.aln --tree kinases.nwk -o kinases.pdf
190
+ react-msaview-cli export-svg --msa kinases.aln --scale 4 -o kinases.png
177
191
  ```
178
192
 
179
- The same input gives the same bytes, so CI can regenerate a figure and diff it.
193
+ The same input gives the same bytes on one machine, so CI can regenerate a
194
+ figure and diff it. With @napi-rs/canvas installed, the export measures labels
195
+ with that machine's fonts, so the tree area can come out a few pixels wider or
196
+ narrower on another machine.
180
197
 
181
198
  ## Annotating
182
199
 
@@ -200,13 +217,17 @@ id or anything else InterPro does not key by; run `interproscan` on those. It
200
217
  writes through the same GFF writer as `interproscan`, and adds a `#` header line
201
218
  naming the InterPro release the coordinates came from.
202
219
 
203
- | Option | Description | Default |
204
- | --------------------- | ----------------------------------------------- | ------------- |
205
- | `-o, --output <file>` | Output GFF file path | `domains.gff` |
206
- | `--database <name>` | InterPro member db to read | `pfam` |
207
- | `--msa <file>` | Alignment to check the rows of (see below) | |
208
- | `--format <name>` | Force the `--msa` format instead of sniffing it | |
209
- | `--no-cache` | Re-fetch, ignoring the disk cache | off |
220
+ <!-- options:interpro -->
221
+
222
+ | Option | Description | Default |
223
+ | --------------------- | ----------------------------------------------------------------------------------- | ------------- |
224
+ | `-o, --output <file>` | Output GFF file | `domains.gff` |
225
+ | `--database <name>` | InterPro member database to read | `pfam` |
226
+ | `--msa <file>` | Alignment the GFF is for; the CLI checks each row's ungapped length against UniProt | |
227
+ | `--format <name>` | Force the `--msa` format instead of sniffing it | |
228
+ | `--no-cache` | Re-fetch every accession, ignoring the disk cache | |
229
+
230
+ <!-- /options -->
210
231
 
211
232
  InterPro computes matches on UniProt's canonical sequence. A label ending in
212
233
  `/start-end`, as Pfam and Stockholm name a fragment row (`P12931/84-145`), moves
@@ -248,19 +269,23 @@ proteins, or anything else InterPro has not scanned.
248
269
  react-msaview-cli interproscan <input-msa> [options]
249
270
  ```
250
271
 
251
- | Option | Description | Default |
252
- | ---------------------------- | ------------------------------------------------------ | ------------------------------------------- |
253
- | `-o, --output <file>` | Output GFF file path | `domains.gff` |
254
- | `--local` | Use a local InterProScan installation instead of EBI | `false` |
255
- | `--docker` | Run InterProScan via the `interpro/interproscan` image | `false` |
256
- | `--singularity` | Run InterProScan via a Singularity/Apptainer container | `false` |
257
- | `--docker-image <img>` | Docker image to run | `interpro/interproscan:5.78-109.0` |
258
- | `--singularity-image <img>` | Singularity image to use | `docker://interpro/interproscan:5.78-109.0` |
259
- | `--interproscan-path <path>` | Path to local interproscan.sh | `interproscan.sh` |
260
- | `--interproscan-data <dir>` | Member database `data/` to mount into the container | |
261
- | `--programs <list>` | Comma-separated list of programs, in EBI API naming | `PfamA,CDD` |
262
- | `--format <name>` | Force the MSA format instead of sniffing it | |
263
- | `--email <email>` | Email for EBI API (used only for EBI API runs) | `user@example.com` |
272
+ <!-- options:interproscan -->
273
+
274
+ | Option | Description | Default |
275
+ | ----------------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------- |
276
+ | `-o, --output <file>` | Output GFF file | `domains.gff` |
277
+ | `--local` | Run a local InterProScan installation instead of the EBI API | |
278
+ | `--docker` | Run InterProScan in the `interpro/interproscan` Docker image | |
279
+ | `--singularity` | Run InterProScan in a Singularity/Apptainer container | |
280
+ | `--docker-image <image>` | Docker image to run | `interpro/interproscan:5.78-109.0` |
281
+ | `--singularity-image <image>` | Singularity image to run | `docker://interpro/interproscan:5.78-109.0` |
282
+ | `--interproscan-path <path>` | Path to a local interproscan.sh | `interproscan.sh` |
283
+ | `--interproscan-data <dir>` | Host directory holding the member database `data/` to mount into the container, which the image ships without | |
284
+ | `--programs <list>` | Comma-separated programs in the EBI API's naming; the container and local backends get the InterProScan 5 names | `PfamA,CDD` |
285
+ | `--format <name>` | Force the MSA format (stockholm, fasta, a3m, clustal, emf) instead of sniffing it | |
286
+ | `--email <email>` | Email for the EBI API, which only EBI runs send | `user@example.com` |
287
+
288
+ <!-- /options -->
264
289
 
265
290
  By default (no backend flag) the CLI submits sequences to the EBI InterProScan
266
291
  REST API one at a time. `--local`, `--docker`, and `--singularity` run
@@ -331,14 +356,19 @@ shorter on that row and stays in the same columns as the rest. The reference row
331
356
  must be the transcript's coding sequence; the CLI warns if its length doesn't
332
357
  match.
333
358
 
334
- | Option | Description | Default |
335
- | --------------------- | --------------------------------------------- | ------------------- |
336
- | `--gene <symbol>` | Gene symbol to look up in RefSeq (e.g. `F12`) | |
337
- | `--taxon <name\|id>` | Taxon for `--gene` | `human` |
338
- | `--gene-id <id>` | NCBI GeneID, instead of `--gene` | |
339
- | `--transcript <acc>` | Specific transcript accession | MANE/RefSeq Select |
340
- | `--ref <rowname>` | Reference row = the transcript's CDS | first row |
341
- | `-o, --output <file>` | Output GFF file path | `genestructure.gff` |
359
+ <!-- options:genestructure -->
360
+
361
+ | Option | Description | Default |
362
+ | --------------------- | --------------------------------------------------------------------------------- | ------------------- |
363
+ | `--gene <symbol>` | Gene symbol to look up in RefSeq (e.g. `F12`) | |
364
+ | `--taxon <name\|id>` | Taxon for `--gene` | `human` |
365
+ | `--gene-id <id>` | NCBI GeneID, instead of `--gene` | |
366
+ | `--transcript <acc>` | Specific transcript accession | MANE/RefSeq Select |
367
+ | `--ref <rowname>` | Reference row, which must be the transcript's CDS | first row |
368
+ | `--format <name>` | Force the MSA format (stockholm, fasta, a3m, clustal, emf) instead of sniffing it | |
369
+ | `-o, --output <file>` | Output GFF file | `genestructure.gff` |
370
+
371
+ <!-- /options -->
342
372
 
343
373
  ```bash
344
374
  ## F12 coding alignment -> 14-exon overlay (MANE Select transcript, human row)
@@ -362,16 +392,21 @@ react-msaview-cli residue-mappings --msa <file> --row <name> --accession <acc> \
362
392
  react-msaview-cli residue-mappings --msa <file> --rows <tsv> [-o mappings.json]
363
393
  ```
364
394
 
365
- | Option | Description | Default |
366
- | ------------------------- | ------------------------------------------------------- | ------- |
367
- | `--msa <file>` | Alignment holding the rows | |
368
- | `--format <name>` | Force the MSA format instead of sniffing it | |
369
- | `--rows <tsv>` | `row`, `accession`, `structure` per line, tab-separated | |
370
- | `--row <name>` | One row, instead of `--rows` | |
371
- | `--accession <acc>` | The row's UniProtKB accession | |
372
- | `--pdb <id> --chain <id>` | The PDB entry and its author chain | |
373
- | `--alphafold` | The AlphaFold DB model of the accession instead | |
374
- | `-o, --output <file>` | Output JSON file | stdout |
395
+ <!-- options:residue-mappings -->
396
+
397
+ | Option | Description | Default |
398
+ | --------------------- | ------------------------------------------------------------------------------------------------------- | ------- |
399
+ | `--msa <file>` | Alignment holding the rows (required) | |
400
+ | `--format <name>` | Force the MSA format (stockholm, fasta, a3m, clustal, emf) instead of sniffing it | |
401
+ | `--rows <tsv>` | `row`, `accession`, `structure` per line, tab-separated, where the structure is `6VXX:A` or `alphafold` | |
402
+ | `--row <name>` | One row, instead of `--rows` | |
403
+ | `--accession <acc>` | The row's UniProtKB accession | |
404
+ | `--pdb <id>` | The PDB entry to map the row onto | |
405
+ | `--chain <id>` | The `--pdb` entry's author chain | |
406
+ | `--alphafold` | Map the row onto the AlphaFold DB model of the accession instead | |
407
+ | `-o, --output <file>` | Output JSON file | stdout |
408
+
409
+ <!-- /options -->
375
410
 
376
411
  In `--rows`, the structure column is `6VXX:A` or `alphafold`, and a
377
412
  `row accession structure` header line is optional. A row may appear on several
@@ -483,6 +518,12 @@ formats above.
483
518
  half the row height, the residue letters stop drawing, and they account for most
484
519
  of the file size.
485
520
 
521
+ **The export refuses to draw the entire alignment.** Each residue letter is an
522
+ SVG element, and an alignment of 500 rows by 1000 columns takes 3.4GB to export.
523
+ Past 500,000 letters the CLI stops with an error unless `--force` is given. A
524
+ `--col-width` below 5 or a `--row-height` below 8 draws the same alignment with
525
+ no letters, and `--viewport` draws one window of it.
526
+
486
527
  ## Uses
487
528
 
488
529
  [msa-parsers](https://github.com/GMOD/JBrowseMSA/tree/main/packages/msa-parsers)