p2s_mapper 2.0.0 → 2.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 +37 -38
- package/dist/alignmentQuality.d.ts +5 -5
- package/dist/alphaFoldModels.d.ts +4 -4
- package/dist/alphaFoldModels.js +4 -4
- package/dist/chooseMappedEntity.d.ts +11 -13
- package/dist/chooseMappedEntity.js +9 -12
- package/dist/chooseMappedEntity.js.map +1 -1
- package/dist/coordinates.d.ts +11 -13
- package/dist/coordinates.js.map +1 -1
- package/dist/extractStructureSequences.d.ts +21 -28
- package/dist/extractStructureSequences.js +2 -2
- package/dist/extractStructureSequences.js.map +1 -1
- package/dist/fetchUtils.d.ts +7 -7
- package/dist/fetchUtils.js +7 -7
- package/dist/isoformRanking.d.ts +1 -1
- package/dist/mappings.d.ts +9 -12
- package/dist/mappings.js +4 -5
- package/dist/mappings.js.map +1 -1
- package/dist/pairwiseAlignment.d.ts +4 -2
- package/dist/pairwiseAlignment.js +9 -7
- package/dist/pairwiseAlignment.js.map +1 -1
- package/dist/pdbUniProtMapping.d.ts +5 -6
- package/dist/pdbUniProtMapping.js +5 -6
- package/dist/pdbUniProtMapping.js.map +1 -1
- package/dist/structureFormat.d.ts +11 -18
- package/dist/structureFormat.js +4 -6
- package/dist/structureFormat.js.map +1 -1
- package/dist/structureSources.d.ts +1 -1
- package/dist/structureUrls.d.ts +11 -16
- package/dist/structureUrls.js +14 -23
- package/dist/structureUrls.js.map +1 -1
- package/dist/types.d.ts +2 -5
- package/dist/types.js +2 -5
- package/dist/types.js.map +1 -1
- package/dist/uniProtSearch.js +3 -8
- package/dist/uniProtSearch.js.map +1 -1
- package/esm/alignmentQuality.d.ts +5 -5
- package/esm/alphaFoldModels.d.ts +4 -4
- package/esm/alphaFoldModels.js +4 -4
- package/esm/chooseMappedEntity.d.ts +11 -13
- package/esm/chooseMappedEntity.js +9 -12
- package/esm/chooseMappedEntity.js.map +1 -1
- package/esm/coordinates.d.ts +11 -13
- package/esm/coordinates.js.map +1 -1
- package/esm/extractStructureSequences.d.ts +21 -28
- package/esm/extractStructureSequences.js +2 -2
- package/esm/extractStructureSequences.js.map +1 -1
- package/esm/fetchUtils.d.ts +7 -7
- package/esm/fetchUtils.js +7 -7
- package/esm/isoformRanking.d.ts +1 -1
- package/esm/mappings.d.ts +9 -12
- package/esm/mappings.js +4 -5
- package/esm/mappings.js.map +1 -1
- package/esm/pairwiseAlignment.d.ts +4 -2
- package/esm/pairwiseAlignment.js +7 -5
- package/esm/pairwiseAlignment.js.map +1 -1
- package/esm/pdbUniProtMapping.d.ts +5 -6
- package/esm/pdbUniProtMapping.js +5 -6
- package/esm/pdbUniProtMapping.js.map +1 -1
- package/esm/structureFormat.d.ts +11 -18
- package/esm/structureFormat.js +4 -6
- package/esm/structureFormat.js.map +1 -1
- package/esm/structureSources.d.ts +1 -1
- package/esm/structureUrls.d.ts +11 -16
- package/esm/structureUrls.js +14 -23
- package/esm/structureUrls.js.map +1 -1
- package/esm/types.d.ts +2 -5
- package/esm/types.js +2 -5
- package/esm/types.js.map +1 -1
- package/esm/uniProtSearch.js +3 -8
- package/esm/uniProtSearch.js.map +1 -1
- package/package.json +1 -1
- package/src/alignmentQuality.ts +5 -5
- package/src/alphaFoldModels.ts +4 -4
- package/src/chooseMappedEntity.ts +12 -15
- package/src/coordinates.ts +11 -13
- package/src/extractStructureSequences.ts +21 -28
- package/src/fetchUtils.ts +7 -7
- package/src/isoformRanking.ts +1 -1
- package/src/mappings.ts +9 -12
- package/src/pairwiseAlignment.ts +11 -8
- package/src/pdbUniProtMapping.ts +5 -6
- package/src/structureFormat.ts +11 -18
- package/src/structureSources.ts +1 -1
- package/src/structureUrls.ts +14 -23
- package/src/types.ts +2 -5
- package/src/uniProtSearch.ts +3 -8
package/README.md
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
# p2s_mapper
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
3D. The package has no React, JBrowse or Mol\* dependency; it came out of
|
|
16
|
-
[jbrowse-plugin-protein3d](https://github.com/GMOD/jbrowse-plugin-protein3d).
|
|
3
|
+
Lines up a protein sequence with its 3D structure, residue by residue.
|
|
4
|
+
|
|
5
|
+
- **In:** a protein sequence, and an AlphaFold or PDB structure
|
|
6
|
+
- **Out:** which 3D residue each amino acid is, and back
|
|
7
|
+
- Picks the right chain and flags a poor match
|
|
8
|
+
- Finds structures for a gene
|
|
9
|
+
- Places UniProt annotations on a PDB entry
|
|
10
|
+
- With [g2p_mapper](https://github.com/GMOD/g2p_mapper): genome position ↔ 3D
|
|
11
|
+
residue
|
|
12
|
+
- No React, JBrowse or Mol\* dependency
|
|
13
|
+
- Used by
|
|
14
|
+
[jbrowse-plugin-protein3d](https://github.com/GMOD/jbrowse-plugin-protein3d)
|
|
17
15
|
|
|
18
16
|
## Install
|
|
19
17
|
|
|
@@ -63,14 +61,14 @@ if (picked) {
|
|
|
63
61
|
}
|
|
64
62
|
```
|
|
65
63
|
|
|
66
|
-
Every position is 0-based.
|
|
67
|
-
|
|
64
|
+
Every position is 0-based. Structure and transcript positions are separate
|
|
65
|
+
types, so passing one where the other belongs is a compile error.
|
|
68
66
|
|
|
69
67
|
### From a genome position to a residue, and back
|
|
70
68
|
|
|
71
|
-
g2p_mapper
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
g2p_mapper maps genome positions to protein positions. p2s_mapper maps a protein
|
|
70
|
+
position to a structure position, and that to the `label_seq_id` Mol\* uses to
|
|
71
|
+
select a residue.
|
|
74
72
|
|
|
75
73
|
```ts
|
|
76
74
|
import { genomeToTranscriptSeqMapping } from 'g2p_mapper'
|
|
@@ -131,8 +129,9 @@ if (hovered !== undefined) {
|
|
|
131
129
|
|
|
132
130
|
### With a structure loaded in Mol\*
|
|
133
131
|
|
|
134
|
-
`extractEntities` reads each chain's sequence, ids and numbering from a
|
|
135
|
-
Mol\* model
|
|
132
|
+
`extractEntities` reads each chain's sequence, residue ids and numbering from a
|
|
133
|
+
loaded Mol\* model. `StructureModel` lists the fields it reads, so the package
|
|
134
|
+
needs no Mol\* import.
|
|
136
135
|
|
|
137
136
|
```ts
|
|
138
137
|
import {
|
|
@@ -186,12 +185,13 @@ if (accession) {
|
|
|
186
185
|
```
|
|
187
186
|
|
|
188
187
|
Every network function takes `{ fetch?, signal? }` last, defaulting to
|
|
189
|
-
`globalThis.fetch`, so
|
|
188
|
+
`globalThis.fetch`, so the caller can pass a custom fetch and an `AbortSignal`.
|
|
190
189
|
|
|
191
190
|
### Place UniProt annotations on a PDB entry
|
|
192
191
|
|
|
193
|
-
A PDB construct is usually a fragment, numbered differently from UniProt.
|
|
194
|
-
entry's
|
|
192
|
+
A PDB construct is usually a fragment, numbered differently from UniProt.
|
|
193
|
+
`fetchUniProtStructureMappings` reads the entry's alignment to UniProt from
|
|
194
|
+
RCSB.
|
|
195
195
|
|
|
196
196
|
```ts
|
|
197
197
|
import {
|
|
@@ -209,7 +209,7 @@ const toStructure = makeUniProtPositionMap(mapping?.segments ?? [])
|
|
|
209
209
|
toStructure(248) // 154: UniProt residue 248 is structure position 154
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
##
|
|
212
|
+
## Pipeline
|
|
213
213
|
|
|
214
214
|

|
|
215
215
|
|
|
@@ -218,22 +218,21 @@ toStructure(248) // 154: UniProt residue 248 is structure position 154
|
|
|
218
218
|
- [api.md](docs/api.md): every export, with its signature, types and an example
|
|
219
219
|
- [pipeline.md](docs/pipeline.md): the flow above, step by step, and why chain
|
|
220
220
|
choice divides by the shorter sequence
|
|
221
|
-
- [coordinates.md](docs/coordinates.md): the four
|
|
222
|
-
|
|
221
|
+
- [coordinates.md](docs/coordinates.md): the four ways a residue is numbered,
|
|
222
|
+
and which function converts between them
|
|
223
223
|
- [faq.md](docs/faq.md): can I trust the mapping? What the package checks, and
|
|
224
224
|
what it leaves to you
|
|
225
225
|
|
|
226
|
-
##
|
|
227
|
-
|
|
228
|
-
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
position + 1.
|
|
226
|
+
## Pitfalls
|
|
227
|
+
|
|
228
|
+
- Positions are **0-based**, except UniProt positions and author residue
|
|
229
|
+
numbers, which are 1-based. See [coordinates.md](docs/coordinates.md).
|
|
230
|
+
- A `PairwiseAlignment` has **row 0 = transcript, row 1 = structure**. Read the
|
|
231
|
+
rows with `transcriptAlignedSeq` and `structureAlignedSeq`.
|
|
232
|
+
- `chooseMappedEntity` returns the best-matching chain even when the match is
|
|
233
|
+
poor. Check it with `isLowSimilarity` before trusting the mapping.
|
|
234
|
+
- Get Mol\*'s `label_seq_id` from `toLabelSeqIds`, which reads `Entity.seqIds`.
|
|
235
|
+
Adding 1 to the position gives the wrong residue in a PDB file without SEQRES.
|
|
237
236
|
|
|
238
237
|
## License
|
|
239
238
|
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import type { PairwiseAlignment } from './mappings.ts';
|
|
2
2
|
export interface AlignmentQuality {
|
|
3
|
-
/** columns
|
|
3
|
+
/** columns with a residue in both rows, i.e. mapped positions */
|
|
4
4
|
aligned: number;
|
|
5
5
|
identical: number;
|
|
6
6
|
transcriptLength: number;
|
|
7
7
|
structureLength: number;
|
|
8
8
|
/** identical over aligned; 0 when nothing aligned */
|
|
9
9
|
identity: number;
|
|
10
|
-
/** identical over the shorter of the two sequences
|
|
11
|
-
*
|
|
10
|
+
/** identical over the shorter of the two sequences, which separates a
|
|
11
|
+
* real match from a chance local alignment (see LOW_IDENTITY_OVER_SHORTER) */
|
|
12
12
|
identityOverShorter: number;
|
|
13
13
|
/** aligned over the structure's length */
|
|
14
14
|
structureCoverage: number;
|
|
15
15
|
/** first and last transcript residue the alignment covers, 1-based
|
|
16
|
-
* inclusive; 0 when nothing aligned. A structure is usually a fragment,
|
|
17
|
-
* which part of the protein it
|
|
16
|
+
* inclusive; 0 when nothing aligned. A structure is usually a fragment, so
|
|
17
|
+
* these show which part of the protein it contains. */
|
|
18
18
|
transcriptStart: number;
|
|
19
19
|
transcriptEnd: number;
|
|
20
20
|
}
|
|
@@ -22,11 +22,11 @@ export declare function parseAlphaFoldModels(json: unknown): AlphaFoldModel[];
|
|
|
22
22
|
export declare function fetchAlphaFoldModels(uniprotId: string, opts?: FetchOptions): Promise<AlphaFoldModel[]>;
|
|
23
23
|
/**
|
|
24
24
|
* The model to open for a gene's transcripts: one folded from exactly a
|
|
25
|
-
* transcript's translation, canonical first, so
|
|
26
|
-
*
|
|
25
|
+
* transcript's translation, canonical first, so every residue maps to itself;
|
|
26
|
+
* else the canonical model; else the longest isoform model.
|
|
27
27
|
*
|
|
28
|
-
* Takes any record of sequences, since
|
|
29
|
-
*
|
|
28
|
+
* Takes any record of sequences, since a caller may know one translation rather
|
|
29
|
+
* than a gene's isoforms.
|
|
30
30
|
*/
|
|
31
31
|
export declare function pickAlphaFoldModel(models: AlphaFoldModel[], isoformSequences: Record<string, {
|
|
32
32
|
seq: string;
|
package/dist/alphaFoldModels.js
CHANGED
|
@@ -48,11 +48,11 @@ async function fetchAlphaFoldModels(uniprotId, opts) {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* The model to open for a gene's transcripts: one folded from exactly a
|
|
51
|
-
* transcript's translation, canonical first, so
|
|
52
|
-
*
|
|
51
|
+
* transcript's translation, canonical first, so every residue maps to itself;
|
|
52
|
+
* else the canonical model; else the longest isoform model.
|
|
53
53
|
*
|
|
54
|
-
* Takes any record of sequences, since
|
|
55
|
-
*
|
|
54
|
+
* Takes any record of sequences, since a caller may know one translation rather
|
|
55
|
+
* than a gene's isoforms.
|
|
56
56
|
*/
|
|
57
57
|
function pickAlphaFoldModel(models, isoformSequences) {
|
|
58
58
|
const translations = new Set(Object.values(isoformSequences ?? {}).map(v => (0, stripStopCodon_ts_1.stripStopCodon)(v.seq)));
|
|
@@ -9,12 +9,12 @@ import type { AlignmentAlgorithm } from './types.ts';
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function interactionMatchesMappedEntity(entityId: string, mappedEntityId: string | undefined): boolean;
|
|
11
11
|
export interface EntitySelection extends ScoredAlignment {
|
|
12
|
-
/** index
|
|
12
|
+
/** index of the chosen entity in the candidate array */
|
|
13
13
|
index: number;
|
|
14
14
|
}
|
|
15
15
|
export interface ScoredAlignment {
|
|
16
|
-
/** alignment of the transcript against the entity
|
|
17
|
-
*
|
|
16
|
+
/** alignment of the transcript against the entity, with stop codons
|
|
17
|
+
* stripped from both */
|
|
18
18
|
alignment: PairwiseAlignment;
|
|
19
19
|
/** identical aligned residues */
|
|
20
20
|
matches: number;
|
|
@@ -39,17 +39,15 @@ export declare function explainedFraction(matches: number, transcriptLength: num
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function alignTranscriptToEntity(transcript: string, entitySeq: string, algorithm: AlignmentAlgorithm): ScoredAlignment | undefined;
|
|
41
41
|
/**
|
|
42
|
-
* Pick
|
|
42
|
+
* Pick the polymer entity of a structure that is the transcript's protein.
|
|
43
43
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* sequence (see `explainedFraction`). Nucleic-acid entities are never
|
|
50
|
-
* candidates.
|
|
44
|
+
* Taking entity `[0]` mis-maps every heteromeric, protein-DNA or
|
|
45
|
+
* processed-peptide structure where the protein is another chain. An exact
|
|
46
|
+
* sequence match wins outright; otherwise the entity with the highest identity
|
|
47
|
+
* over the shorter sequence wins (see `explainedFraction`). Nucleic-acid
|
|
48
|
+
* entities are never candidates.
|
|
51
49
|
*
|
|
52
|
-
* Returns `undefined` only when there is nothing to map
|
|
53
|
-
* protein
|
|
50
|
+
* Returns `undefined` only when there is nothing to map: no transcript, or no
|
|
51
|
+
* protein entity. It never falls back to another entity.
|
|
54
52
|
*/
|
|
55
53
|
export declare function chooseMappedEntity(transcript: string, entities: readonly (string | EntityCandidate)[], algorithm: AlignmentAlgorithm): EntitySelection | undefined;
|
|
@@ -25,8 +25,7 @@ function interactionMatchesMappedEntity(entityId, mappedEntityId) {
|
|
|
25
25
|
* usually is: on 1H26 the 11-residue p53 peptide matches 11 while CDK2 accrues
|
|
26
26
|
* 58 scattered identities, and on 4ZZJ SIRT1 beats the 7-residue p53 peptide
|
|
27
27
|
* 63 to 6. The Smith-Waterman score is no better there (56 vs 58). Dividing
|
|
28
|
-
* by length
|
|
29
|
-
* gene's product: the peptide scores 0.69 and 0.50, the partners 0.19 and
|
|
28
|
+
* by the shorter length identifies the chain that *is* this gene's product: the peptide scores 0.69 and 0.50, the partners 0.19 and
|
|
30
29
|
* 0.17, and across a ribosome's 55 chains no decoy passes 0.29.
|
|
31
30
|
*
|
|
32
31
|
* Dividing by the *entity's* length alone penalised a fusion construct: a
|
|
@@ -91,18 +90,16 @@ function alignTranscriptToEntity(transcript, entitySeq, algorithm) {
|
|
|
91
90
|
};
|
|
92
91
|
}
|
|
93
92
|
/**
|
|
94
|
-
* Pick
|
|
93
|
+
* Pick the polymer entity of a structure that is the transcript's protein.
|
|
95
94
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
* sequence (see `explainedFraction`). Nucleic-acid entities are never
|
|
102
|
-
* candidates.
|
|
95
|
+
* Taking entity `[0]` mis-maps every heteromeric, protein-DNA or
|
|
96
|
+
* processed-peptide structure where the protein is another chain. An exact
|
|
97
|
+
* sequence match wins outright; otherwise the entity with the highest identity
|
|
98
|
+
* over the shorter sequence wins (see `explainedFraction`). Nucleic-acid
|
|
99
|
+
* entities are never candidates.
|
|
103
100
|
*
|
|
104
|
-
* Returns `undefined` only when there is nothing to map
|
|
105
|
-
* protein
|
|
101
|
+
* Returns `undefined` only when there is nothing to map: no transcript, or no
|
|
102
|
+
* protein entity. It never falls back to another entity.
|
|
106
103
|
*/
|
|
107
104
|
function chooseMappedEntity(transcript, entities, algorithm) {
|
|
108
105
|
const t = (0, stripStopCodon_ts_1.stripStopCodon)(transcript);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chooseMappedEntity.js","sourceRoot":"","sources":["../src/chooseMappedEntity.ts"],"names":[],"mappings":";;AAkBA,wEAKC;
|
|
1
|
+
{"version":3,"file":"chooseMappedEntity.js","sourceRoot":"","sources":["../src/chooseMappedEntity.ts"],"names":[],"mappings":";;AAkBA,wEAKC;AAiDD,8CAQC;AAsBD,0DAgCC;AAcD,gDA8CC;AAlMD,iEAI+B;AAC/B,2DAAoD;AACpD,+CAAyE;AAKzE;;;;;;GAMG;AACH,SAAgB,8BAA8B,CAC5C,QAAgB,EAChB,cAAkC;IAElC,OAAO,cAAc,KAAK,SAAS,IAAI,QAAQ,KAAK,cAAc,CAAA;AACpE,CAAC;AA2BD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAE/B,SAAgB,iBAAiB,CAC/B,OAAe,EACf,gBAAwB,EACxB,YAAoB;IAEpB,OAAO,CACL,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,YAAY,CAAC,GAAG,qBAAqB,CAAC,CAC7E,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,EAAqB;IACzC,MAAM,CAAC,GAAG,IAAA,kCAAoB,EAAC,EAAE,CAAC,CAAA;IAClC,MAAM,CAAC,GAAG,IAAA,iCAAmB,EAAC,EAAE,CAAC,CAAA;IACjC,IAAI,OAAO,GAAG,CAAC,CAAA;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;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uC,CAAA;IAC5D,IAAI,IAAiC,CAAA;IACrC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACvD,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAE,CAAA;QAC/C,IAAI,WAAW,EAAE,CAAC;YAChB,SAAQ;QACV,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACpB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;QAC5D,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAC7B,IAAI,MAAM,IAAI,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3D,IAAI,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,EAAE,CAAA;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
package/dist/coordinates.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { PairwiseAlignment } from './mappings.ts';
|
|
2
2
|
/**
|
|
3
|
-
* Branded coordinate spaces. Every position
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* the
|
|
7
|
-
*
|
|
8
|
-
* boundaries where raw numbers enter (molstar picks, hover events, features).
|
|
3
|
+
* Branded coordinate spaces. Every position is a plain `number` at runtime, but
|
|
4
|
+
* a structure residue index, a transcript residue index and an alignment column
|
|
5
|
+
* mean different things, and mixing them causes off-by-one bugs. The brands
|
|
6
|
+
* make the compiler reject mixing; wrap a raw number with the helpers below
|
|
7
|
+
* where it enters, such as a molstar pick, a hover event or a feature.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* All are 0-based. StructurePos indexes the ungapped structure sequence,
|
|
10
|
+
* TranscriptPos the ungapped transcript sequence, and AlignmentCol a column of
|
|
11
|
+
* the pairwise alignment, gaps included.
|
|
13
12
|
*/
|
|
14
13
|
export type StructurePos = number & {
|
|
15
14
|
readonly __brand: 'StructurePos';
|
|
@@ -39,10 +38,9 @@ export interface CoordinateMapper {
|
|
|
39
38
|
transcriptToAlignment: (p: TranscriptPos) => AlignmentCol | undefined;
|
|
40
39
|
alignmentToTranscript: (c: AlignmentCol) => TranscriptPos | undefined;
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* point conversions.
|
|
41
|
+
* The lookup tables as plain numbers, for code that iterates a whole map,
|
|
42
|
+
* such as drawing a per-residue track or selecting every aligned residue.
|
|
43
|
+
* Use the typed methods above to convert one position.
|
|
46
44
|
*/
|
|
47
45
|
readonly maps: CoordinateMaps;
|
|
48
46
|
}
|
package/dist/coordinates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../src/coordinates.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"coordinates.js","sourceRoot":"","sources":["../src/coordinates.ts"],"names":[],"mappings":";;;AAyDA,oDAiCC;AASD,0EAgBC;AAnHD,+CAIsB;AACtB,iDAA0C;AAmBnC,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAiB,CAAA;AAA/C,QAAA,YAAY,gBAAmC;AACrD,MAAM,aAAa,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAkB,CAAA;AAAjD,QAAA,aAAa,iBAAoC;AACvD,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAiB,CAAA;AAA/C,QAAA,YAAY,gBAAmC;AA0B5D;;;;GAIG;AACH,SAAgB,oBAAoB,CACl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AAO,EAAE,EAAE,CAAC;QAChE,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,CAAC,IAAA,qBAAa,EAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAA;QACpE,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;YACxD,IAAI,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QACvD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS;QAC9C,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,GAAG,CAAC,EAAE,CAAA;AACrC,CAAC"}
|
|
@@ -1,42 +1,35 @@
|
|
|
1
1
|
/** A polymer entity of a loaded structure: its mmCIF entity id, its one-letter
|
|
2
|
-
* sequence, and the molstar `label_seq_id` of each
|
|
2
|
+
* sequence, and the molstar `label_seq_id` of each residue.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Structure positions are 0-based indices into `seq`, and molstar selects
|
|
5
|
+
* residues by `label_seq_id`. The two differ by 1 only when the entity's
|
|
6
|
+
* sequence covers every residue from 1, which holds for any mmCIF with an
|
|
7
|
+
* `entity_poly_seq` category (all of RCSB and AlphaFold) and for a PDB file
|
|
8
|
+
* with SEQRES records, from which molstar builds that category.
|
|
6
9
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* residues
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* carrying SEQRES records, because molstar synthesizes the category from them.
|
|
13
|
-
*
|
|
14
|
-
* A PDB-format file with no SEQRES has no such category, so molstar falls back
|
|
15
|
-
* to `StructureSequence.fromHierarchy` and takes `label_seq_id` straight from
|
|
16
|
-
* the observed residues' author numbering: a chain whose coordinates start at
|
|
17
|
-
* residue 94 yields seqIds 94.., and an unobserved loop leaves a hole. Deriving
|
|
18
|
-
* the id arithmetically there is off by the whole offset, in both directions —
|
|
19
|
-
* every hover reads the wrong residue and every highlight paints the wrong one.
|
|
20
|
-
* So carry the real ids and convert through them.
|
|
10
|
+
* For a PDB file without SEQRES, molstar falls back to
|
|
11
|
+
* `StructureSequence.fromHierarchy` and takes `label_seq_id` from the observed
|
|
12
|
+
* residues' author numbering: a chain whose coordinates start at residue 94 has
|
|
13
|
+
* seqIds 94.., and an unobserved loop leaves a gap. Adding 1 there is off by the
|
|
14
|
+
* whole offset, in both directions, so convert through `seqIds`.
|
|
21
15
|
*/
|
|
22
16
|
export interface Entity {
|
|
23
|
-
/** mmCIF entity id
|
|
17
|
+
/** mmCIF entity id */
|
|
24
18
|
entityId: string;
|
|
25
19
|
/** one letter per residue, observed or not */
|
|
26
20
|
seq: string;
|
|
27
21
|
/** molstar `label_seq_id` per position of `seq` */
|
|
28
22
|
seqIds: number[];
|
|
29
|
-
/** author chain ids
|
|
30
|
-
*
|
|
23
|
+
/** author chain ids of this entity, e.g. ['A', 'B'] for a homodimer, as
|
|
24
|
+
* the PDB entry page lists them */
|
|
31
25
|
chains: string[];
|
|
32
|
-
/** DNA, RNA or a hybrid, by molstar's entity subtype.
|
|
33
|
-
* amino
|
|
34
|
-
* rather than left to score low. */
|
|
26
|
+
/** DNA, RNA or a hybrid, by molstar's entity subtype. A, C, G, T and U
|
|
27
|
+
* are amino-acid letters too, so chooseMappedEntity skips these. */
|
|
35
28
|
nucleicAcid?: boolean;
|
|
36
29
|
/** `auth_seq_id` per position: the depositors' numbering, which papers cite
|
|
37
|
-
* (1TUP's position 154 is R248) and Mol*'s hover shows.
|
|
38
|
-
*
|
|
39
|
-
* hierarchy. See `residueNumber`. */
|
|
30
|
+
* (1TUP's position 154 is R248) and Mol*'s hover shows. For display only;
|
|
31
|
+
* use `seqIds` to select residues in Mol*. Absent when the model has no
|
|
32
|
+
* atomic hierarchy. See `residueNumber`. */
|
|
40
33
|
authSeqIds?: number[];
|
|
41
34
|
}
|
|
42
35
|
export interface Column<T> {
|
|
@@ -123,8 +116,8 @@ export declare function oneLetterSequence(codes: ArrayLike<string>, canonical: s
|
|
|
123
116
|
export declare function extractEntities(model: StructureModel): Entity[] | undefined;
|
|
124
117
|
/** A user-facing name for an entity: its chains when known, else its id. */
|
|
125
118
|
export declare function entityLabel(entity: Entity): string;
|
|
126
|
-
/** The protein chains' sequences, for
|
|
127
|
-
*
|
|
119
|
+
/** The protein chains' sequences, for ranking isoforms against a structure.
|
|
120
|
+
* DNA chains are left out, because their letters align as amino acids. */
|
|
128
121
|
export declare function extractStructureSequences(model: StructureModel): string[] | undefined;
|
|
129
122
|
/**
|
|
130
123
|
* The molstar `label_seq_id`s for a set of 0-based structure positions. Unknown
|
|
@@ -169,8 +169,8 @@ function entityLabel(entity) {
|
|
|
169
169
|
: `Entity ${entity.entityId}`;
|
|
170
170
|
return `${chains} (${entity.seq.length} ${entity.nucleicAcid ? 'nt' : 'aa'})`;
|
|
171
171
|
}
|
|
172
|
-
/** The protein chains' sequences, for
|
|
173
|
-
*
|
|
172
|
+
/** The protein chains' sequences, for ranking isoforms against a structure.
|
|
173
|
+
* DNA chains are left out, because their letters align as amino acids. */
|
|
174
174
|
function extractStructureSequences(model) {
|
|
175
175
|
return extractEntities(model)
|
|
176
176
|
?.filter(e => !e.nucleicAcid)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractStructureSequences.js","sourceRoot":"","sources":["../src/extractStructureSequences.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"extractStructureSequences.js","sourceRoot":"","sources":["../src/extractStructureSequences.ts"],"names":[],"mappings":";;AAgHA,wCAkBC;AAKD,sCAEC;AAQD,0DAmBC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,IAAI,CAAC,EAAE,CAAC,CAAA;QACd,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,+EAA+E;AAC/E,SAAgB,kBAAkB,CAChC,MAA0B,EAC1B,KAAiD;IAEjD,IAAI,CAAC,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACtC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IACrD,OAAO,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AAC3D,CAAC;AAED,iFAAiF;AACjF,SAAgB,mBAAmB,CAAC,MAA0B;IAC5D,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;IACvC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE;QACjC,0EAA0E;QAC1E,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACnB,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAA;QACpB,CAAC;IACH,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/fetchUtils.d.ts
CHANGED
|
@@ -12,9 +12,9 @@ export declare class HttpError extends Error {
|
|
|
12
12
|
* not. */
|
|
13
13
|
export declare function isDefinitiveFailure(e: unknown): boolean;
|
|
14
14
|
/**
|
|
15
|
-
* The error a failed response
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* The error for a failed response: status and host, plus at most the first line
|
|
16
|
+
* of the body. A whole body is an HTML error page or a megabyte of JSON, which
|
|
17
|
+
* hides the line that says what went wrong.
|
|
18
18
|
*/
|
|
19
19
|
export declare function httpError(response: Response, url: string): Promise<HttpError>;
|
|
20
20
|
/**
|
|
@@ -38,10 +38,10 @@ export declare function rawfetch(url: string, args?: FetchOptions): Promise<Resp
|
|
|
38
38
|
export declare function myfetch(url: string, args?: FetchOptions): Promise<Response>;
|
|
39
39
|
export declare function jsonfetch<T = unknown>(url: string, args?: FetchOptions): Promise<T>;
|
|
40
40
|
/**
|
|
41
|
-
* An AbortSignal's reason as a real Error. `signal.reason` is `any
|
|
42
|
-
* DOMException, but a caller can abort with
|
|
43
|
-
*
|
|
44
|
-
*
|
|
41
|
+
* An AbortSignal's reason as a real Error. `signal.reason` is `any`, usually a
|
|
42
|
+
* DOMException, but a caller can abort with any value, and throwing a non-Error
|
|
43
|
+
* loses the stack and breaks `instanceof Error` checks. Use it at every throw
|
|
44
|
+
* site.
|
|
45
45
|
*/
|
|
46
46
|
export declare function abortError(signal: AbortSignal): Error;
|
|
47
47
|
export declare function timeout(time: number, signal?: AbortSignal): Promise<void>;
|
package/dist/fetchUtils.js
CHANGED
|
@@ -43,9 +43,9 @@ function isDefinitiveFailure(e) {
|
|
|
43
43
|
return e instanceof HttpError && e.status >= 400 && e.status < 500;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* The error a failed response
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* The error for a failed response: status and host, plus at most the first line
|
|
47
|
+
* of the body. A whole body is an HTML error page or a megabyte of JSON, which
|
|
48
|
+
* hides the line that says what went wrong.
|
|
49
49
|
*/
|
|
50
50
|
async function httpError(response, url) {
|
|
51
51
|
const detail = firstLine(await response.text().catch(() => ''));
|
|
@@ -104,10 +104,10 @@ async function jsonfetch(url, args) {
|
|
|
104
104
|
return response.json();
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* An AbortSignal's reason as a real Error. `signal.reason` is `any
|
|
108
|
-
* DOMException, but a caller can abort with
|
|
109
|
-
*
|
|
110
|
-
*
|
|
107
|
+
* An AbortSignal's reason as a real Error. `signal.reason` is `any`, usually a
|
|
108
|
+
* DOMException, but a caller can abort with any value, and throwing a non-Error
|
|
109
|
+
* loses the stack and breaks `instanceof Error` checks. Use it at every throw
|
|
110
|
+
* site.
|
|
111
111
|
*/
|
|
112
112
|
function abortError(signal) {
|
|
113
113
|
return signal.reason instanceof Error
|
package/dist/isoformRanking.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface RankedIsoform {
|
|
|
10
10
|
/** identical residues against the structure, for an isoform that does not
|
|
11
11
|
* match it exactly; undefined with no structure to compare to */
|
|
12
12
|
identical?: number;
|
|
13
|
-
/** that alignment's score, which
|
|
13
|
+
/** that alignment's score, which ranks the non-matching isoforms */
|
|
14
14
|
score?: number;
|
|
15
15
|
}
|
|
16
16
|
export interface ClassifiedIsoforms {
|
package/dist/mappings.d.ts
CHANGED
|
@@ -3,13 +3,11 @@ export interface AlignmentRow {
|
|
|
3
3
|
seq: string;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* A two-row alignment
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* every coordinate map. Read the rows through the accessors below rather than
|
|
12
|
-
* indexing, so a call site states which sequence it means.
|
|
6
|
+
* A two-row alignment: row 0 is the transcript and row 1 is the structure.
|
|
7
|
+
* alignSequences takes them in that order and every consumer depends on it,
|
|
8
|
+
* but the type cannot enforce it, and swapped rows invert every coordinate map
|
|
9
|
+
* without an error. Read the rows with the accessors below, so a call site
|
|
10
|
+
* names the sequence it means.
|
|
13
11
|
*/
|
|
14
12
|
export interface PairwiseAlignment {
|
|
15
13
|
consensus: string;
|
|
@@ -21,11 +19,10 @@ export declare const structureAlignedSeq: (pa: PairwiseAlignment) => string;
|
|
|
21
19
|
* `pairwiseAlignmentProblem` is what guarantees it. */
|
|
22
20
|
export declare const alignmentLength: (pa: PairwiseAlignment) => number;
|
|
23
21
|
/**
|
|
24
|
-
* Why a pairwise alignment can't be used, or undefined if it's usable.
|
|
25
|
-
* rows must
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* report it; the internal map builders assert on it.
|
|
22
|
+
* Why a pairwise alignment can't be used, or undefined if it's usable. Both
|
|
23
|
+
* rows must have the same non-zero length, because every coordinate map walks
|
|
24
|
+
* them in step. Check an alignment from outside the package with this; the
|
|
25
|
+
* internal map builders throw on it.
|
|
29
26
|
*/
|
|
30
27
|
export declare function pairwiseAlignmentProblem(pa: PairwiseAlignment): string | undefined;
|
|
31
28
|
/**
|
package/dist/mappings.js
CHANGED
|
@@ -19,11 +19,10 @@ exports.structureAlignedSeq = structureAlignedSeq;
|
|
|
19
19
|
const alignmentLength = (pa) => (0, exports.transcriptAlignedSeq)(pa).length;
|
|
20
20
|
exports.alignmentLength = alignmentLength;
|
|
21
21
|
/**
|
|
22
|
-
* Why a pairwise alignment can't be used, or undefined if it's usable.
|
|
23
|
-
* rows must
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* report it; the internal map builders assert on it.
|
|
22
|
+
* Why a pairwise alignment can't be used, or undefined if it's usable. Both
|
|
23
|
+
* rows must have the same non-zero length, because every coordinate map walks
|
|
24
|
+
* them in step. Check an alignment from outside the package with this; the
|
|
25
|
+
* internal map builders throw on it.
|
|
27
26
|
*/
|
|
28
27
|
function pairwiseAlignmentProblem(pa) {
|
|
29
28
|
const transcript = (0, exports.transcriptAlignedSeq)(pa);
|