p2s_mapper 1.2.0 → 1.2.1
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 +24 -25
- package/dist/uniProtSearch.d.ts +4 -1
- package/dist/uniProtSearch.js +14 -3
- package/dist/uniProtSearch.js.map +1 -1
- package/esm/uniProtSearch.d.ts +4 -1
- package/esm/uniProtSearch.js +14 -3
- package/esm/uniProtSearch.js.map +1 -1
- package/package.json +1 -1
- package/src/uniProtSearch.ts +23 -3
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@ PDBe and UniProt lookups that find a structure to map in the first place.
|
|
|
7
7
|
|
|
8
8
|
Extracted from
|
|
9
9
|
[jbrowse-plugin-protein3d](https://github.com/GMOD/jbrowse-plugin-protein3d),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
where we made the measurements behind the scoring rules. The package has no
|
|
11
|
+
React, no JBrowse and no Mol\* dependency: a loaded Mol\* model reaches it
|
|
12
|
+
through narrow structural interfaces, and `g2p_mapper` is the only runtime
|
|
13
13
|
dependency.
|
|
14
14
|
|
|
15
15
|
## Install
|
|
@@ -20,23 +20,22 @@ npm install p2s_mapper
|
|
|
20
20
|
|
|
21
21
|
## Coordinate conventions
|
|
22
22
|
|
|
23
|
-
One residue has up to four numbers, and mixing them
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
any offset.
|
|
23
|
+
One residue has up to four numbers, and mixing them causes the off-by-one bugs
|
|
24
|
+
this package's types prevent. **Every stored or computed coordinate is a 0-based
|
|
25
|
+
position**: an index into the ungapped structure sequence or the ungapped
|
|
26
|
+
transcript sequence, the one numbering that is dense and zero-based whatever the
|
|
27
|
+
file. `coordinates.ts` brands the three internal spaces — structure position,
|
|
28
|
+
transcript position, alignment column — so the compiler rejects mixing them. Two
|
|
29
|
+
conversions leave that space, and each has exactly one correct route. **Mol\* is
|
|
30
|
+
addressed by `label_seq_id`**, which is `position + 1` only for a file carrying
|
|
31
|
+
`entity_poly_seq` or SEQRES; a SEQRES-less PDB numbers its observed residues by
|
|
32
|
+
author numbering and leaves holes at unobserved loops, so `Entity.seqIds`
|
|
33
|
+
carries the real ids and every crossing goes through `toLabelSeqIds`,
|
|
34
|
+
`rangeToLabelSeqIds` or `makeLabelSeqIdIndex`. **The user sees `auth_seq_id`**,
|
|
35
|
+
the depositors' numbering that papers and UniProt cite (1TUP position 154
|
|
36
|
+
reads 248) and that Mol\*'s own hover shows; `Entity.authSeqIds` carries it, and
|
|
37
|
+
it is display-only. UniProt positions are 1-based, and `pdbUniProtMapping`
|
|
38
|
+
converts them with SIFTS rather than assuming any offset.
|
|
40
39
|
|
|
41
40
|
## Exports
|
|
42
41
|
|
|
@@ -55,8 +54,8 @@ accessors, not by index.
|
|
|
55
54
|
|
|
56
55
|
`alignmentQuality`, `isLowSimilarity`, `describeAlignmentQuality`,
|
|
57
56
|
`describeTranscriptCoverage`, `describeCoveredRange` — identity over the shorter
|
|
58
|
-
sequence
|
|
59
|
-
|
|
57
|
+
sequence separates a real match from a chance local alignment; local identity
|
|
58
|
+
alone does not.
|
|
60
59
|
|
|
61
60
|
`AlignmentAlgorithm`, `coerceAlignmentAlgorithm`, `ALIGNMENT_ALGORITHM_LABELS`.
|
|
62
61
|
|
|
@@ -134,9 +133,9 @@ host can hand in an instrumented one and a test can hand in a double.
|
|
|
134
133
|
|
|
135
134
|
`structureFormatFromContent`, `structureFormatFromName`,
|
|
136
135
|
`structureFileExtension`, `isBinaryStructureUrl` — which parser a structure
|
|
137
|
-
needs, sniffed from **content** rather than a filename.
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
needs, sniffed from **content** rather than a filename. PDB read as mmCIF
|
|
137
|
+
throws, while mmCIF read as PDB succeeds and yields a model with thousands of
|
|
138
|
+
misread atoms and zero polymer entities.
|
|
140
139
|
|
|
141
140
|
`caCoordsToPdb`, `hasValidCaCoords` — a PDB file from Foldseek Cα coordinates.
|
|
142
141
|
|
package/dist/uniProtSearch.d.ts
CHANGED
|
@@ -16,8 +16,11 @@ export interface UniProtEntry {
|
|
|
16
16
|
* The symbol is quoted because a bare one containing `:` — an HLA allele, a
|
|
17
17
|
* name straight out of an annotation file — reads as another field to
|
|
18
18
|
* UniProt's parser, which answers 400.
|
|
19
|
+
*
|
|
20
|
+
* `organism_id` matches that taxon alone and `taxonomy_id` its descendants
|
|
21
|
+
* too. See searchByGeneName for when each is asked.
|
|
19
22
|
*/
|
|
20
|
-
export declare function buildGeneNameQuery(geneName: string, organismId?: number): string;
|
|
23
|
+
export declare function buildGeneNameQuery(geneName: string, organismId?: number, scope?: 'organism_id' | 'taxonomy_id'): string;
|
|
21
24
|
export interface UniProtSearchResult {
|
|
22
25
|
entries: UniProtEntry[];
|
|
23
26
|
attemptedCount: number;
|
package/dist/uniProtSearch.js
CHANGED
|
@@ -29,11 +29,14 @@ async function searchUniProt(query, size, opts) {
|
|
|
29
29
|
* The symbol is quoted because a bare one containing `:` — an HLA allele, a
|
|
30
30
|
* name straight out of an annotation file — reads as another field to
|
|
31
31
|
* UniProt's parser, which answers 400.
|
|
32
|
+
*
|
|
33
|
+
* `organism_id` matches that taxon alone and `taxonomy_id` its descendants
|
|
34
|
+
* too. See searchByGeneName for when each is asked.
|
|
32
35
|
*/
|
|
33
|
-
function buildGeneNameQuery(geneName, organismId) {
|
|
36
|
+
function buildGeneNameQuery(geneName, organismId, scope = 'organism_id') {
|
|
34
37
|
return [
|
|
35
38
|
`gene_exact:"${geneName.replaceAll('"', '\\"')}"`,
|
|
36
|
-
organismId ?
|
|
39
|
+
organismId ? `${scope}:${organismId}` : undefined,
|
|
37
40
|
'reviewed:true',
|
|
38
41
|
]
|
|
39
42
|
.filter(s => s !== undefined)
|
|
@@ -54,7 +57,15 @@ async function searchByXref(id, opts) {
|
|
|
54
57
|
}
|
|
55
58
|
async function searchByGeneName(geneName, organismId, opts) {
|
|
56
59
|
try {
|
|
57
|
-
const
|
|
60
|
+
const exact = await searchUniProt(buildGeneNameQuery(geneName, organismId), organismId ? 5 : 10, opts);
|
|
61
|
+
// Swiss-Prot files a microbe's entries under its reference strain, and an
|
|
62
|
+
// assembly often names the species: fission yeast is 4896 and its entries
|
|
63
|
+
// are 284812. The descendants are asked only on a miss, because for a
|
|
64
|
+
// species with reviewed subspecies entries (human and Neanderthal) they
|
|
65
|
+
// turn one answer into two.
|
|
66
|
+
const entries = exact.length === 0 && organismId
|
|
67
|
+
? await searchUniProt(buildGeneNameQuery(geneName, organismId, 'taxonomy_id'), 5, opts)
|
|
68
|
+
: exact;
|
|
58
69
|
return { entries, error: undefined };
|
|
59
70
|
}
|
|
60
71
|
catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniProtSearch.js","sourceRoot":"","sources":["../src/uniProtSearch.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"uniProtSearch.js","sourceRoot":"","sources":["../src/uniProtSearch.ts"],"names":[],"mappings":";;AAmFA,gDAYC;AAwED,oDAgEC;AAvOD,mDAA2C;AAC3C,yCAImB;AAsCnB,MAAM,cAAc,GAClB,6DAA6D,CAAA;AAE/D,SAAS,mBAAmB,CAC1B,MAAsC;IAEtC,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,gBAAgB;QAClC,EAAE,EAAE,MAAM,CAAC,WAAW;QACtB,QAAQ,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK;QAC5C,YAAY,EACV,MAAM,CAAC,QAAQ,EAAE,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,cAAc;QAChE,WAAW,EAAE,MAAM,CAAC,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK;QACxE,UAA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AAC,SAAS,CAAA;IACzE,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,GAAG,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAA;IAC5E,CAAC;IAED,MAAM,cAAc,GAAG,WAAW,CAAC,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACvE,MAAM,WAAW,GACf,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,MAAM;QACrD,CAAC,mBAAmB,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEpD,4EAA4E;IAC5E,6EAA6E;IAC7E,IACE,OAAO,CAAC,MAAM,KAAK,CAAC;QACpB,cAAc,GAAG,CAAC;QAClB,cAAc,KAAK,WAAW,EAC9B,CAAC;QACD,MAAM,CACJ,mBAAmB,EAAE,KAAK;YAC1B,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE,KAAK,CACpD,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,QAAQ,CACvB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CACtD;QACD,cAAc;QACd,WAAW;KACZ,CAAA;AACH,CAAC"}
|
package/esm/uniProtSearch.d.ts
CHANGED
|
@@ -16,8 +16,11 @@ export interface UniProtEntry {
|
|
|
16
16
|
* The symbol is quoted because a bare one containing `:` — an HLA allele, a
|
|
17
17
|
* name straight out of an annotation file — reads as another field to
|
|
18
18
|
* UniProt's parser, which answers 400.
|
|
19
|
+
*
|
|
20
|
+
* `organism_id` matches that taxon alone and `taxonomy_id` its descendants
|
|
21
|
+
* too. See searchByGeneName for when each is asked.
|
|
19
22
|
*/
|
|
20
|
-
export declare function buildGeneNameQuery(geneName: string, organismId?: number): string;
|
|
23
|
+
export declare function buildGeneNameQuery(geneName: string, organismId?: number, scope?: 'organism_id' | 'taxonomy_id'): string;
|
|
21
24
|
export interface UniProtSearchResult {
|
|
22
25
|
entries: UniProtEntry[];
|
|
23
26
|
attemptedCount: number;
|
package/esm/uniProtSearch.js
CHANGED
|
@@ -25,11 +25,14 @@ async function searchUniProt(query, size, opts) {
|
|
|
25
25
|
* The symbol is quoted because a bare one containing `:` — an HLA allele, a
|
|
26
26
|
* name straight out of an annotation file — reads as another field to
|
|
27
27
|
* UniProt's parser, which answers 400.
|
|
28
|
+
*
|
|
29
|
+
* `organism_id` matches that taxon alone and `taxonomy_id` its descendants
|
|
30
|
+
* too. See searchByGeneName for when each is asked.
|
|
28
31
|
*/
|
|
29
|
-
export function buildGeneNameQuery(geneName, organismId) {
|
|
32
|
+
export function buildGeneNameQuery(geneName, organismId, scope = 'organism_id') {
|
|
30
33
|
return [
|
|
31
34
|
`gene_exact:"${geneName.replaceAll('"', '\\"')}"`,
|
|
32
|
-
organismId ?
|
|
35
|
+
organismId ? `${scope}:${organismId}` : undefined,
|
|
33
36
|
'reviewed:true',
|
|
34
37
|
]
|
|
35
38
|
.filter(s => s !== undefined)
|
|
@@ -50,7 +53,15 @@ async function searchByXref(id, opts) {
|
|
|
50
53
|
}
|
|
51
54
|
async function searchByGeneName(geneName, organismId, opts) {
|
|
52
55
|
try {
|
|
53
|
-
const
|
|
56
|
+
const exact = await searchUniProt(buildGeneNameQuery(geneName, organismId), organismId ? 5 : 10, opts);
|
|
57
|
+
// Swiss-Prot files a microbe's entries under its reference strain, and an
|
|
58
|
+
// assembly often names the species: fission yeast is 4896 and its entries
|
|
59
|
+
// are 284812. The descendants are asked only on a miss, because for a
|
|
60
|
+
// species with reviewed subspecies entries (human and Neanderthal) they
|
|
61
|
+
// turn one answer into two.
|
|
62
|
+
const entries = exact.length === 0 && organismId
|
|
63
|
+
? await searchUniProt(buildGeneNameQuery(geneName, organismId, 'taxonomy_id'), 5, opts)
|
|
64
|
+
: exact;
|
|
54
65
|
return { entries, error: undefined };
|
|
55
66
|
}
|
|
56
67
|
catch (e) {
|
package/esm/uniProtSearch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniProtSearch.js","sourceRoot":"","sources":["../src/uniProtSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAsCnB,MAAM,cAAc,GAClB,6DAA6D,CAAA;AAE/D,SAAS,mBAAmB,CAC1B,MAAsC;IAEtC,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,gBAAgB;QAClC,EAAE,EAAE,MAAM,CAAC,WAAW;QACtB,QAAQ,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK;QAC5C,YAAY,EACV,MAAM,CAAC,QAAQ,EAAE,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,cAAc;QAChE,WAAW,EAAE,MAAM,CAAC,kBAAkB,EAAE,eAAe,EAAE,QAAQ,EAAE,KAAK;QACxE,UAAU,EAAE,MAAM,CAAC,SAAS,KAAK,iCAAiC;KACnE,CAAA;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAC1B,KAAa,EACb,IAAY,EACZ,IAAmB;IAEnB,MAAM,GAAG,GAAG,mDAAmD,kBAAkB,CAAC,KAAK,CAAC,WAAW,cAAc,SAAS,IAAI,EAAE,CAAA;IAChI,MAAM,IAAI,GAAG,MAAM,SAAS,CAAmB,GAAG,EAAE,IAAI,CAAC,CAAA;IACzD,OAAO,IAAI,CAAC,OAAO,CA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,OAAO,CAAC,MAAM,KAAK,CAAC;QACpB,cAAc,GAAG,CAAC;QAClB,cAAc,KAAK,WAAW,EAC9B,CAAC;QACD,MAAM,CACJ,mBAAmB,EAAE,KAAK;YAC1B,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE,KAAK,CACpD,CAAA;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,QAAQ,CACvB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CACtD;QACD,cAAc;QACd,WAAW;KACZ,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "p2s_mapper",
|
|
3
3
|
"description": "Map a transcript's translation onto a protein structure: alignment, coordinates, chain choice, SIFTS, and the AlphaFold and PDBe lookups that find the structure",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"packageManager": "pnpm@11.15.1",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
package/src/uniProtSearch.ts
CHANGED
|
@@ -77,11 +77,18 @@ async function searchUniProt(
|
|
|
77
77
|
* The symbol is quoted because a bare one containing `:` — an HLA allele, a
|
|
78
78
|
* name straight out of an annotation file — reads as another field to
|
|
79
79
|
* UniProt's parser, which answers 400.
|
|
80
|
+
*
|
|
81
|
+
* `organism_id` matches that taxon alone and `taxonomy_id` its descendants
|
|
82
|
+
* too. See searchByGeneName for when each is asked.
|
|
80
83
|
*/
|
|
81
|
-
export function buildGeneNameQuery(
|
|
84
|
+
export function buildGeneNameQuery(
|
|
85
|
+
geneName: string,
|
|
86
|
+
organismId?: number,
|
|
87
|
+
scope: 'organism_id' | 'taxonomy_id' = 'organism_id',
|
|
88
|
+
) {
|
|
82
89
|
return [
|
|
83
90
|
`gene_exact:"${geneName.replaceAll('"', '\\"')}"`,
|
|
84
|
-
organismId ?
|
|
91
|
+
organismId ? `${scope}:${organismId}` : undefined,
|
|
85
92
|
'reviewed:true',
|
|
86
93
|
]
|
|
87
94
|
.filter(s => s !== undefined)
|
|
@@ -115,11 +122,24 @@ async function searchByGeneName(
|
|
|
115
122
|
opts?: FetchOptions,
|
|
116
123
|
): Promise<SearchAttempt> {
|
|
117
124
|
try {
|
|
118
|
-
const
|
|
125
|
+
const exact = await searchUniProt(
|
|
119
126
|
buildGeneNameQuery(geneName, organismId),
|
|
120
127
|
organismId ? 5 : 10,
|
|
121
128
|
opts,
|
|
122
129
|
)
|
|
130
|
+
// Swiss-Prot files a microbe's entries under its reference strain, and an
|
|
131
|
+
// assembly often names the species: fission yeast is 4896 and its entries
|
|
132
|
+
// are 284812. The descendants are asked only on a miss, because for a
|
|
133
|
+
// species with reviewed subspecies entries (human and Neanderthal) they
|
|
134
|
+
// turn one answer into two.
|
|
135
|
+
const entries =
|
|
136
|
+
exact.length === 0 && organismId
|
|
137
|
+
? await searchUniProt(
|
|
138
|
+
buildGeneNameQuery(geneName, organismId, 'taxonomy_id'),
|
|
139
|
+
5,
|
|
140
|
+
opts,
|
|
141
|
+
)
|
|
142
|
+
: exact
|
|
123
143
|
return { entries, error: undefined }
|
|
124
144
|
} catch (e) {
|
|
125
145
|
console.error(`gene name search failed for ${geneName}:`, e)
|