react-msaview-cli 6.4.2 → 7.0.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 +101 -52
  2. package/dist/index.js +127711 -0
  3. package/package.json +10 -15
package/README.md CHANGED
@@ -61,7 +61,7 @@ space. The key on the right is generated from the domains actually present.
61
61
 
62
62
  Every figure on this page is `export-svg` output, drawn from the Src-kinase and
63
63
  GPCR examples in
64
- [packages/examples](https://github.com/GMOD/JBrowseMSA/tree/main/packages/examples/src/examples/exampleData.ts).
64
+ [packages/examples](https://github.com/GMOD/JBrowseMSA/tree/main/packages/examples/data).
65
65
 
66
66
  ## Rendering figures
67
67
 
@@ -69,25 +69,43 @@ GPCR examples in
69
69
  react-msaview-cli export-svg --msa <file> [options]
70
70
  ```
71
71
 
72
- | Option | Description | Default |
73
- | ------------------------ | -------------------------------------------- | --------------- |
74
- | `--msa <file>` | MSA file (FASTA, Stockholm, Clustal, A3M) | _required_ |
75
- | `--tree <file>` | Newick tree file | |
76
- | `--gff <file>` | Domain or exon GFF (from the commands below) | |
77
- | `-o, --output <file>` | Output SVG file path | `alignment.svg` |
78
- | `--color-scheme <name>` | Color scheme | `maeditor` |
79
- | `--col-width <px>` | Width of one alignment column | `12` |
80
- | `--row-height <px>` | Height of one alignment row | `16` |
81
- | `--width <px>` | Viewport width, which sets the tree area | `1200` |
82
- | `--height <px>` | Viewport height | `600` |
83
- | `--tree-area-width <px>` | Tree panel width in pixels | |
72
+ | Option | Description | Default |
73
+ | ------------------------ | ---------------------------------------------- | --------------- |
74
+ | `--msa <file>` | MSA file (FASTA, Stockholm, Clustal, A3M, EMF) | _required_ |
75
+ | `--tree <file>` | Newick tree file | |
76
+ | `--gff <file>` | Domain or exon GFF (from the commands below) | |
77
+ | `-o, --output <file>` | Output SVG file path | `alignment.svg` |
78
+ | `--color-scheme <name>` | Color scheme | `maeditor` |
79
+ | `--col-width <px>` | Width of one alignment column | `12` |
80
+ | `--row-height <px>` | Height of one alignment row | `16` |
81
+ | `--width <px>` | Viewport width, which sets the tree area | `1200` |
82
+ | `--height <px>` | Viewport height | `600` |
83
+ | `--tree-area-width <px>` | Tree panel width in pixels | |
84
+ | `--format <name>` | Force the MSA format instead of sniffing it | |
85
+ | `--tracks <list>` | Tracks to draw above the alignment, by id | none |
86
+ | `--viewport` | Draw the viewport instead of the whole thing | |
87
+ | `--minimap` | Include the minimap bar (`--viewport` only) | |
88
+
89
+ ### Tracks
90
+
91
+ `--tracks` names the tracks to draw above the alignment, by id, or `all` for
92
+ every one this alignment has: `conservation`, `property-conservation` (protein
93
+ only), `sequence-logo`, `position-ruler`, `base-pairs` (a Stockholm `SS_cons`
94
+ line), and any track ids the file itself carries. A name matching no track is
95
+ reported rather than silently dropped.
96
+
97
+ ```bash
98
+ react-msaview-cli export-svg --msa kinases.aln --tracks conservation,position-ruler \
99
+ -o kinases.svg
100
+ ```
84
101
 
85
102
  ### Sizing the figure
86
103
 
87
- `export-svg` always draws the **entire** alignment, so the output is as wide as
88
- the alignment is long — `--width` and `--height` size the viewport the model
89
- lays out in, not the figure. What scales the figure is `--col-width` and
90
- `--row-height`:
104
+ `export-svg` draws the **entire** alignment unless `--viewport` asks for the
105
+ `--width` x `--height` window at the top left instead, so the output is normally
106
+ as wide as the alignment is long `--width` and `--height` size the viewport
107
+ the model lays out in, not the figure. What scales the figure is `--col-width`
108
+ and `--row-height`:
91
109
 
92
110
  ```bash
93
111
  ## a 90-column alignment at the default 12px columns: letters are legible
@@ -132,9 +150,11 @@ conservation shows up as color rather than as something you have to read off.
132
150
 
133
151
  ### Output
134
152
 
135
- The SVG is pure vector: every cell is its own rectangle, so it scales without
136
- limit but grows with the alignment. A 10-row by 856-column figure is about
137
- 700KB. Converting to PNG or PDF for a journal:
153
+ The SVG scales without limit and grows with the alignment. The background is one
154
+ embedded image where @napi-rs/canvas is installed, and a rectangle per cell
155
+ where it is not the letters, the tree and the annotations are vector either
156
+ way. A 10-row by 856-column figure is about 700KB. Converting to PNG or PDF for
157
+ a journal:
138
158
 
139
159
  ```bash
140
160
  rsvg-convert -w 2000 alignment.svg -o alignment.png
@@ -160,14 +180,23 @@ react-msaview-cli interpro <accessions.tsv> [options]
160
180
  ```
161
181
 
162
182
  The input is one accession per line, optionally followed by a tab- or
163
- space-separated row label; lines starting with `#` are ignored. The output GFF
164
- is byte-for-byte compatible with the `interproscan` command.
165
-
166
- | Option | Description | Default |
167
- | --------------------- | --------------------------------- | ------------- |
168
- | `-o, --output <file>` | Output GFF file path | `domains.gff` |
169
- | `--database <name>` | InterPro member db to read | `pfam` |
170
- | `--no-cache` | Re-fetch, ignoring the disk cache | off |
183
+ space-separated row label; lines starting with `#` are ignored. The output goes
184
+ through the same writer the `interproscan` command's does, plus a `#` header
185
+ line naming the InterPro release the coordinates came from.
186
+
187
+ | Option | Description | Default |
188
+ | --------------------- | ----------------------------------------------- | ------------- |
189
+ | `-o, --output <file>` | Output GFF file path | `domains.gff` |
190
+ | `--database <name>` | InterPro member db to read | `pfam` |
191
+ | `--msa <file>` | Alignment to check the rows of (see below) | |
192
+ | `--format <name>` | Force the `--msa` format instead of sniffing it | |
193
+ | `--no-cache` | Re-fetch, ignoring the disk cache | off |
194
+
195
+ Matches are computed on UniProt's canonical sequence, so a row that is an
196
+ isoform or a fragment puts them on the wrong residues. Pass `--msa` and each
197
+ row's ungapped length is checked against the protein's, with a warning naming
198
+ any that disagree. An accession that resolves to no matches is called out too,
199
+ rather than leaving its row silently undecorated.
171
200
 
172
201
  ```bash
173
202
  react-msaview-cli interpro accessions.tsv -o domains.gff
@@ -200,16 +229,19 @@ proteins, anything InterPro has not already scanned.
200
229
  react-msaview-cli interproscan <input-msa> [options]
201
230
  ```
202
231
 
203
- | Option | Description | Default |
204
- | ---------------------------- | ------------------------------------------------------ | --------------------------------------- |
205
- | `-o, --output <file>` | Output GFF file path | `domains.gff` |
206
- | `--local` | Use a local InterProScan installation instead of EBI | `false` |
207
- | `--docker` | Run InterProScan via the `interpro/interproscan` image | `false` |
208
- | `--singularity` | Run InterProScan via a Singularity/Apptainer container | `false` |
209
- | `--singularity-image <img>` | Singularity image to use | `docker://interpro/interproscan:latest` |
210
- | `--interproscan-path <path>` | Path to local interproscan.sh | `interproscan.sh` |
211
- | `--programs <list>` | Comma-separated list of InterProScan programs | `PfamA,CDD` |
212
- | `--email <email>` | Email for EBI API (used only for EBI API runs) | `user@example.com` |
232
+ | Option | Description | Default |
233
+ | ---------------------------- | ------------------------------------------------------ | ------------------------------------------- |
234
+ | `-o, --output <file>` | Output GFF file path | `domains.gff` |
235
+ | `--local` | Use a local InterProScan installation instead of EBI | `false` |
236
+ | `--docker` | Run InterProScan via the `interpro/interproscan` image | `false` |
237
+ | `--singularity` | Run InterProScan via a Singularity/Apptainer container | `false` |
238
+ | `--docker-image <img>` | Docker image to run | `interpro/interproscan:5.78-109.0` |
239
+ | `--singularity-image <img>` | Singularity image to use | `docker://interpro/interproscan:5.78-109.0` |
240
+ | `--interproscan-path <path>` | Path to local interproscan.sh | `interproscan.sh` |
241
+ | `--interproscan-data <dir>` | Member database `data/` to mount into the container | |
242
+ | `--programs <list>` | Comma-separated list of programs, in EBI API naming | `PfamA,CDD` |
243
+ | `--format <name>` | Force the MSA format instead of sniffing it | |
244
+ | `--email <email>` | Email for EBI API (used only for EBI API runs) | `user@example.com` |
213
245
 
214
246
  By default (no backend flag) the CLI submits sequences to the EBI InterProScan
215
247
  REST API one at a time. `--local`, `--docker`, and `--singularity` instead run
@@ -237,15 +269,26 @@ react-msaview-cli interproscan alignment.fasta -o domains.gff \
237
269
  Docker mounts a temp directory into the `interpro/interproscan` container, runs
238
270
  the scan on the whole alignment at once, and reads the JSON back out.
239
271
 
272
+ The published image carries InterProScan but **not** its member database data,
273
+ which is a separate multi-gigabyte download. Fetch and unpack the matching
274
+ release's `data/` directory (see the
275
+ [InterProScan docs](https://interproscan-docs.readthedocs.io/)) and point
276
+ `--interproscan-data` at it; it is mounted at `/opt/interproscan/data`, where
277
+ both container backends look for it.
278
+
240
279
  The EBI API has usage limits: sequences go one at a time, sequentially, to avoid
241
280
  overwhelming the server. Past about 100 sequences, use a local or container
242
281
  backend.
243
282
 
244
283
  #### InterProScan programs
245
284
 
246
- `--programs` takes any combination of `PfamA` (in the default), `CDD` (in the
247
- default), `SMART`, `SUPERFAMILY`, `Gene3D`, `PANTHER`, `TIGRFAM`, `Hamap`,
248
- `ProSiteProfiles`, `ProSitePatterns`, `PRINTS`, `PIRSF`, and `MobiDBLite`.
285
+ `--programs` takes the EBI API's names — `PfamA` and `CDD` (the default),
286
+ `SMART`, `SuperFamily`, `Gene3d`, `PANTHER`, `TIGRFAM`, `HAMAP`,
287
+ `PrositeProfiles`, `PrositePatterns`, `PRINTS`, `PIRSF`, `MobiDBLite`, `Coils`,
288
+ `SFLD` — whichever backend runs. InterProScan 5 spells several of them
289
+ differently (`Pfam`, not `PfamA`; `NCBIfam`, which absorbed TIGRFAM; `Hamap`;
290
+ `SUPERFAMILY`; `Gene3D`), and the local, Docker and Singularity backends get the
291
+ translated names.
249
292
 
250
293
  ```bash
251
294
  react-msaview-cli interproscan alignment.fasta -o domains.gff \
@@ -289,7 +332,10 @@ react-msaview-cli genestructure aln.fa --transcript NM_000505.4 --ref human
289
332
 
290
333
  ## Input formats
291
334
 
292
- The CLI detects the MSA format from the file:
335
+ The CLI sniffs the format from the file's content, not from its name, and
336
+ `--format` (`fasta`, `a3m`, `stockholm`, `clustal`, `emf`) settles it when the
337
+ guess is wrong — FASTA and A3M share a leading `>`, so telling them apart is a
338
+ heuristic:
293
339
 
294
340
  - **FASTA** (`.fasta`, `.fa`, `.faa`)
295
341
  - **Clustal** (`.clustal`, `.aln`)
@@ -299,10 +345,11 @@ The CLI detects the MSA format from the file:
299
345
 
300
346
  ## Annotation output format
301
347
 
302
- The annotation commands write standard GFF3, one `protein_match` line per hit.
303
- `start`/`end` are 1-based positions in the **ungapped** sequence (gaps are
304
- stripped before scanning), and the attributes carry the signature accession,
305
- name, and description:
348
+ The annotation commands write standard GFF3, one line per feature —
349
+ `protein_match` for a domain from `interpro`/`interproscan`, `exon` for a
350
+ segment from `genestructure`. `start`/`end` are 1-based positions in the
351
+ **ungapped** sequence, and the attributes carry the accession, name, and
352
+ description:
306
353
 
307
354
  ```gff
308
355
  ##gff-version 3
@@ -318,9 +365,8 @@ $ react-msaview-cli interproscan gpcrs.fasta -o domains.gff --docker
318
365
  Reading MSA from gpcrs.fasta...
319
366
  Found 4 sequences
320
367
  Processing 4 non-empty sequences...
321
- Running InterProScan via Docker...
322
- Running InterProScan via Docker on 4 sequences (image: interpro/interproscan:latest)...
323
- docker run --rm -v /tmp/interproscan-Xyz12:/data interpro/interproscan:latest -i /data/input.fasta -o /data/output.json -f JSON -appl PfamA,CDD
368
+ Running InterProScan via Docker on 4 sequences...
369
+ docker run --rm -v /tmp/interproscan-Xyz12:/data -v /opt/interproscan-5.78-109.0/data:/opt/interproscan/data interpro/interproscan:5.78-109.0 -i /data/input.fasta -o /data/output.json -f JSON -appl Pfam,CDD
324
370
  Converting results to GFF...
325
371
  Writing output to domains.gff...
326
372
  Done!
@@ -349,7 +395,9 @@ msaview(msa = "alignment.fasta", gff = "domains.gff")
349
395
 
350
396
  ## Troubleshooting
351
397
 
352
- **EBI API timeout.** Use `--local`, `--docker`, or `--singularity` to run
398
+ **EBI API timeout.** A single sequence has been measured at fifteen minutes in
399
+ the queue; the CLI waits an hour per job and keeps the results of the sequences
400
+ that did finish. Use `--local`, `--docker`, or `--singularity` to run
353
401
  InterProScan yourself. For large datasets those are much faster than the API
354
402
  regardless.
355
403
 
@@ -367,8 +415,9 @@ nucleotide; try other `--programs`; verify the input parses as one of the
367
415
  formats above.
368
416
 
369
417
  **The exported figure is enormous.** `export-svg` draws the whole alignment at
370
- `--col-width` per column. Drop `--col-width` until it fits — below ~8px the
371
- residue letters stop drawing, which is most of the file size.
418
+ `--col-width` per column. Drop `--col-width` until it fits — below 5px (or below
419
+ half the row height) the residue letters stop drawing, which is most of the file
420
+ size.
372
421
 
373
422
  ## Uses
374
423