p2s_mapper 1.3.0 → 2.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.
- package/README.md +214 -32
- package/dist/alphaFoldModels.d.ts +4 -0
- package/dist/alphaFoldModels.js +4 -0
- package/dist/alphaFoldModels.js.map +1 -1
- package/dist/coordinates.d.ts +8 -6
- package/dist/coordinates.js.map +1 -1
- package/dist/dbIds.d.ts +1 -2
- package/dist/dbIds.js +5 -1
- package/dist/dbIds.js.map +1 -1
- package/dist/extractPerResidueConfidence.d.ts +1 -2
- package/dist/extractStructureSequences.d.ts +14 -15
- package/dist/fetchUtils.js +19 -1
- package/dist/fetchUtils.js.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/isoformRanking.d.ts +3 -0
- package/dist/pairwiseAlignment.d.ts +1 -2
- package/dist/pdbEntry.d.ts +32 -0
- package/dist/pdbEntry.js +182 -0
- package/dist/pdbEntry.js.map +1 -0
- package/dist/pdbUniProtMapping.d.ts +9 -33
- package/dist/pdbUniProtMapping.js +17 -134
- package/dist/pdbUniProtMapping.js.map +1 -1
- package/dist/structureSources.d.ts +37 -13
- package/dist/structureSources.js +144 -57
- package/dist/structureSources.js.map +1 -1
- package/dist/structureUrls.d.ts +2 -0
- package/dist/structureUrls.js +11 -0
- package/dist/structureUrls.js.map +1 -1
- package/esm/alphaFoldModels.d.ts +4 -0
- package/esm/alphaFoldModels.js +4 -0
- package/esm/alphaFoldModels.js.map +1 -1
- package/esm/coordinates.d.ts +8 -6
- package/esm/coordinates.js.map +1 -1
- package/esm/dbIds.d.ts +1 -2
- package/esm/dbIds.js +5 -1
- package/esm/dbIds.js.map +1 -1
- package/esm/extractPerResidueConfidence.d.ts +1 -2
- package/esm/extractStructureSequences.d.ts +14 -15
- package/esm/fetchUtils.js +19 -1
- package/esm/fetchUtils.js.map +1 -1
- package/esm/index.d.ts +1 -3
- package/esm/index.js +2 -4
- package/esm/index.js.map +1 -1
- package/esm/isoformRanking.d.ts +3 -0
- package/esm/pairwiseAlignment.d.ts +1 -2
- package/esm/pdbEntry.d.ts +32 -0
- package/esm/pdbEntry.js +174 -0
- package/esm/pdbEntry.js.map +1 -0
- package/esm/pdbUniProtMapping.d.ts +9 -33
- package/esm/pdbUniProtMapping.js +17 -131
- package/esm/pdbUniProtMapping.js.map +1 -1
- package/esm/structureSources.d.ts +37 -13
- package/esm/structureSources.js +139 -55
- package/esm/structureSources.js.map +1 -1
- package/esm/structureUrls.d.ts +2 -0
- package/esm/structureUrls.js +9 -0
- package/esm/structureUrls.js.map +1 -1
- package/package.json +3 -2
- package/src/alphaFoldModels.ts +12 -0
- package/src/coordinates.ts +3 -4
- package/src/dbIds.ts +6 -2
- package/src/extractPerResidueConfidence.ts +1 -1
- package/src/extractStructureSequences.ts +14 -14
- package/src/fetchUtils.ts +23 -1
- package/src/index.ts +2 -4
- package/src/isoformRanking.ts +3 -3
- package/src/pairwiseAlignment.ts +1 -1
- package/src/pdbEntry.ts +240 -0
- package/src/pdbUniProtMapping.ts +20 -158
- package/src/structureSources.ts +194 -70
- package/src/structureUrls.ts +11 -0
- package/dist/pdbeBestStructures.d.ts +0 -23
- package/dist/pdbeBestStructures.js +0 -79
- package/dist/pdbeBestStructures.js.map +0 -1
- package/dist/pdbeEntryMolecules.d.ts +0 -7
- package/dist/pdbeEntryMolecules.js +0 -39
- package/dist/pdbeEntryMolecules.js.map +0 -1
- package/dist/siftsNumbering.d.ts +0 -23
- package/dist/siftsNumbering.js +0 -44
- package/dist/siftsNumbering.js.map +0 -1
- package/esm/pdbeBestStructures.d.ts +0 -23
- package/esm/pdbeBestStructures.js +0 -73
- package/esm/pdbeBestStructures.js.map +0 -1
- package/esm/pdbeEntryMolecules.d.ts +0 -7
- package/esm/pdbeEntryMolecules.js +0 -35
- package/esm/pdbeEntryMolecules.js.map +0 -1
- package/esm/siftsNumbering.d.ts +0 -23
- package/esm/siftsNumbering.js +0 -40
- package/esm/siftsNumbering.js.map +0 -1
- package/src/pdbeBestStructures.ts +0 -94
- package/src/pdbeEntryMolecules.ts +0 -37
- package/src/siftsNumbering.ts +0 -61
package/README.md
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
# p2s_mapper
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
into per-codon genome positions, on either strand and across exon boundaries. It
|
|
18
|
-
is p2s_mapper's only runtime dependency, and chaining the two takes you from a
|
|
19
|
-
genome coordinate to a residue in 3D and back.
|
|
20
|
-
|
|
21
|
-
Extracted from
|
|
22
|
-
[jbrowse-plugin-protein3d](https://github.com/GMOD/jbrowse-plugin-protein3d),
|
|
23
|
-
where we made the measurements behind the scoring rules. The package has no
|
|
24
|
-
React, JBrowse or Mol\* dependency: a loaded Mol\* model reaches it through
|
|
25
|
-
narrow structural interfaces.
|
|
3
|
+
Find which residue of a 3D protein structure each amino acid of a transcript
|
|
4
|
+
lands on, and back.
|
|
5
|
+
|
|
6
|
+
Give it a transcript's translation and a structure, an AlphaFold model or a PDB
|
|
7
|
+
entry. p2s_mapper picks the chain that is the gene's protein, aligns the two,
|
|
8
|
+
and builds the lookups between transcript positions, structure positions and the
|
|
9
|
+
residue ids a viewer such as Mol\* uses. It also finds structures for a gene,
|
|
10
|
+
judges whether a match is real, and uses a PDB entry's UniProt alignment to
|
|
11
|
+
place UniProt annotations and drop the residues of a fusion partner.
|
|
12
|
+
|
|
13
|
+
Pair it with [g2p_mapper](https://github.com/GMOD/g2p_mapper), which maps genome
|
|
14
|
+
positions to protein positions, to go from a genome coordinate to a residue in
|
|
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).
|
|
26
17
|
|
|
27
18
|
## Install
|
|
28
19
|
|
|
@@ -30,28 +21,219 @@ narrow structural interfaces.
|
|
|
30
21
|
npm install p2s_mapper
|
|
31
22
|
```
|
|
32
23
|
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Map a transcript onto a structure
|
|
27
|
+
|
|
28
|
+
Pass the transcript's translation and the structure's chain sequences.
|
|
29
|
+
`chooseMappedEntity` picks the chain, `isLowSimilarity` checks the match is not
|
|
30
|
+
chance, and `makeCoordinateMapper` converts positions both ways.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import {
|
|
34
|
+
alignmentQuality,
|
|
35
|
+
chooseMappedEntity,
|
|
36
|
+
describeAlignmentQuality,
|
|
37
|
+
isLowSimilarity,
|
|
38
|
+
makeCoordinateMapper,
|
|
39
|
+
structurePos,
|
|
40
|
+
transcriptPos,
|
|
41
|
+
} from 'p2s_mapper'
|
|
42
|
+
|
|
43
|
+
// p53's N-terminus, and a structure holding a DNA strand and a tagged fragment
|
|
44
|
+
const transcript = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDP*'
|
|
45
|
+
const chains = [
|
|
46
|
+
{ seq: 'TTTCCTAGACTTGCCCAATTA', nucleicAcid: true },
|
|
47
|
+
{ seq: 'GSHMSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQW' },
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
const picked = chooseMappedEntity(transcript, chains, 'smith_waterman')
|
|
51
|
+
if (picked) {
|
|
52
|
+
picked.index // 1: the protein chain
|
|
53
|
+
|
|
54
|
+
const quality = alignmentQuality(picked.alignment)
|
|
55
|
+
isLowSimilarity(quality) // false
|
|
56
|
+
describeAlignmentQuality(quality)
|
|
57
|
+
// '98% identity over 40 of 43 structure residues'
|
|
58
|
+
|
|
59
|
+
const mapper = makeCoordinateMapper(picked.alignment)
|
|
60
|
+
mapper.transcriptToStructure(transcriptPos(16)) // 6
|
|
61
|
+
mapper.structureToTranscript(structurePos(6)) // 16
|
|
62
|
+
mapper.structureToTranscript(structurePos(0)) // undefined: the GSH tag
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Every position is 0-based. The two kinds are separate branded types, so passing
|
|
67
|
+
a structure position where a transcript position belongs is a compile error.
|
|
68
|
+
|
|
69
|
+
### From a genome position to a residue, and back
|
|
70
|
+
|
|
71
|
+
g2p_mapper turns the transcript's CDS into genome ↔ protein tables; p2s_mapper
|
|
72
|
+
carries a protein position on to the structure and to the `label_seq_id` Mol\*
|
|
73
|
+
addresses residues by.
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
import { genomeToTranscriptSeqMapping } from 'g2p_mapper'
|
|
77
|
+
import {
|
|
78
|
+
chooseMappedEntity,
|
|
79
|
+
codonGenomeSpan,
|
|
80
|
+
makeCoordinateMapper,
|
|
81
|
+
makeLabelSeqIdIndex,
|
|
82
|
+
residueNumber,
|
|
83
|
+
structurePos,
|
|
84
|
+
toLabelSeqIds,
|
|
85
|
+
transcriptPos,
|
|
86
|
+
} from 'p2s_mapper'
|
|
87
|
+
import type { Entity } from 'p2s_mapper'
|
|
88
|
+
|
|
89
|
+
const transcript = 'MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDP*'
|
|
90
|
+
const { g2p, p2gCodon } = genomeToTranscriptSeqMapping({
|
|
91
|
+
refName: 'chr17',
|
|
92
|
+
start: 1000,
|
|
93
|
+
end: 2117,
|
|
94
|
+
strand: 1,
|
|
95
|
+
subfeatures: [
|
|
96
|
+
{ refName: 'chr17', start: 1000, end: 1060, type: 'CDS', phase: 0 },
|
|
97
|
+
{ refName: 'chr17', start: 2000, end: 2117, type: 'CDS' },
|
|
98
|
+
],
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// normally from extractEntities(model); here the author numbering starts at 12
|
|
102
|
+
const entity: Entity = {
|
|
103
|
+
entityId: '1',
|
|
104
|
+
seq: 'GSHMSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQW',
|
|
105
|
+
seqIds: Array.from({ length: 43 }, (_, i) => i + 1),
|
|
106
|
+
authSeqIds: Array.from({ length: 43 }, (_, i) => i + 12),
|
|
107
|
+
chains: ['A'],
|
|
108
|
+
}
|
|
109
|
+
const picked = chooseMappedEntity(transcript, [entity], 'smith_waterman')!
|
|
110
|
+
const mapper = makeCoordinateMapper(picked.alignment)
|
|
111
|
+
|
|
112
|
+
// genome -> structure
|
|
113
|
+
const proteinPos = g2p[2000] // 20
|
|
114
|
+
if (proteinPos !== undefined) {
|
|
115
|
+
const pos = mapper.transcriptToStructure(transcriptPos(proteinPos)) // 10
|
|
116
|
+
if (pos !== undefined) {
|
|
117
|
+
toLabelSeqIds(entity, [pos]) // [11]: what to highlight in Mol*
|
|
118
|
+
residueNumber(entity, pos) // 22: what to show the user
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// a Mol* hover on label_seq_id 15 -> genome
|
|
123
|
+
const hovered = makeLabelSeqIdIndex(entity).get(15) // 14
|
|
124
|
+
if (hovered !== undefined) {
|
|
125
|
+
const t = mapper.structureToTranscript(structurePos(hovered)) // 24
|
|
126
|
+
if (t !== undefined) {
|
|
127
|
+
codonGenomeSpan(p2gCodon, t) // [2012, 2015]
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### With a structure loaded in Mol\*
|
|
133
|
+
|
|
134
|
+
`extractEntities` reads each chain's sequence, ids and numbering from a loaded
|
|
135
|
+
Mol\* model, through a narrow structural type rather than a Mol\* import.
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import {
|
|
139
|
+
chooseMappedEntity,
|
|
140
|
+
extractEntities,
|
|
141
|
+
rangeToLabelSeqIds,
|
|
142
|
+
} from 'p2s_mapper'
|
|
143
|
+
import type { StructureModel } from 'p2s_mapper'
|
|
144
|
+
|
|
145
|
+
// e.g. what plugin.builders.structure.createModel resolves to
|
|
146
|
+
declare const model: StructureModel
|
|
147
|
+
declare const transcript: string
|
|
148
|
+
|
|
149
|
+
const entities = extractEntities(model) ?? []
|
|
150
|
+
const picked = chooseMappedEntity(transcript, entities, 'smith_waterman')
|
|
151
|
+
const entity = picked ? entities[picked.index] : undefined
|
|
152
|
+
|
|
153
|
+
// the label_seq_ids of structure positions 10-19, for a Mol* selection
|
|
154
|
+
rangeToLabelSeqIds(entity, { start: 10, end: 20 })
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Find a structure for a gene
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import {
|
|
161
|
+
fetchAlphaFoldModels,
|
|
162
|
+
fetchExperimentalStructures,
|
|
163
|
+
getPdbStructureUrl,
|
|
164
|
+
pickAlphaFoldModel,
|
|
165
|
+
searchUniProtEntries,
|
|
166
|
+
} from 'p2s_mapper'
|
|
167
|
+
|
|
168
|
+
declare const translation: string
|
|
169
|
+
|
|
170
|
+
const { entries } = await searchUniProtEntries({
|
|
171
|
+
recognizedIds: ['GeneID:7157', 'ENST00000269305'],
|
|
172
|
+
geneName: 'TP53',
|
|
173
|
+
organismId: 9606,
|
|
174
|
+
})
|
|
175
|
+
const accession = entries[0]?.accession // 'P04637'
|
|
176
|
+
|
|
177
|
+
if (accession) {
|
|
178
|
+
// predicted: the model folded from this exact translation, else the canonical one
|
|
179
|
+
const models = await fetchAlphaFoldModels(accession)
|
|
180
|
+
const predicted = pickAlphaFoldModel(models, { tx1: { seq: translation } })
|
|
181
|
+
|
|
182
|
+
// experimental: PDB entries, best coverage first
|
|
183
|
+
const [best] = await fetchExperimentalStructures(accession)
|
|
184
|
+
const url = predicted?.url ?? (best && getPdbStructureUrl(best.pdbId))
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Every network function takes `{ fetch?, signal? }` last, defaulting to
|
|
189
|
+
`globalThis.fetch`, so a host can pass its own fetch and abort a stale request.
|
|
190
|
+
|
|
191
|
+
### Place UniProt annotations on a PDB entry
|
|
192
|
+
|
|
193
|
+
A PDB construct is usually a fragment, numbered differently from UniProt. The
|
|
194
|
+
entry's UniProt alignment, read from RCSB, says how the two line up.
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import {
|
|
198
|
+
chooseUniProtMappingForEntity,
|
|
199
|
+
fetchUniProtStructureMappings,
|
|
200
|
+
makeUniProtPositionMap,
|
|
201
|
+
} from 'p2s_mapper'
|
|
202
|
+
|
|
203
|
+
const mappings = await fetchUniProtStructureMappings('1tup')
|
|
204
|
+
const mapping = chooseUniProtMappingForEntity(mappings, {
|
|
205
|
+
entityId: '3',
|
|
206
|
+
chains: ['A', 'B', 'C'],
|
|
207
|
+
})
|
|
208
|
+
const toStructure = makeUniProtPositionMap(mapping?.segments ?? [])
|
|
209
|
+
toStructure(248) // 154: UniProt residue 248 is structure position 154
|
|
210
|
+
```
|
|
211
|
+
|
|
33
212
|
## How it fits together
|
|
34
213
|
|
|
35
214
|

|
|
36
215
|
|
|
37
216
|
## Docs
|
|
38
217
|
|
|
39
|
-
- [
|
|
40
|
-
|
|
41
|
-
- [pipeline.md](docs/pipeline.md) — the flow above, step by step, and why chain
|
|
218
|
+
- [api.md](docs/api.md): every export, with its signature, types and an example
|
|
219
|
+
- [pipeline.md](docs/pipeline.md): the flow above, step by step, and why chain
|
|
42
220
|
choice divides by the shorter sequence
|
|
43
|
-
- [coordinates.md](docs/coordinates.md)
|
|
221
|
+
- [coordinates.md](docs/coordinates.md): the four numberings of a residue and
|
|
44
222
|
the one route between each
|
|
45
|
-
- [
|
|
223
|
+
- [faq.md](docs/faq.md): can I trust the mapping? What the package checks, and
|
|
224
|
+
what it leaves to you
|
|
46
225
|
|
|
47
226
|
## Things to know first
|
|
48
227
|
|
|
49
|
-
- Every coordinate
|
|
50
|
-
|
|
228
|
+
- Every coordinate is **0-based** and branded by space, so the compiler rejects
|
|
229
|
+
mixing them. UniProt positions and author residue numbers are 1-based. See
|
|
230
|
+
[coordinates.md](docs/coordinates.md).
|
|
51
231
|
- A `PairwiseAlignment` has **row 0 = transcript, row 1 = structure**. Use the
|
|
52
232
|
accessors, not indexes.
|
|
53
|
-
-
|
|
54
|
-
`
|
|
233
|
+
- The best-matching chain always wins, even a poor match. Check it with
|
|
234
|
+
`isLowSimilarity` before trusting the mapping.
|
|
235
|
+
- Cross into Mol\* only through `Entity.seqIds`: `label_seq_id` is not always
|
|
236
|
+
position + 1.
|
|
55
237
|
|
|
56
238
|
## License
|
|
57
239
|
|
|
@@ -2,8 +2,12 @@ import type { FetchOptions } from './fetchUtils.ts';
|
|
|
2
2
|
export interface AlphaFoldModel {
|
|
3
3
|
/** UniProt accession, with an isoform suffix on an isoform model */
|
|
4
4
|
accession: string;
|
|
5
|
+
/** AlphaFold DB's id for the model, e.g. AF-P04637-F1 */
|
|
6
|
+
entity?: string;
|
|
5
7
|
url: string;
|
|
6
8
|
confidenceUrl?: string;
|
|
9
|
+
/** mean per-residue confidence (pLDDT), 0-100 */
|
|
10
|
+
meanPlddt?: number;
|
|
7
11
|
sequence: string;
|
|
8
12
|
}
|
|
9
13
|
export declare function parseAlphaFoldModels(json: unknown): AlphaFoldModel[];
|
package/dist/alphaFoldModels.js
CHANGED
|
@@ -16,8 +16,12 @@ function parseAlphaFoldModels(json) {
|
|
|
16
16
|
? [
|
|
17
17
|
{
|
|
18
18
|
accession: e.uniprotAccession,
|
|
19
|
+
entity: typeof e.modelEntityId === 'string' ? e.modelEntityId : undefined,
|
|
19
20
|
url: e.cifUrl,
|
|
20
21
|
confidenceUrl: typeof e.plddtDocUrl === 'string' ? e.plddtDocUrl : undefined,
|
|
22
|
+
meanPlddt: typeof e.globalMetricValue === 'number'
|
|
23
|
+
? e.globalMetricValue
|
|
24
|
+
: undefined,
|
|
21
25
|
sequence: e.sequence,
|
|
22
26
|
},
|
|
23
27
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alphaFoldModels.js","sourceRoot":"","sources":["../src/alphaFoldModels.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"alphaFoldModels.js","sourceRoot":"","sources":["../src/alphaFoldModels.ts"],"names":[],"mappings":";;AA8BA,oDAuBC;AAUD,oDAaC;AAUD,gDAgBC;AAtGD,mDAAqD;AAGrD,2DAAoD;AAuBpD,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAA;AACpD,CAAC;AAED,SAAgB,oBAAoB,CAAC,IAAa;IAChD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CACnD,iBAAiB,CAAC,CAAC,CAAC;QACpB,OAAO,CAAC,CAAC,gBAAgB,KAAK,QAAQ;QACtC,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ;QAC5B,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ;QAC5B,CAAC,CAAC;YACE;gBACE,SAAS,EAAE,CAAC,CAAC,gBAAgB;gBAC7B,MAAM,EACJ,OAAO,CAAC,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBACnE,GAAG,EAAE,CAAC,CAAC,MAAM;gBACb,aAAa,EACX,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;gBAC/D,SAAS,EACP,OAAO,CAAC,CAAC,iBAAiB,KAAK,QAAQ;oBACrC,CAAC,CAAC,CAAC,CAAC,iBAAiB;oBACrB,CAAC,CAAC,SAAS;gBACf,QAAQ,EAAE,CAAC,CAAC,QAAQ;aACrB;SACF;QACH,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CAAC;QACtD,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpD,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CACrE,CAAA;AACH,CAAC"}
|
package/dist/coordinates.d.ts
CHANGED
|
@@ -11,12 +11,15 @@ import type { PairwiseAlignment } from './mappings.ts';
|
|
|
11
11
|
* sequence; TranscriptPos the ungapped transcript sequence; AlignmentCol a
|
|
12
12
|
* column of the pairwise alignment (gaps included).
|
|
13
13
|
*/
|
|
14
|
-
type
|
|
15
|
-
readonly __brand:
|
|
14
|
+
export type StructurePos = number & {
|
|
15
|
+
readonly __brand: 'StructurePos';
|
|
16
|
+
};
|
|
17
|
+
export type TranscriptPos = number & {
|
|
18
|
+
readonly __brand: 'TranscriptPos';
|
|
19
|
+
};
|
|
20
|
+
export type AlignmentCol = number & {
|
|
21
|
+
readonly __brand: 'AlignmentCol';
|
|
16
22
|
};
|
|
17
|
-
export type StructurePos = Branded<'StructurePos'>;
|
|
18
|
-
export type TranscriptPos = Branded<'TranscriptPos'>;
|
|
19
|
-
export type AlignmentCol = Branded<'AlignmentCol'>;
|
|
20
23
|
export declare const structurePos: (n: number) => StructurePos;
|
|
21
24
|
export declare const transcriptPos: (n: number) => TranscriptPos;
|
|
22
25
|
export declare const alignmentCol: (n: number) => AlignmentCol;
|
|
@@ -63,4 +66,3 @@ export declare function transcriptRangeToStructureRange(mapper: CoordinateMapper
|
|
|
63
66
|
start: number;
|
|
64
67
|
end: number;
|
|
65
68
|
} | undefined;
|
|
66
|
-
export {};
|
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":";;;AA2DA,oDAiCC;AASD,0EAgBC;AArHD,+CAIsB;AACtB,iDAA0C;AAoBnC,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;AA2B5D;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,iBAAoC;IAEpC,MAAM,EACJ,mCAAmC,EACnC,mCAAmC,GACpC,GAAG,IAAA,4CAA8B,EAAC,iBAAiB,CAAC,CAAA;IACrD,MAAM,KAAK,GAAG,IAAA,6CAA+B,EAAC,iBAAiB,CAAC,CAAA;IAChE,MAAM,KAAK,GAAG,IAAA,8CAAgC,EAAC,iBAAiB,CAAC,CAAA;IACjE,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,KAAK,CAAC,CAAA;IAC9B,MAAM,KAAK,GAAG,IAAA,wBAAS,EAAC,KAAK,CAAC,CAAA;IAE9B,uEAAuE;IACvE,6EAA6E;IAC7E,sEAAsE;IACtE,OAAO;QACL,qBAAqB,EAAE,CAAC,CAAC,EAAE,CACzB,mCAAmC,CAAC,CAAC,CAA8B;QACrE,qBAAqB,EAAE,CAAC,CAAC,EAAE,CACzB,mCAAmC,CAAC,CAAC,CAA6B;QACpE,oBAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAA6B;QAC/D,oBAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAA6B;QAC/D,qBAA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ensembl' | 'refseq' | 'ccds' | 'hgnc';
|
|
1
|
+
export type DbType = 'ensembl' | 'refseq' | 'ccds' | 'hgnc' | 'geneid';
|
|
2
2
|
export declare function matchDbIdPattern(id: string): {
|
|
3
3
|
db: DbType;
|
|
4
4
|
pattern: RegExp;
|
|
@@ -13,4 +13,3 @@ export declare function getDbIdLabel(id: string): string;
|
|
|
13
13
|
* "xref:ensembl-ENST00000123". HGNC strips its redundant "HGNC:" prefix. */
|
|
14
14
|
export declare function buildUniProtXrefQuery(id: string): string | undefined;
|
|
15
15
|
export declare function stripTrailingVersion(s?: string): string | undefined;
|
|
16
|
-
export {};
|
package/dist/dbIds.js
CHANGED
|
@@ -18,6 +18,10 @@ const DB_ID_PATTERNS = [
|
|
|
18
18
|
{ db: 'refseq', pattern: /^[NXYA]P_\d+/i, label: 'RefSeq protein' },
|
|
19
19
|
{ db: 'ccds', pattern: /^CCDS\d+/i, label: 'CCDS' },
|
|
20
20
|
{ db: 'hgnc', pattern: /^HGNC:\d+/i, label: 'HGNC' },
|
|
21
|
+
// NCBI's GFFs carry `Dbxref=GeneID:7157`, and UniProt keeps the GeneID
|
|
22
|
+
// cross-reference for every organism NCBI annotates, where a symbol search
|
|
23
|
+
// needs a taxon and misses a TrEMBL-only gene.
|
|
24
|
+
{ db: 'geneid', pattern: /^GeneID:\d+$/i, label: 'NCBI Gene' },
|
|
21
25
|
];
|
|
22
26
|
function matchDbIdPattern(id) {
|
|
23
27
|
return DB_ID_PATTERNS.find(p => p.pattern.test(id));
|
|
@@ -37,7 +41,7 @@ function getDbIdLabel(id) {
|
|
|
37
41
|
function buildUniProtXrefQuery(id) {
|
|
38
42
|
const match = matchDbIdPattern(id);
|
|
39
43
|
return match
|
|
40
|
-
? `xref:${match.db}-${match.db === 'hgnc' ? id.replace(
|
|
44
|
+
? `xref:${match.db}-${match.db === 'hgnc' || match.db === 'geneid' ? id.replace(/^[^:]+:/, '') : id}`
|
|
41
45
|
: undefined;
|
|
42
46
|
}
|
|
43
47
|
function stripTrailingVersion(s) {
|
package/dist/dbIds.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dbIds.js","sourceRoot":"","sources":["../src/dbIds.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"dbIds.js","sourceRoot":"","sources":["../src/dbIds.ts"],"names":[],"mappings":";;AA0BA,4CAEC;AAGD,wDAEC;AAID,oCAGC;AAID,sDAKC;AAED,oDAEC;AA9CD,MAAM,cAAc,GAAqD;IACvE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,cAAc,EAAE;IACpE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,oBAAoB,EAAE;IAC1E,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;IACvE,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9D,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,cAAc,EAAE;IAC/D,4EAA4E;IAC5E,2EAA2E;IAC3E,qEAAqE;IACrE,4EAA4E;IAC5E,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE;IACnE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE;IACnD,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE;IACpD,uEAAuE;IACvE,2EAA2E;IAC3E,+CAA+C;IAC/C,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE;CAC/D,CAAA;AAED,SAAgB,gBAAgB,CAAC,EAAU;IACzC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;AACrD,CAAC;AAED,8DAA8D;AAC9D,SAAgB,sBAAsB,CAAC,EAAU;IAC/C,OAAO,gBAAgB,CAAC,EAAE,CAAC,KAAK,SAAS,CAAA;AAC3C,CAAC;AAED;8CAC8C;AAC9C,SAAgB,YAAY,CAAC,EAAU;IACrC,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAA;IAClC,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;AAC9C,CAAC;AAED;4EAC4E;AAC5E,SAAgB,qBAAqB,CAAC,EAAU;IAC9C,MAAM,KAAK,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAA;IAClC,OAAO,KAAK;QACV,CAAC,CAAC,QAAQ,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,KAAK,MAAM,IAAI,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE;QACrG,CAAC,CAAC,SAAS,CAAA;AACf,CAAC;AAED,SAAgB,oBAAoB,CAAC,CAAU;IAC7C,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AACpC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
interface ConfidenceModel {
|
|
1
|
+
export interface ConfidenceModel {
|
|
2
2
|
obj?: {
|
|
3
3
|
data: {
|
|
4
4
|
atomicConformation: {
|
|
@@ -46,4 +46,3 @@ export declare function extractPerResidueConfidence(model: ConfidenceModel): Ent
|
|
|
46
46
|
* indicate the track wouldn't be meaningful as confidence.
|
|
47
47
|
*/
|
|
48
48
|
export declare function looksLikePlddt(values: number[] | undefined): values is number[];
|
|
49
|
-
export {};
|
|
@@ -20,30 +20,30 @@
|
|
|
20
20
|
* So carry the real ids and convert through them.
|
|
21
21
|
*/
|
|
22
22
|
export interface Entity {
|
|
23
|
+
/** mmCIF entity id, molstar's own bookkeeping */
|
|
23
24
|
entityId: string;
|
|
25
|
+
/** one letter per residue, observed or not */
|
|
24
26
|
seq: string;
|
|
27
|
+
/** molstar `label_seq_id` per position of `seq` */
|
|
25
28
|
seqIds: number[];
|
|
26
|
-
/** author chain ids carrying this entity, e.g. ['A', 'B'] for a homodimer
|
|
27
|
-
* what a user recognises from the PDB entry page
|
|
28
|
-
* molstar's own bookkeeping */
|
|
29
|
+
/** author chain ids carrying this entity, e.g. ['A', 'B'] for a homodimer:
|
|
30
|
+
* what a user recognises from the PDB entry page */
|
|
29
31
|
chains: string[];
|
|
30
|
-
/** DNA, RNA or a hybrid, by molstar's entity subtype. Its
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
/** DNA, RNA or a hybrid, by molstar's entity subtype. Its letters spell
|
|
33
|
+
* amino acids too (A, C, G, T, U), so it is kept out of the alignment
|
|
34
|
+
* rather than left to score low. */
|
|
33
35
|
nucleicAcid?: boolean;
|
|
34
|
-
/** `auth_seq_id` per position: the
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* is addressed through `seqIds`. Absent when the model has no atomic
|
|
39
|
-
* hierarchy to read it from. See `residueNumber`. */
|
|
36
|
+
/** `auth_seq_id` per position: the depositors' numbering, which papers cite
|
|
37
|
+
* (1TUP's position 154 is R248) and Mol*'s hover shows. Display only;
|
|
38
|
+
* address Mol* through `seqIds`. Absent when the model has no atomic
|
|
39
|
+
* hierarchy. See `residueNumber`. */
|
|
40
40
|
authSeqIds?: number[];
|
|
41
41
|
}
|
|
42
|
-
interface Column<T> {
|
|
42
|
+
export interface Column<T> {
|
|
43
43
|
rowCount: number;
|
|
44
44
|
value(row: number): T;
|
|
45
45
|
}
|
|
46
|
-
interface StructureModel {
|
|
46
|
+
export interface StructureModel {
|
|
47
47
|
obj?: {
|
|
48
48
|
data: {
|
|
49
49
|
entities?: {
|
|
@@ -139,4 +139,3 @@ export declare function rangeToLabelSeqIds(entity: Entity | undefined, range: {
|
|
|
139
139
|
} | undefined): number[];
|
|
140
140
|
/** Reverse of `seqIds`: molstar's label_seq_id -> 0-based structure position. */
|
|
141
141
|
export declare function makeLabelSeqIdIndex(entity: Entity | undefined): Map<number, number>;
|
|
142
|
-
export {};
|
package/dist/fetchUtils.js
CHANGED
|
@@ -63,10 +63,28 @@ function networkError(url, cause) {
|
|
|
63
63
|
? new Error(`Could not reach ${hostOf(url)}. Check your network connection; the server may also be refusing cross-origin requests from this page.`, { cause })
|
|
64
64
|
: cause;
|
|
65
65
|
}
|
|
66
|
+
const USER_AGENT = 'p2s_mapper (+https://github.com/GMOD/p2s_mapper)';
|
|
67
|
+
/**
|
|
68
|
+
* AlphaFold's prediction API answers 403 to `node`, the user agent Node's fetch
|
|
69
|
+
* sends (measured 2026-10-11), so outside a browser every request names this
|
|
70
|
+
* package unless the caller named something else. A browser sends its own, and
|
|
71
|
+
* a script-set one would cost a CORS preflight on every call.
|
|
72
|
+
*/
|
|
73
|
+
function withUserAgent(init) {
|
|
74
|
+
if (typeof navigator !== 'undefined' &&
|
|
75
|
+
navigator.userAgent.startsWith('Mozilla')) {
|
|
76
|
+
return init;
|
|
77
|
+
}
|
|
78
|
+
const headers = new Headers(init.headers);
|
|
79
|
+
if (!headers.has('user-agent')) {
|
|
80
|
+
headers.set('user-agent', USER_AGENT);
|
|
81
|
+
}
|
|
82
|
+
return { ...init, headers };
|
|
83
|
+
}
|
|
66
84
|
async function rawfetch(url, args) {
|
|
67
85
|
const { fetch: f = globalThis.fetch, ...init } = args ?? {};
|
|
68
86
|
try {
|
|
69
|
-
return await f(url, init);
|
|
87
|
+
return await f(url, withUserAgent(init));
|
|
70
88
|
}
|
|
71
89
|
catch (e) {
|
|
72
90
|
throw networkError(url, e);
|
package/dist/fetchUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchUtils.js","sourceRoot":"","sources":["../src/fetchUtils.ts"],"names":[],"mappings":";;;AAiCA,kDAEC;AAOD,8BAOC;AAQD,oCAOC;
|
|
1
|
+
{"version":3,"file":"fetchUtils.js","sourceRoot":"","sources":["../src/fetchUtils.ts"],"names":[],"mappings":";;;AAiCA,kDAEC;AAOD,8BAOC;AAQD,oCAOC;AAmCD,4BAOC;AAED,0BAQC;AAED,8BAQC;AAQD,gCAIC;AAED,0BAgBC;AA5JD,SAAS,MAAM,CAAC,GAAW;IACzB,IAAI,CAAC;QACH,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAA;IACZ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,GAAG,CAAA;AAEtB,SAAS,SAAS,CAAC,IAAY;IAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IACjD,OAAO,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAA;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAa,SAAU,SAAQ,KAAK;IACzB,MAAM,CAAQ;IAEvB,YAAY,OAAe,EAAE,MAAc;QACzC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,WAAW,CAAA;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CACF;AARD,8BAQC;AAED;;UAEU;AACV,SAAgB,mBAAmB,CA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K,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAA;AACpD,CAAC;AAED,SAAgB,OAAO,CAAC,IAAY,EAAE,MAAoB;IACxD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YACpC,MAAM,EAAE,gBAAgB,CACtB,OAAO,EACP,GAAG,EAAE;gBACH,YAAY,CAAC,EAAE,CAAC,CAAA;gBAChB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;YAC5B,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,10 +11,8 @@ export * from './extractStructureSequences.ts';
|
|
|
11
11
|
export * from './extractPerResidueConfidence.ts';
|
|
12
12
|
export * from './isoformRanking.ts';
|
|
13
13
|
export * from './pdbUniProtMapping.ts';
|
|
14
|
-
export * from './
|
|
14
|
+
export * from './pdbEntry.ts';
|
|
15
15
|
export * from './alphaFoldModels.ts';
|
|
16
|
-
export * from './pdbeBestStructures.ts';
|
|
17
|
-
export * from './pdbeEntryMolecules.ts';
|
|
18
16
|
export * from './structureSources.ts';
|
|
19
17
|
export * from './uniProtSearch.ts';
|
|
20
18
|
export * from './dbIds.ts';
|
package/dist/index.js
CHANGED
|
@@ -29,13 +29,11 @@ __exportStar(require("./chooseMappedEntity.js"), exports);
|
|
|
29
29
|
__exportStar(require("./extractStructureSequences.js"), exports);
|
|
30
30
|
__exportStar(require("./extractPerResidueConfidence.js"), exports);
|
|
31
31
|
__exportStar(require("./isoformRanking.js"), exports);
|
|
32
|
-
//
|
|
32
|
+
// UniProt mapping
|
|
33
33
|
__exportStar(require("./pdbUniProtMapping.js"), exports);
|
|
34
|
-
__exportStar(require("./
|
|
34
|
+
__exportStar(require("./pdbEntry.js"), exports);
|
|
35
35
|
// Structure sources
|
|
36
36
|
__exportStar(require("./alphaFoldModels.js"), exports);
|
|
37
|
-
__exportStar(require("./pdbeBestStructures.js"), exports);
|
|
38
|
-
__exportStar(require("./pdbeEntryMolecules.js"), exports);
|
|
39
37
|
__exportStar(require("./structureSources.js"), exports);
|
|
40
38
|
__exportStar(require("./uniProtSearch.js"), exports);
|
|
41
39
|
__exportStar(require("./dbIds.js"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,6CAA0B;AAC1B,gDAA6B;AAC7B,yDAAsC;AACtC,wDAAqC;AACrC,uDAAoC;AAEpC,cAAc;AACd,mDAAgC;AAChC,iDAA8B;AAC9B,sDAAmC;AAEnC,eAAe;AACf,0DAAuC;AACvC,iEAA8C;AAC9C,mEAAgD;AAChD,sDAAmC;AAEnC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,YAAY;AACZ,6CAA0B;AAC1B,gDAA6B;AAC7B,yDAAsC;AACtC,wDAAqC;AACrC,uDAAoC;AAEpC,cAAc;AACd,mDAAgC;AAChC,iDAA8B;AAC9B,sDAAmC;AAEnC,eAAe;AACf,0DAAuC;AACvC,iEAA8C;AAC9C,mEAAgD;AAChD,sDAAmC;AAEnC,kBAAkB;AAClB,yDAAsC;AACtC,gDAA6B;AAE7B,oBAAoB;AACpB,uDAAoC;AACpC,wDAAqC;AACrC,qDAAkC;AAClC,6CAA0B;AAE1B,mBAAmB;AACnB,qDAAkC;AAClC,uDAAoC;AACpC,qDAAkC;AAClC,kDAA+B"}
|
package/dist/isoformRanking.d.ts
CHANGED
|
@@ -14,8 +14,11 @@ export interface RankedIsoform {
|
|
|
14
14
|
score?: number;
|
|
15
15
|
}
|
|
16
16
|
export interface ClassifiedIsoforms {
|
|
17
|
+
/** translates to exactly the structure's sequence, longest first */
|
|
17
18
|
matches: RankedIsoform[];
|
|
19
|
+
/** translates to something else, best-aligning first */
|
|
18
20
|
nonMatches: RankedIsoform[];
|
|
21
|
+
/** ids of the isoforms with no translation */
|
|
19
22
|
noData: string[];
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PairwiseAlignment } from './mappings.ts';
|
|
2
2
|
import type { AlignmentAlgorithm } from './types.ts';
|
|
3
|
-
interface AlignmentResult {
|
|
3
|
+
export interface AlignmentResult {
|
|
4
4
|
alignedSeq1: string;
|
|
5
5
|
alignedSeq2: string;
|
|
6
6
|
score: number;
|
|
@@ -32,4 +32,3 @@ export declare function scoredAlignment(seq1: string, seq2: string, algorithm: A
|
|
|
32
32
|
score: number;
|
|
33
33
|
};
|
|
34
34
|
export declare function runLocalAlignment(seq1: string, seq2: string, algorithm: AlignmentAlgorithm): PairwiseAlignment;
|
|
35
|
-
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { FetchOptions } from './fetchUtils.ts';
|
|
2
|
+
import type { UniProtStructureMapping } from './pdbUniProtMapping.ts';
|
|
3
|
+
export declare const RCSB_DATA_GRAPHQL_URL = "https://data.rcsb.org/graphql";
|
|
4
|
+
export interface PdbEntry {
|
|
5
|
+
/** every UniProt accession the entry's entities align to */
|
|
6
|
+
mappings: UniProtStructureMapping[];
|
|
7
|
+
/** one sequence per protein entity, in entity order; nucleic acids left
|
|
8
|
+
* out, since A, C, G, T and U are amino-acid letters too */
|
|
9
|
+
proteinSequences: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function pdbEntryQuery(pdbId: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* A GraphQL request. The server answers 200 whatever happened, so a failure
|
|
14
|
+
* is read from the body's `errors`, and counts as a 400: the server
|
|
15
|
+
* understood the query and declined it, so asking again gets the same answer.
|
|
16
|
+
*/
|
|
17
|
+
export declare function graphqlFetch(url: string, query: string, variables: Record<string, unknown> | undefined, opts?: FetchOptions): Promise<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* The entry, retried twice: one failed request would otherwise leave a fusion
|
|
20
|
+
* construct mapped onto its partner for the whole session. An id RCSB has no
|
|
21
|
+
* entry for is a 404, which is not retried, since that answer cannot change.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fetchPdbEntry(pdbId: string, opts?: FetchOptions): Promise<PdbEntry>;
|
|
24
|
+
/** The entry's UniProt alignment alone. */
|
|
25
|
+
export declare function fetchUniProtStructureMappings(pdbId: string, opts?: FetchOptions): Promise<UniProtStructureMapping[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Parses the `data` of `pdbEntryQuery`. Undefined when RCSB has no such
|
|
28
|
+
* entry; an entry nothing aligns to UniProt (DNA alone, say) parses to no
|
|
29
|
+
* mappings. An unparseable alignment is skipped rather than failing the
|
|
30
|
+
* entry, so a chimera with one malformed region still maps its other chains.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parsePdbEntry(data: unknown): PdbEntry | undefined;
|