react-msaview-cli 7.0.0 → 8.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.
- package/README.md +98 -108
- package/dist/index.js +50233 -47131
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -3,28 +3,29 @@
|
|
|
3
3
|
Annotate a multiple sequence alignment and render it to a publication figure,
|
|
4
4
|
from the command line, with no browser in the loop.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
The CLI has two groups of commands, and the second draws what the first writes:
|
|
7
7
|
|
|
8
|
-
- **Annotate
|
|
8
|
+
- **Annotate**: build a domain or exon GFF for an alignment, from InterPro's
|
|
9
9
|
precomputed matches (`interpro`), a live InterProScan run (`interproscan`), or
|
|
10
10
|
a RefSeq transcript's exon model (`genestructure`).
|
|
11
|
-
- **Render
|
|
12
|
-
standalone SVG (`export-svg`).
|
|
13
|
-
|
|
11
|
+
- **Render**: draw the alignment, its tree, and those annotations to a
|
|
12
|
+
standalone SVG (`export-svg`). The command runs the web viewer's renderer
|
|
13
|
+
headlessly, so the figure matches what the app shows.
|
|
14
14
|
|
|
15
15
|
## Prerequisites
|
|
16
16
|
|
|
17
17
|
- NodeJS v22+
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
scan with
|
|
21
|
-
|
|
19
|
+
`export-svg` and `interpro` need nothing else. `interproscan` needs a backend to
|
|
20
|
+
scan with: the EBI web API (the default, no install), Docker, Singularity, or a
|
|
21
|
+
local InterProScan (see [interproscan](#interproscan)).
|
|
22
22
|
|
|
23
23
|
`export-svg` draws the alignment background as one embedded image when
|
|
24
|
-
[@napi-rs/canvas](https://www.npmjs.com/package/@napi-rs/canvas) is present.
|
|
25
|
-
is an optional dependency with prebuilt binaries, so a normal install
|
|
26
|
-
in
|
|
27
|
-
rectangle per cell
|
|
24
|
+
[@napi-rs/canvas](https://www.npmjs.com/package/@napi-rs/canvas) is present. The
|
|
25
|
+
package is an optional dependency with prebuilt binaries, so a normal install
|
|
26
|
+
brings it in. On a platform with no prebuilt binary, the export draws a
|
|
27
|
+
rectangle per cell, which makes a much larger file and runs slower on big
|
|
28
|
+
alignments.
|
|
28
29
|
|
|
29
30
|
## Setup
|
|
30
31
|
|
|
@@ -55,9 +56,10 @@ react-msaview-cli export-svg --msa kinases.aln --tree kinases.nwk \
|
|
|
55
56
|
|
|
56
57
|

|
|
57
58
|
|
|
58
|
-
The domain architecture reads straight down the alignment
|
|
59
|
-
the catalytic domain
|
|
60
|
-
space
|
|
59
|
+
The domain architecture reads straight down the alignment: SH3, then SH2, then
|
|
60
|
+
the catalytic domain. The renderer draws every row in the alignment's column
|
|
61
|
+
space, so each domain lands in the same columns in every row. The key on the
|
|
62
|
+
right lists the domains present in the GFF.
|
|
61
63
|
|
|
62
64
|
Every figure on this page is `export-svg` output, drawn from the Src-kinase and
|
|
63
65
|
GPCR examples in
|
|
@@ -91,8 +93,8 @@ react-msaview-cli export-svg --msa <file> [options]
|
|
|
91
93
|
`--tracks` names the tracks to draw above the alignment, by id, or `all` for
|
|
92
94
|
every one this alignment has: `conservation`, `property-conservation` (protein
|
|
93
95
|
only), `sequence-logo`, `position-ruler`, `base-pairs` (a Stockholm `SS_cons`
|
|
94
|
-
line), and any track ids the file itself carries.
|
|
95
|
-
|
|
96
|
+
line), and any track ids the file itself carries. The CLI reports a name that
|
|
97
|
+
matches no track.
|
|
96
98
|
|
|
97
99
|
```bash
|
|
98
100
|
react-msaview-cli export-svg --msa kinases.aln --tracks conservation,position-ruler \
|
|
@@ -102,10 +104,9 @@ react-msaview-cli export-svg --msa kinases.aln --tracks conservation,position-ru
|
|
|
102
104
|
### Sizing the figure
|
|
103
105
|
|
|
104
106
|
`export-svg` draws the **entire** alignment unless `--viewport` asks for the
|
|
105
|
-
`--width` x `--height` window at the top left
|
|
106
|
-
as
|
|
107
|
-
|
|
108
|
-
and `--row-height`:
|
|
107
|
+
`--width` x `--height` window at the top left, so the output is normally as wide
|
|
108
|
+
as the alignment is long. `--width` and `--height` size the viewport the model
|
|
109
|
+
lays out in, not the figure. `--col-width` and `--row-height` scale the figure:
|
|
109
110
|
|
|
110
111
|
```bash
|
|
111
112
|
## a 90-column alignment at the default 12px columns: letters are legible
|
|
@@ -122,12 +123,11 @@ react-msaview-cli export-svg --msa kinases.aln --tree kinases.nwk \
|
|
|
122
123
|
|
|
123
124
|

|
|
124
125
|
|
|
125
|
-
Residue letters draw only
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
would be unreadable ink.
|
|
126
|
+
Residue letters draw only in columns at least 5px wide and wider than half the
|
|
127
|
+
row height, and in rows at least 8px tall. The app applies the same rule as you
|
|
128
|
+
zoom out. Below that size the figure is the colored overview above, which
|
|
129
|
+
usually suits a whole-alignment figure: at that scale the conserved blocks and
|
|
130
|
+
gaps are visible, and letters would be too small to read.
|
|
131
131
|
|
|
132
132
|
### Color schemes
|
|
133
133
|
|
|
@@ -142,47 +142,43 @@ react-msaview-cli export-svg --msa gpcrs.fa \
|
|
|
142
142
|
`cinema`, and the `jalview_*` family (`jalview_zappo`, `jalview_taylor`,
|
|
143
143
|
`jalview_hydrophobicity`, `jalview_buried`, `jalview_prophelix`,
|
|
144
144
|
`jalview_propstrand`, `jalview_propturn`) color each residue by identity. The
|
|
145
|
-
two `_dynamic` schemes
|
|
146
|
-
`percent_identity_dynamic
|
|
147
|
-
|
|
148
|
-
`
|
|
149
|
-
`none` turns background color off.
|
|
145
|
+
two `_dynamic` schemes, `clustalx_protein_dynamic` and
|
|
146
|
+
`percent_identity_dynamic`, color each residue by the composition of its column,
|
|
147
|
+
so conserved columns stand out by color. `nucleotide`, `clustalx_dna`,
|
|
148
|
+
`jbrowse_dna` and `rainbow_dna` are for DNA; `none` turns background color off.
|
|
150
149
|
|
|
151
150
|
### Output
|
|
152
151
|
|
|
153
|
-
The SVG
|
|
154
|
-
embedded image where @napi-rs/canvas is installed, and a
|
|
155
|
-
where it is not
|
|
156
|
-
|
|
157
|
-
a journal:
|
|
152
|
+
The SVG grows with the alignment: a 10-row by 856-column figure is about 700KB.
|
|
153
|
+
The background is one embedded image where @napi-rs/canvas is installed, and a
|
|
154
|
+
rectangle per cell where it is not. The letters, the tree and the annotations
|
|
155
|
+
are vector either way. To convert to PNG or PDF for a journal:
|
|
158
156
|
|
|
159
157
|
```bash
|
|
160
158
|
rsvg-convert -w 2000 alignment.svg -o alignment.png
|
|
161
159
|
inkscape alignment.svg --export-filename=alignment.pdf
|
|
162
160
|
```
|
|
163
161
|
|
|
164
|
-
|
|
165
|
-
be regenerated in CI and diffed.
|
|
162
|
+
The same input gives the same bytes, so CI can regenerate a figure and diff it.
|
|
166
163
|
|
|
167
164
|
## Annotating
|
|
168
165
|
|
|
169
166
|
### interpro
|
|
170
167
|
|
|
171
168
|
Build a domain GFF from InterPro's **precomputed** matches for UniProtKB
|
|
172
|
-
accessions
|
|
173
|
-
|
|
174
|
-
InterPro
|
|
175
|
-
|
|
176
|
-
Prefer this over `interproscan` whenever your rows are UniProt accessions.
|
|
169
|
+
accessions. The EBI InterPro API already serves matches for every UniProtKB
|
|
170
|
+
sequence, so the lookup returns in seconds, gives the same result for a given
|
|
171
|
+
InterPro release, and needs no email or rate-limited job. Use this instead of
|
|
172
|
+
`interproscan` whenever your rows are UniProt accessions.
|
|
177
173
|
|
|
178
174
|
```bash
|
|
179
175
|
react-msaview-cli interpro <accessions.tsv> [options]
|
|
180
176
|
```
|
|
181
177
|
|
|
182
178
|
The input is one accession per line, optionally followed by a tab- or
|
|
183
|
-
space-separated row label
|
|
184
|
-
through the same writer
|
|
185
|
-
|
|
179
|
+
space-separated row label. The command skips lines starting with `#`. It writes
|
|
180
|
+
through the same GFF writer as `interproscan`, and adds a `#` header line naming
|
|
181
|
+
the InterPro release the coordinates came from.
|
|
186
182
|
|
|
187
183
|
| Option | Description | Default |
|
|
188
184
|
| --------------------- | ----------------------------------------------- | ------------- |
|
|
@@ -192,11 +188,10 @@ line naming the InterPro release the coordinates came from.
|
|
|
192
188
|
| `--format <name>` | Force the `--msa` format instead of sniffing it | |
|
|
193
189
|
| `--no-cache` | Re-fetch, ignoring the disk cache | off |
|
|
194
190
|
|
|
195
|
-
|
|
196
|
-
isoform or a fragment
|
|
197
|
-
row's ungapped length
|
|
198
|
-
any that
|
|
199
|
-
rather than leaving its row silently undecorated.
|
|
191
|
+
InterPro computes matches on UniProt's canonical sequence, so on a row that is
|
|
192
|
+
an isoform or a fragment the matches land on the wrong residues. With `--msa`,
|
|
193
|
+
the CLI compares each row's ungapped length against the protein's and warns
|
|
194
|
+
about any that differ. It also warns about any accession with no matches.
|
|
200
195
|
|
|
201
196
|
```bash
|
|
202
197
|
react-msaview-cli interpro accessions.tsv -o domains.gff
|
|
@@ -205,25 +200,23 @@ react-msaview-cli interpro accessions.tsv -o domains.gff --database cdd
|
|
|
205
200
|
|
|
206
201
|
#### Caching
|
|
207
202
|
|
|
208
|
-
The InterPro API serves one protein per request
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
with no matches are cached too, so they are not re-fetched every run.
|
|
203
|
+
The InterPro API serves one protein per request and has no batch endpoint, so a
|
|
204
|
+
run makes one request per distinct accession. The CLI caches every response on
|
|
205
|
+
disk under `$XDG_CACHE_HOME/react-msaview-cli/interpro` (override with
|
|
206
|
+
`REACT_MSAVIEW_CACHE`), keyed by InterPro release, so a new release fetches
|
|
207
|
+
fresh coordinates. The cache also records proteins with no matches, so a re-run
|
|
208
|
+
does not fetch them again.
|
|
215
209
|
|
|
216
|
-
A re-run of the same dataset
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
asking EBI for all of them again.
|
|
210
|
+
A re-run of the same dataset makes one request, the release lookup, and reads
|
|
211
|
+
the rest from disk. A failed run can therefore resume. The CLI retries with
|
|
212
|
+
backoff, and if the API stays unreachable, the accessions it already fetched
|
|
213
|
+
stay cached, so the next run fetches only the rest.
|
|
221
214
|
|
|
222
215
|
### interproscan
|
|
223
216
|
|
|
224
217
|
Run InterProScan on all sequences in an MSA file and output results as GFF3. Use
|
|
225
|
-
this when the rows are not UniProt accessions
|
|
226
|
-
proteins, anything InterPro has not
|
|
218
|
+
this when the rows are not UniProt accessions: a de novo assembly, predicted
|
|
219
|
+
proteins, or anything else InterPro has not scanned.
|
|
227
220
|
|
|
228
221
|
```bash
|
|
229
222
|
react-msaview-cli interproscan <input-msa> [options]
|
|
@@ -244,17 +237,17 @@ react-msaview-cli interproscan <input-msa> [options]
|
|
|
244
237
|
| `--email <email>` | Email for EBI API (used only for EBI API runs) | `user@example.com` |
|
|
245
238
|
|
|
246
239
|
By default (no backend flag) the CLI submits sequences to the EBI InterProScan
|
|
247
|
-
REST API one at a time. `--local`, `--docker`, and `--singularity`
|
|
240
|
+
REST API one at a time. `--local`, `--docker`, and `--singularity` run
|
|
248
241
|
InterProScan on the whole alignment locally, which is much faster for large
|
|
249
242
|
datasets.
|
|
250
243
|
|
|
251
244
|
#### Choosing a backend
|
|
252
245
|
|
|
253
246
|
```bash
|
|
254
|
-
## EBI web API
|
|
247
|
+
## EBI web API: no install, one sequential submission per sequence
|
|
255
248
|
react-msaview-cli interproscan alignment.fasta -o domains.gff --email you@example.com
|
|
256
249
|
|
|
257
|
-
## Docker
|
|
250
|
+
## Docker: no InterProScan install, whole alignment in one run
|
|
258
251
|
react-msaview-cli interproscan alignment.fasta -o domains.gff --docker
|
|
259
252
|
|
|
260
253
|
## a local install
|
|
@@ -273,22 +266,20 @@ The published image carries InterProScan but **not** its member database data,
|
|
|
273
266
|
which is a separate multi-gigabyte download. Fetch and unpack the matching
|
|
274
267
|
release's `data/` directory (see the
|
|
275
268
|
[InterProScan docs](https://interproscan-docs.readthedocs.io/)) and point
|
|
276
|
-
`--interproscan-data` at it
|
|
277
|
-
|
|
269
|
+
`--interproscan-data` at it. Both container backends mount it at
|
|
270
|
+
`/opt/interproscan/data` and look for it there.
|
|
278
271
|
|
|
279
|
-
The EBI API has usage limits
|
|
280
|
-
|
|
281
|
-
backend.
|
|
272
|
+
The EBI API has usage limits, so the CLI submits sequences one at a time. Past
|
|
273
|
+
about 100 sequences, use a local or container backend.
|
|
282
274
|
|
|
283
275
|
#### InterProScan programs
|
|
284
276
|
|
|
285
|
-
`--programs` takes the EBI API's names
|
|
286
|
-
`SMART`, `SuperFamily`, `Gene3d`, `PANTHER`, `TIGRFAM`, `HAMAP`,
|
|
277
|
+
`--programs` takes the EBI API's names whichever backend runs: `PfamA` and `CDD`
|
|
278
|
+
(the default), `SMART`, `SuperFamily`, `Gene3d`, `PANTHER`, `TIGRFAM`, `HAMAP`,
|
|
287
279
|
`PrositeProfiles`, `PrositePatterns`, `PRINTS`, `PIRSF`, `MobiDBLite`, `Coils`,
|
|
288
|
-
`SFLD
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
translated names.
|
|
280
|
+
`SFLD`. InterProScan 5 spells several of them differently (`Pfam`, not `PfamA`;
|
|
281
|
+
`NCBIfam`, which absorbed TIGRFAM; `Hamap`; `SUPERFAMILY`; `Gene3D`), and the
|
|
282
|
+
CLI passes the translated names to the local, Docker and Singularity backends.
|
|
292
283
|
|
|
293
284
|
```bash
|
|
294
285
|
react-msaview-cli interproscan alignment.fasta -o domains.gff \
|
|
@@ -298,20 +289,21 @@ react-msaview-cli interproscan alignment.fasta -o domains.gff \
|
|
|
298
289
|
### genestructure
|
|
299
290
|
|
|
300
291
|
Build a **gene-structure GFF** for a coding-sequence alignment from a RefSeq
|
|
301
|
-
transcript, overlaid the same way InterProScan domains are. The
|
|
302
|
-
|
|
303
|
-
so a given exon is the same color in every row and the exon
|
|
304
|
-
straight down the alignment.
|
|
292
|
+
transcript, overlaid the same way InterProScan domains are. The command fetches
|
|
293
|
+
the exon model from the NCBI Datasets v2 API and names each species' Nth exon
|
|
294
|
+
`exon-N`, so a given exon is the same color in every row and the exon
|
|
295
|
+
architecture reads straight down the alignment.
|
|
305
296
|
|
|
306
297
|
```bash
|
|
307
298
|
react-msaview-cli genestructure <input-msa> --gene <symbol> --ref <rowname> [options]
|
|
308
299
|
```
|
|
309
300
|
|
|
310
|
-
The
|
|
311
|
-
columns, then
|
|
312
|
-
exon that picks up a frameshifting indel in one lineage gets
|
|
313
|
-
that row
|
|
314
|
-
the transcript's coding sequence
|
|
301
|
+
The command maps the chosen transcript's exon boundaries onto the reference
|
|
302
|
+
row's columns, then projects them into every other row's ungapped coordinates.
|
|
303
|
+
An exon that picks up a frameshifting indel in one lineage therefore gets
|
|
304
|
+
shorter on that row and stays in the same columns as the rest. The reference row
|
|
305
|
+
must be the transcript's coding sequence; the CLI warns if its length doesn't
|
|
306
|
+
match.
|
|
315
307
|
|
|
316
308
|
| Option | Description | Default |
|
|
317
309
|
| --------------------- | --------------------------------------------- | ------------------- |
|
|
@@ -332,20 +324,19 @@ react-msaview-cli genestructure aln.fa --transcript NM_000505.4 --ref human
|
|
|
332
324
|
|
|
333
325
|
## Input formats
|
|
334
326
|
|
|
335
|
-
The CLI sniffs the format from the file's content, not from its name
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
heuristic:
|
|
327
|
+
The CLI sniffs the format from the file's content, not from its name. `--format`
|
|
328
|
+
(`fasta`, `a3m`, `stockholm`, `clustal`, `emf`) overrides a wrong guess. FASTA
|
|
329
|
+
and A3M share a leading `>`, so the CLI tells them apart heuristically.
|
|
339
330
|
|
|
340
331
|
- **FASTA** (`.fasta`, `.fa`, `.faa`)
|
|
341
332
|
- **Clustal** (`.clustal`, `.aln`)
|
|
342
333
|
- **Stockholm** (`.sto`, `.stockholm`)
|
|
343
|
-
- **A3M** (`.a3m`)
|
|
344
|
-
- **EMF** (`.emf`)
|
|
334
|
+
- **A3M** (`.a3m`), from AlphaFold/ColabFold
|
|
335
|
+
- **EMF** (`.emf`), Ensembl Multi Format
|
|
345
336
|
|
|
346
337
|
## Annotation output format
|
|
347
338
|
|
|
348
|
-
The annotation commands write standard GFF3, one line per feature
|
|
339
|
+
The annotation commands write standard GFF3, one line per feature:
|
|
349
340
|
`protein_match` for a domain from `interpro`/`interproscan`, `exon` for a
|
|
350
341
|
segment from `genestructure`. `start`/`end` are 1-based positions in the
|
|
351
342
|
**ungapped** sequence, and the attributes carry the accession, name, and
|
|
@@ -374,12 +365,12 @@ Done!
|
|
|
374
365
|
|
|
375
366
|
## Using the GFF elsewhere
|
|
376
367
|
|
|
377
|
-
The
|
|
368
|
+
The web viewer, the React component and the R package all load the file the CLI
|
|
369
|
+
writes.
|
|
378
370
|
|
|
379
371
|
In the web viewer, select it in the import form's **Annotation GFF file or URL**
|
|
380
|
-
field
|
|
381
|
-
|
|
382
|
-
above.)
|
|
372
|
+
field, or open it over a loaded alignment with **Annotations > Open annotation
|
|
373
|
+
file...**, which also accepts the JSON an InterProScan run returns.
|
|
383
374
|
|
|
384
375
|
In the React component, pass it inline as the `gff` prop:
|
|
385
376
|
|
|
@@ -395,11 +386,10 @@ msaview(msa = "alignment.fasta", gff = "domains.gff")
|
|
|
395
386
|
|
|
396
387
|
## Troubleshooting
|
|
397
388
|
|
|
398
|
-
**EBI API timeout.**
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
regardless.
|
|
389
|
+
**EBI API timeout.** We measured one sequence waiting fifteen minutes in the
|
|
390
|
+
queue. The CLI waits an hour per job and keeps the results of the sequences that
|
|
391
|
+
finished. Use `--local`, `--docker`, or `--singularity` to run InterProScan
|
|
392
|
+
yourself; on large datasets they are much faster than the API.
|
|
403
393
|
|
|
404
394
|
**Local InterProScan not found.**
|
|
405
395
|
|
|
@@ -415,9 +405,9 @@ nucleotide; try other `--programs`; verify the input parses as one of the
|
|
|
415
405
|
formats above.
|
|
416
406
|
|
|
417
407
|
**The exported figure is enormous.** `export-svg` draws the whole alignment at
|
|
418
|
-
`--col-width` per column.
|
|
419
|
-
half the row height
|
|
420
|
-
size.
|
|
408
|
+
`--col-width` per column. Lower `--col-width` until it fits. Below 5px, or below
|
|
409
|
+
half the row height, the residue letters stop drawing, and they account for most
|
|
410
|
+
of the file size.
|
|
421
411
|
|
|
422
412
|
## Uses
|
|
423
413
|
|