jbrowse-plugin-protein3d 1.6.1 → 1.8.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/dist/LaunchProteinView/components/HelpDialog.js +1 -1
- package/dist/LaunchProteinView/components/PdbResultsTable.js +5 -5
- package/dist/LaunchProteinView/components/PdbSearch.js +15 -14
- package/dist/LaunchProteinView/components/clinVarTrack.js +70 -0
- package/dist/LaunchProteinView/components/clinVarTrackSource.js +55 -0
- package/dist/LaunchProteinView/components/launchProteinAnnotationView.js +26 -9
- package/dist/LaunchProteinView/components/proteinTrackSetup.js +5 -18
- package/dist/LaunchProteinView/hooks/useExperimentalStructures.js +9 -0
- package/dist/LaunchProteinView/hooks/usePdbEntry.js +10 -0
- package/dist/LaunchProteinView/utils/launchViewUtils.js +2 -0
- package/dist/LaunchProteinViewExtensionPoint/annotationView.js +2 -0
- package/dist/ProteinView/clinVar.js +101 -32
- package/dist/ProteinView/clinVarSource.js +23 -14
- package/dist/chunks/AddStructureDialog-Z5HMGUWS.js +2 -0
- package/dist/chunks/{AddStructureDialog-7J7OAA2W.js.map → AddStructureDialog-Z5HMGUWS.js.map} +1 -1
- package/dist/chunks/HelpDialog-IRAXBGZB.js +2 -0
- package/dist/chunks/{HelpDialog-LLS4EV2C.js.map → HelpDialog-IRAXBGZB.js.map} +2 -2
- package/dist/chunks/{ManualAlignmentDialog-2YBIV6OX.js → ManualAlignmentDialog-BTL4LYX2.js} +2 -2
- package/dist/chunks/{ProteinView-O45XQFFJ.js → ProteinView-YFTN6FW3.js} +2 -2
- package/dist/chunks/{ProteinView-O45XQFFJ.js.map → ProteinView-YFTN6FW3.js.map} +2 -2
- package/dist/chunks/{chunk-2CJBOB5B.js → chunk-7Q7UK2ZL.js} +2 -2
- package/dist/chunks/{chunk-2CJBOB5B.js.map → chunk-7Q7UK2ZL.js.map} +1 -1
- package/dist/chunks/{chunk-DNMMML7Y.js → chunk-C2KRWQQY.js} +2 -2
- package/dist/chunks/{chunk-DNMMML7Y.js.map → chunk-C2KRWQQY.js.map} +1 -1
- package/dist/chunks/chunk-EXD7S43Q.js +16 -0
- package/dist/chunks/chunk-EXD7S43Q.js.map +7 -0
- package/dist/chunks/{chunk-I6EQVYV2.js → chunk-QPR5H2OZ.js} +1 -1
- package/dist/chunks/{chunk-I6EQVYV2.js.map → chunk-QPR5H2OZ.js.map} +1 -1
- package/dist/chunks/chunk-R46YRV6D.js +2 -0
- package/dist/chunks/chunk-R46YRV6D.js.map +7 -0
- package/dist/chunks/chunk-RIAQ5NV7.js +2 -0
- package/dist/chunks/chunk-RIAQ5NV7.js.map +7 -0
- package/dist/chunks/{chunk-X5RLRQSB.js → chunk-SIZG3XB4.js} +1 -1
- package/dist/chunks/{chunk-X5RLRQSB.js.map → chunk-SIZG3XB4.js.map} +1 -1
- package/dist/chunks/{chunk-SQLUPFUS.js → chunk-SPXMXPSC.js} +1 -1
- package/dist/chunks/chunk-SPXMXPSC.js.map +7 -0
- package/dist/chunks/chunk-UXGREKQA.js +2 -0
- package/dist/chunks/chunk-UXGREKQA.js.map +7 -0
- package/dist/chunks/clinVarSource-LCO5EZ6C.js +2 -0
- package/dist/chunks/clinVarSource-LCO5EZ6C.js.map +7 -0
- package/dist/chunks/{molstarExports-M6FNLMIU.js → molstarExports-PLBMBP6Q.js} +3 -3
- package/dist/index.js +0 -2
- package/dist/jbrowse-plugin-protein3d.esm.js +26 -7
- package/dist/jbrowse-plugin-protein3d.esm.js.map +4 -4
- package/dist/version.js +1 -1
- package/package.json +7 -7
- package/src/LaunchProteinView/components/HelpDialog.tsx +1 -1
- package/src/LaunchProteinView/components/PdbResultsTable.tsx +6 -6
- package/src/LaunchProteinView/components/PdbSearch.tsx +18 -17
- package/src/LaunchProteinView/components/clinVarTrack.test.ts +126 -0
- package/src/LaunchProteinView/components/clinVarTrack.ts +113 -0
- package/src/LaunchProteinView/components/clinVarTrackSource.ts +81 -0
- package/src/LaunchProteinView/components/launchProteinAnnotationView.test.ts +78 -4
- package/src/LaunchProteinView/components/launchProteinAnnotationView.ts +37 -8
- package/src/LaunchProteinView/components/proteinTrackSetup.test.ts +2 -16
- package/src/LaunchProteinView/components/proteinTrackSetup.ts +5 -22
- package/src/LaunchProteinView/hooks/useExperimentalStructures.ts +17 -0
- package/src/LaunchProteinView/hooks/usePdbEntry.ts +16 -0
- package/src/LaunchProteinView/utils/launchViewUtils.ts +3 -0
- package/src/LaunchProteinViewExtensionPoint/annotationView.ts +3 -0
- package/src/ProteinView/clinVar.ts +145 -34
- package/src/ProteinView/clinVarMissense.test.ts +131 -0
- package/src/ProteinView/clinVarSource.ts +41 -24
- package/src/ProteinView/structureModel.test.ts +31 -16
- package/src/ProteinView/structureVariantEffects.test.ts +2 -2
- package/src/index.ts +0 -2
- package/src/version.ts +1 -1
- package/dist/LaunchProteinView/hooks/usePdbBestStructures.js +0 -19
- package/dist/LaunchProteinView/hooks/usePdbEntryMolecules.js +0 -7
- package/dist/UniProtVariationAdapter/UniProtVariationAdapter.js +0 -32
- package/dist/UniProtVariationAdapter/configSchema.js +0 -19
- package/dist/UniProtVariationAdapter/index.js +0 -10
- package/dist/chunks/AddStructureDialog-7J7OAA2W.js +0 -2
- package/dist/chunks/HelpDialog-LLS4EV2C.js +0 -2
- package/dist/chunks/UniProtVariationAdapter-2GQU7BV6.js +0 -2
- package/dist/chunks/UniProtVariationAdapter-2GQU7BV6.js.map +0 -7
- package/dist/chunks/chunk-2U2S5MMZ.js +0 -2
- package/dist/chunks/chunk-2U2S5MMZ.js.map +0 -7
- package/dist/chunks/chunk-7FQYLMEH.js +0 -16
- package/dist/chunks/chunk-7FQYLMEH.js.map +0 -7
- package/dist/chunks/chunk-SQLUPFUS.js.map +0 -7
- package/dist/chunks/chunk-Y4B2HQAN.js +0 -2
- package/dist/chunks/chunk-Y4B2HQAN.js.map +0 -7
- package/dist/chunks/clinVarSource-SXH525M3.js +0 -2
- package/dist/chunks/clinVarSource-SXH525M3.js.map +0 -7
- package/src/LaunchProteinView/hooks/usePdbBestStructures.ts +0 -33
- package/src/LaunchProteinView/hooks/usePdbEntryMolecules.ts +0 -17
- package/src/UniProtVariationAdapter/UniProtVariationAdapter.ts +0 -65
- package/src/UniProtVariationAdapter/configSchema.ts +0 -27
- package/src/UniProtVariationAdapter/index.ts +0 -18
- package/src/UniProtVariationAdapter/parseUniProtVariants.test.ts +0 -40
- /package/dist/chunks/{ManualAlignmentDialog-2YBIV6OX.js.map → ManualAlignmentDialog-BTL4LYX2.js.map} +0 -0
- /package/dist/chunks/{molstarExports-M6FNLMIU.js.map → molstarExports-PLBMBP6Q.js.map} +0 -0
|
@@ -14,7 +14,7 @@ export default function HelpDialog({ handleClose, }) {
|
|
|
14
14
|
" resolves the feature to a UniProt accession \u2014 from its own identifiers, or one you type \u2014 and opens AlphaFold's predicted model for it."),
|
|
15
15
|
React.createElement("li", null,
|
|
16
16
|
React.createElement("b", null, "PDB search"),
|
|
17
|
-
" lists the experimental structures
|
|
17
|
+
" lists the experimental structures RCSB aligns to that accession, ranked on coverage and resolution. A crystal is usually one domain, often with binding partners, so the view picks the chain the transcript belongs to once the structure loads."),
|
|
18
18
|
React.createElement("li", null,
|
|
19
19
|
React.createElement("b", null, "Foldseek search"),
|
|
20
20
|
" sends the protein sequence to the foldseek.com servers and lists structures similar in shape, including ones with little sequence similarity."),
|
|
@@ -30,7 +30,7 @@ export default function PdbResultsTable({ entries, selectedPdbId, onSelect, }) {
|
|
|
30
30
|
return (React.createElement(React.Fragment, null,
|
|
31
31
|
React.createElement(Typography, { variant: "body2", color: "textSecondary" },
|
|
32
32
|
entries.length,
|
|
33
|
-
" PDB entries, ranked
|
|
33
|
+
" PDB entries, ranked on coverage, then resolution",
|
|
34
34
|
entries.length > shown.length
|
|
35
35
|
? ` (showing the first ${MAX_ROWS})`
|
|
36
36
|
: ''),
|
|
@@ -43,7 +43,7 @@ export default function PdbResultsTable({ entries, selectedPdbId, onSelect, }) {
|
|
|
43
43
|
React.createElement(TableCell, { className: classes.headerCell }, "Method"),
|
|
44
44
|
React.createElement(TableCell, { className: classes.headerCell }, "Resolution"),
|
|
45
45
|
React.createElement(TableCell, { className: classes.headerCell },
|
|
46
|
-
React.createElement(Tooltip, { title: "The span of the UniProt sequence this entry resolves, by
|
|
46
|
+
React.createElement(Tooltip, { title: "The span of the UniProt sequence this entry resolves, by RCSB's UniProt alignment. A crystal is usually one domain rather than the whole protein." },
|
|
47
47
|
React.createElement("span", null, "UniProt residues"))),
|
|
48
48
|
React.createElement(TableCell, { className: classes.headerCell }, "Coverage"),
|
|
49
49
|
React.createElement(TableCell, { className: classes.headerCell }, "Chains"))),
|
|
@@ -56,14 +56,14 @@ export default function PdbResultsTable({ entries, selectedPdbId, onSelect, }) {
|
|
|
56
56
|
React.createElement(Radio, { checked: selected, size: "small" })),
|
|
57
57
|
React.createElement(TableCell, null,
|
|
58
58
|
React.createElement(ExternalLink, { href: rcsbEntryUrl(entry.pdbId) }, entry.pdbId.toUpperCase())),
|
|
59
|
-
React.createElement(TableCell, null, entry.
|
|
59
|
+
React.createElement(TableCell, null, entry.method),
|
|
60
60
|
React.createElement(TableCell, null, entry.resolution === undefined
|
|
61
61
|
? '-'
|
|
62
62
|
: `${entry.resolution.toFixed(2)} Å`),
|
|
63
63
|
React.createElement(TableCell, null,
|
|
64
|
-
entry.
|
|
64
|
+
entry.start,
|
|
65
65
|
"-",
|
|
66
|
-
entry.
|
|
66
|
+
entry.end),
|
|
67
67
|
React.createElement(TableCell, null,
|
|
68
68
|
(entry.coverage * 100).toFixed(0),
|
|
69
69
|
"%"),
|
|
@@ -12,8 +12,8 @@ import UniProtLookupControls from './UniProtLookupControls';
|
|
|
12
12
|
import UniProtLookupResults from './UniProtLookupResults';
|
|
13
13
|
import ExternalLink from '../../components/ExternalLink';
|
|
14
14
|
import useDebouncedValue from '../hooks/useDebouncedValue';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
15
|
+
import useExperimentalStructures from '../hooks/useExperimentalStructures';
|
|
16
|
+
import usePdbEntry from '../hooks/usePdbEntry';
|
|
17
17
|
import useTranscriptIsoformSelection from '../hooks/useTranscriptIsoformSelection';
|
|
18
18
|
const useStyles = makeStyles()({
|
|
19
19
|
dialogContent: {
|
|
@@ -26,18 +26,18 @@ const useStyles = makeStyles()({
|
|
|
26
26
|
},
|
|
27
27
|
},
|
|
28
28
|
});
|
|
29
|
-
// Experimental structures of the gene's protein
|
|
30
|
-
//
|
|
31
|
-
//
|
|
29
|
+
// Experimental structures of the gene's protein: RCSB lists every entry it
|
|
30
|
+
// aligns to the UniProt accession, ranked on coverage and resolution, so a
|
|
31
|
+
// reader who does not know a PDB id can still reach one.
|
|
32
32
|
// A crystal is usually a fragment, often with partners, so the view aligns
|
|
33
33
|
// the transcript to it after launch rather than expecting a sequence match
|
|
34
34
|
// here.
|
|
35
35
|
const PdbSearch = observer(function PdbSearch({ feature, preferredTranscriptId, session, view, handleClose, lookup, sideBySide, onSideBySideChange, }) {
|
|
36
36
|
const { classes } = useStyles();
|
|
37
37
|
const { uniprotId, isLookupLoading, lookupError } = lookup;
|
|
38
|
-
const { entries, error: pdbError, isLoading: isPdbLoading, } =
|
|
38
|
+
const { entries, error: pdbError, isLoading: isPdbLoading, } = useExperimentalStructures(uniprotId);
|
|
39
39
|
const [userPdbId, setUserPdbId] = useState();
|
|
40
|
-
// A typed id reaches entries
|
|
40
|
+
// A typed id reaches entries the accession's listing never offers: a structure
|
|
41
41
|
// of a complex filed under a partner, anything a paper names. Debounced, so
|
|
42
42
|
// the three characters on the way to four are not three fetches.
|
|
43
43
|
const [typedPdbId, setTypedPdbId] = useState('');
|
|
@@ -55,7 +55,8 @@ const PdbSearch = observer(function PdbSearch({ feature, preferredTranscriptId,
|
|
|
55
55
|
// The chosen entry's residues, which rank the isoforms and label the picker,
|
|
56
56
|
// the same annotation the AlphaFold tab shows. Their failure costs the
|
|
57
57
|
// ranking rather than the launch, which reads the structure file itself.
|
|
58
|
-
const {
|
|
58
|
+
const { entry, error: entryError, isValidating: isEntryValidating, } = usePdbEntry(selectedPdbId);
|
|
59
|
+
const structureSequences = entry?.proteinSequences;
|
|
59
60
|
const { transcripts, structureSequence, ranking, isLoading: isIsoformLoading, isRanking, error: isoformError, partialFailure: isoformPartialFailure, selectedTranscriptId, setSelectedTranscriptId, selectedTranscript, selectedIsoform, } = useTranscriptIsoformSelection({
|
|
60
61
|
feature,
|
|
61
62
|
view,
|
|
@@ -66,21 +67,21 @@ const PdbSearch = observer(function PdbSearch({ feature, preferredTranscriptId,
|
|
|
66
67
|
// Until the entry's chains arrive the ranking has no structure and orders
|
|
67
68
|
// the isoforms by length, so a launch that takes the ranked default waits.
|
|
68
69
|
// The right-clicked isoform needs no ranking and launches at once.
|
|
69
|
-
// An entry
|
|
70
|
-
const awaitsChains =
|
|
71
|
-
!
|
|
70
|
+
// An entry RCSB cannot describe stops holding the launch.
|
|
71
|
+
const awaitsChains = isEntryValidating &&
|
|
72
|
+
!entryError &&
|
|
72
73
|
selectedTranscriptId !== preferredTranscriptId;
|
|
73
74
|
const isoformStatuses = [
|
|
74
75
|
isIsoformLoading && 'Loading protein sequences from transcript isoforms',
|
|
75
76
|
isRanking && 'Aligning isoforms to the structure',
|
|
76
|
-
awaitsChains && 'Reading the chains of the entry from
|
|
77
|
+
awaitsChains && 'Reading the chains of the entry from RCSB',
|
|
77
78
|
// the selection reads the debounced id, so a launch inside the debounce
|
|
78
79
|
// opened the entry selected before the typing
|
|
79
80
|
trimmedTypedPdbId !== debouncedTypedPdbId && 'Reading the typed PDB ID',
|
|
80
81
|
];
|
|
81
82
|
const lookupStatuses = [
|
|
82
83
|
isLookupLoading && 'Looking up UniProt ID',
|
|
83
|
-
isPdbLoading && 'Listing PDB entries from
|
|
84
|
+
isPdbLoading && 'Listing PDB entries from RCSB',
|
|
84
85
|
];
|
|
85
86
|
const loadingStatuses = [...lookupStatuses, ...isoformStatuses].filter((s) => !!s);
|
|
86
87
|
const isLoading = loadingStatuses.length > 0;
|
|
@@ -115,7 +116,7 @@ const PdbSearch = observer(function PdbSearch({ feature, preferredTranscriptId,
|
|
|
115
116
|
setTypedPdbId(event.target.value);
|
|
116
117
|
}, slotProps: { inputLabel: { shrink: true } }, sx: { width: 240 } }),
|
|
117
118
|
uniprotId && entries && !isPdbLoading ? (entries.length > 0 ? (React.createElement(PdbResultsTable, { entries: entries, selectedPdbId: selectedPdbId, onSelect: setUserPdbId })) : (React.createElement(Typography, null,
|
|
118
|
-
"
|
|
119
|
+
"RCSB lists no experimental structure for",
|
|
119
120
|
' ',
|
|
120
121
|
React.createElement(ExternalLink, { href: uniprotEntryUrl(uniprotId) }, uniprotId),
|
|
121
122
|
". The AlphaFoldDB tab has a predicted one."))) : null,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { clinVarCategory } from '../../ProteinView/clinVar';
|
|
2
|
+
// The structure's clinvar scheme counts pathogenic calls in reds; the track
|
|
3
|
+
// shows every classification, so the reds are kept for the pathogenic end,
|
|
4
|
+
// greens for the benign end, and greys for what ClinVar cannot decide.
|
|
5
|
+
export const CLINVAR_CATEGORY_COLORS = {
|
|
6
|
+
pathogenic: '#a50f15',
|
|
7
|
+
'likely pathogenic': '#de2d26',
|
|
8
|
+
conflicting: '#fd8d3c',
|
|
9
|
+
uncertain: '#969696',
|
|
10
|
+
'likely benign': '#74c476',
|
|
11
|
+
benign: '#238b45',
|
|
12
|
+
other: '#bdbdbd',
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* One feature per placed variant, on the entry's residues. A variant whose
|
|
16
|
+
* residue the entry does not share with the transcript (an isoform's private
|
|
17
|
+
* exon) has nowhere to go and is left out.
|
|
18
|
+
*/
|
|
19
|
+
export function clinVarTrackFeatures({ placed, uniprotId, toEntryPosition, }) {
|
|
20
|
+
return placed
|
|
21
|
+
.flatMap(({ variant, residue, from, to }, index) => {
|
|
22
|
+
const position = toEntryPosition(residue);
|
|
23
|
+
if (position === undefined) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const category = clinVarCategory(variant.significance);
|
|
27
|
+
const name = `${from}${position + 1}${to}`;
|
|
28
|
+
const onTranscript = `${from}${residue + 1}${to}`;
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
uniqueId: `clinvar-${variant.id ?? `${variant.start}${variant.alt}`}-${index}`,
|
|
32
|
+
refName: uniprotId,
|
|
33
|
+
start: position,
|
|
34
|
+
end: position + 1,
|
|
35
|
+
name,
|
|
36
|
+
type: 'missense_variant',
|
|
37
|
+
category,
|
|
38
|
+
color: CLINVAR_CATEGORY_COLORS[category],
|
|
39
|
+
significance: variant.significance.join(', ').replaceAll('_', ' '),
|
|
40
|
+
...(variant.id === undefined ? {} : { clinvarId: variant.id }),
|
|
41
|
+
...(onTranscript === name ? {} : { transcriptChange: onTranscript }),
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
})
|
|
45
|
+
.sort((a, b) => a.start - b.start || a.name.localeCompare(b.name));
|
|
46
|
+
}
|
|
47
|
+
export function clinVarTrackConf({ uniprotId, idPrefix, features, }) {
|
|
48
|
+
const trackId = `${idPrefix}-ClinVar`;
|
|
49
|
+
return {
|
|
50
|
+
type: 'FeatureTrack',
|
|
51
|
+
trackId,
|
|
52
|
+
name: 'ClinVar',
|
|
53
|
+
assemblyNames: [uniprotId],
|
|
54
|
+
adapter: {
|
|
55
|
+
type: 'FromConfigAdapter',
|
|
56
|
+
adapterId: trackId,
|
|
57
|
+
features,
|
|
58
|
+
},
|
|
59
|
+
displays: [
|
|
60
|
+
{
|
|
61
|
+
type: 'LinearBasicDisplay',
|
|
62
|
+
displayId: `${trackId}-LinearBasicDisplay`,
|
|
63
|
+
renderer: {
|
|
64
|
+
type: 'SvgFeatureRenderer',
|
|
65
|
+
color1: "jexl:get(feature,'color')",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { SimpleFeature } from '@jbrowse/core/util';
|
|
2
|
+
import { makeCoordinateMapper, transcriptPos } from 'p2s_mapper';
|
|
3
|
+
import { clinVarTrackConf, clinVarTrackFeatures } from './clinVarTrack';
|
|
4
|
+
import { linkedGenomeAssemblyName, resolveLinkageAlignment, } from '../../Protein1DLinkage/linkage';
|
|
5
|
+
import { sessionLinkageHost } from '../../Protein1DLinkage/sessionLinkageHost';
|
|
6
|
+
import { clinVarBuild, isUnnumberedMitochondrion, } from '../../ProteinView/clinVar';
|
|
7
|
+
import { placeClinVarOnTranscript } from '../../ProteinView/clinVarSource';
|
|
8
|
+
// TP53's slice is under 1 MB; a stalled host should not hold the view open
|
|
9
|
+
// forever on one track
|
|
10
|
+
const CLINVAR_TIMEOUT_MS = 60_000;
|
|
11
|
+
/**
|
|
12
|
+
* The ClinVar track of a 1D view: every missense substitution NCBI's VCF
|
|
13
|
+
* classifies on the linked transcript, each on the entry residue its
|
|
14
|
+
* transcript residue aligns to. Undefined, with no track, when the genome
|
|
15
|
+
* view's assembly is not a build ClinVar numbers, or the transcript and the
|
|
16
|
+
* entry do not align; the view's own linkage reports the latter. A failed
|
|
17
|
+
* read throws, for the opener to report as the track's.
|
|
18
|
+
*/
|
|
19
|
+
export async function clinVarTrackConfFor({ session, linkage, idPrefix, }) {
|
|
20
|
+
const { uniprotId, feature } = linkage;
|
|
21
|
+
const assemblyName = linkedGenomeAssemblyName(session, linkage);
|
|
22
|
+
const assembly = assemblyName
|
|
23
|
+
? session.assemblyManager.get(assemblyName)
|
|
24
|
+
: undefined;
|
|
25
|
+
const build = clinVarBuild([
|
|
26
|
+
...(assemblyName ? [assemblyName] : []),
|
|
27
|
+
...(assembly ? [assembly.name, ...assembly.aliases] : []),
|
|
28
|
+
]);
|
|
29
|
+
if (!assemblyName ||
|
|
30
|
+
!build ||
|
|
31
|
+
isUnnumberedMitochondrion(feature.refName, build)) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const linked = await resolveLinkageAlignment(sessionLinkageHost(session, linkage));
|
|
35
|
+
if (!('alignment' in linked)) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const { placed } = await placeClinVarOnTranscript({
|
|
39
|
+
build,
|
|
40
|
+
feature: new SimpleFeature(feature),
|
|
41
|
+
assemblyName,
|
|
42
|
+
session,
|
|
43
|
+
signal: AbortSignal.timeout(CLINVAR_TIMEOUT_MS),
|
|
44
|
+
});
|
|
45
|
+
const mapper = makeCoordinateMapper(linked.alignment);
|
|
46
|
+
return clinVarTrackConf({
|
|
47
|
+
uniprotId,
|
|
48
|
+
idPrefix,
|
|
49
|
+
features: clinVarTrackFeatures({
|
|
50
|
+
placed,
|
|
51
|
+
uniprotId,
|
|
52
|
+
toEntryPosition: residue => mapper.transcriptToStructure(transcriptPos(residue)),
|
|
53
|
+
}),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
@@ -16,7 +16,7 @@ export async function launchProteinAnnotationView(args) {
|
|
|
16
16
|
await openProteinAnnotationView({ ...args, featureTypes });
|
|
17
17
|
}
|
|
18
18
|
/** The view, once the entry's feature types are in hand. */
|
|
19
|
-
export async function openProteinAnnotationView({ session, feature, selectedTranscript, uniprotId, confidenceUrl, connectedViewId, connectedAssemblyName, featureTypes, }) {
|
|
19
|
+
export async function openProteinAnnotationView({ session, feature, selectedTranscript, uniprotId, confidenceUrl, connectedViewId, connectedAssemblyName, featureTypes, clinVar, }) {
|
|
20
20
|
// A second view of an entry, another isoform's say, shares the first's
|
|
21
21
|
// assembly; adding it again makes the host warn. `has`, where the host has
|
|
22
22
|
// it, because `get` reports an unknown name to every plugin that resolves
|
|
@@ -47,6 +47,25 @@ export async function openProteinAnnotationView({ session, feature, selectedTran
|
|
|
47
47
|
if (!isTrackLaunchingView(view)) {
|
|
48
48
|
throw new Error('The host added a view that cannot open tracks');
|
|
49
49
|
}
|
|
50
|
+
const idPrefix = `${view.id}-${uniprotId}`;
|
|
51
|
+
const open = async (conf) => {
|
|
52
|
+
try {
|
|
53
|
+
// the host reports a config it rejects itself and resolves undefined
|
|
54
|
+
await view.launchTrack(conf.trackId, {}, {}, conf);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
session.notifyError(`Could not open the ${conf.name} track: ${e}`, e);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
// ClinVar waits on the transcript's alignment to the entry and a range read
|
|
61
|
+
// of NCBI's VCF, so it is asked for first and opened last, after the tracks
|
|
62
|
+
// that need only the entry
|
|
63
|
+
const clinVarTrack = proteinLinkage && clinVar
|
|
64
|
+
? clinVar(proteinLinkage, idPrefix).catch((e) => {
|
|
65
|
+
session.notifyError(`Could not open the ClinVar track: ${e}`, e);
|
|
66
|
+
return undefined;
|
|
67
|
+
})
|
|
68
|
+
: undefined;
|
|
50
69
|
// Each config rides on its track in this view, not in the session's track
|
|
51
70
|
// list: the host rejects a session track naming a temporary assembly, and
|
|
52
71
|
// the track selector lists session tracks only, so every track opens here
|
|
@@ -55,15 +74,13 @@ export async function openProteinAnnotationView({ session, feature, selectedTran
|
|
|
55
74
|
uniprotId,
|
|
56
75
|
featureTypes,
|
|
57
76
|
confidenceUrl,
|
|
58
|
-
idPrefix
|
|
77
|
+
idPrefix,
|
|
59
78
|
})) {
|
|
60
|
-
|
|
61
|
-
// the host reports a config it rejects itself and resolves undefined
|
|
62
|
-
await view.launchTrack(conf.trackId, {}, {}, conf);
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
session.notifyError(`Could not open the ${conf.name} track: ${e}`, e);
|
|
66
|
-
}
|
|
79
|
+
await open(conf);
|
|
67
80
|
}
|
|
68
81
|
await view.navToLocString(uniprotId, uniprotId);
|
|
82
|
+
const conf = await clinVarTrack;
|
|
83
|
+
if (conf) {
|
|
84
|
+
await open(conf);
|
|
85
|
+
}
|
|
69
86
|
}
|
|
@@ -52,20 +52,6 @@ function antigenTrackConf(uniprotId, idPrefix) {
|
|
|
52
52
|
assemblyNames: [uniprotId],
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function variationTrackConf(uniprotId, idPrefix) {
|
|
56
|
-
return {
|
|
57
|
-
type: 'FeatureTrack',
|
|
58
|
-
trackId: `${idPrefix}-Variation`,
|
|
59
|
-
name: 'Variation',
|
|
60
|
-
adapter: {
|
|
61
|
-
type: 'UniProtVariationAdapter',
|
|
62
|
-
location: {
|
|
63
|
-
uri: `https://www.ebi.ac.uk/proteins/api/variation/${uniprotId}.json`,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
assemblyNames: [uniprotId],
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
55
|
function alphaFoldConfidenceTrackConf({ uniprotId, confidenceUrl, idPrefix, }) {
|
|
70
56
|
return {
|
|
71
57
|
type: 'QuantitativeTrack',
|
|
@@ -115,15 +101,16 @@ function alphaMissenseTrackConf(uniprotId, idPrefix) {
|
|
|
115
101
|
};
|
|
116
102
|
}
|
|
117
103
|
/**
|
|
118
|
-
* Every annotation track of a UniProt entry
|
|
119
|
-
*
|
|
120
|
-
*
|
|
104
|
+
* Every annotation track of a UniProt entry that needs only the entry, as
|
|
105
|
+
* configs for the view to carry; the ClinVar track, which needs the linked
|
|
106
|
+
* transcript, is built by clinVarTrackSource. `idPrefix` has to be unique to
|
|
107
|
+
* the view: two views of one entry each hold their own copy, and a session
|
|
108
|
+
* tree cannot hold one trackId twice.
|
|
121
109
|
*/
|
|
122
110
|
export function proteinTrackConfs({ uniprotId, featureTypes, confidenceUrl, idPrefix, }) {
|
|
123
111
|
return [
|
|
124
112
|
...uniProtFeatureTrackConfs({ uniprotId, featureTypes, idPrefix }),
|
|
125
113
|
antigenTrackConf(uniprotId, idPrefix),
|
|
126
|
-
variationTrackConf(uniprotId, idPrefix),
|
|
127
114
|
...(confidenceUrl
|
|
128
115
|
? [alphaFoldConfidenceTrackConf({ uniprotId, confidenceUrl, idPrefix })]
|
|
129
116
|
: []),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { fetchExperimentalStructures } from 'p2s_mapper';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { STATIC_SWR_OPTIONS } from './swrOptions';
|
|
4
|
+
// An accession with no experimental structure, the ordinary case for most
|
|
5
|
+
// genes, answers an empty list rather than an error.
|
|
6
|
+
export default function useExperimentalStructures(uniprotId) {
|
|
7
|
+
const { data, error, isLoading } = useSWR(uniprotId ? ['experimental-structures', uniprotId] : null, ([, id]) => fetchExperimentalStructures(id), STATIC_SWR_OPTIONS);
|
|
8
|
+
return { entries: data, error, isLoading };
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { fetchPdbEntry } from 'p2s_mapper';
|
|
2
|
+
import useSWR from 'swr';
|
|
3
|
+
import { STATIC_SWR_OPTIONS } from './swrOptions';
|
|
4
|
+
// The entry's protein sequences rank the isoforms and label the picker: a few
|
|
5
|
+
// kB of JSON from RCSB, where reading them out of the structure file meant
|
|
6
|
+
// downloading and parsing the whole mmCIF, minutes for a ribosome.
|
|
7
|
+
export default function usePdbEntry(pdbId) {
|
|
8
|
+
const { data, error, isLoading, isValidating } = useSWR(pdbId ? ['pdb-entry', pdbId] : null, ([, id]) => fetchPdbEntry(id), STATIC_SWR_OPTIONS);
|
|
9
|
+
return { entry: data, error, isLoading, isValidating };
|
|
10
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { maybeLaunchSideBySide } from './sideBySide';
|
|
2
2
|
import { getGeneDisplayName, getTranscriptDisplayName } from './util';
|
|
3
3
|
import { proteinViewSnapshot } from '../../ProteinView/proteinViewSpec';
|
|
4
|
+
import { clinVarTrackConfFor } from '../components/clinVarTrackSource';
|
|
4
5
|
import { launchProteinAnnotationView } from '../components/launchProteinAnnotationView';
|
|
5
6
|
import { canAddTemporaryAssembly } from '../components/proteinAssemblySetup';
|
|
6
7
|
export function formatViewName(prefix, feature, selectedTranscript, uniprotId) {
|
|
@@ -57,6 +58,7 @@ async function launch1DProteinView({ session, view, feature, selectedTranscript,
|
|
|
57
58
|
confidenceUrl: entry === uniprotId ? confidenceUrl : undefined,
|
|
58
59
|
connectedViewId: view.id,
|
|
59
60
|
connectedAssemblyName: view.assemblyNames[0],
|
|
61
|
+
clinVar: (linkage, idPrefix) => clinVarTrackConfFor({ session, linkage, idPrefix }),
|
|
60
62
|
});
|
|
61
63
|
}
|
|
62
64
|
// What the launches below are CALLED, shared for the same reason their
|
|
@@ -2,6 +2,7 @@ import { SimpleFeature } from '@jbrowse/core/util';
|
|
|
2
2
|
import { fetchAlphaFoldModels } from 'p2s_mapper';
|
|
3
3
|
import { normalizeAnnotationLaunch } from './normalizeAnnotationLaunch';
|
|
4
4
|
import { connectGenomeView, resolveTranscriptLinkage, } from './transcriptLinkage';
|
|
5
|
+
import { clinVarTrackConfFor } from '../LaunchProteinView/components/clinVarTrackSource';
|
|
5
6
|
import { openProteinAnnotationView } from '../LaunchProteinView/components/launchProteinAnnotationView';
|
|
6
7
|
import { canAddTemporaryAssembly } from '../LaunchProteinView/components/proteinAssemblySetup';
|
|
7
8
|
import { fetchUniProtFeatureTypes } from '../LaunchProteinView/components/proteinTrackSetup';
|
|
@@ -79,6 +80,7 @@ export default function LaunchProteinAnnotationViewF(pluginManager) {
|
|
|
79
80
|
? viewAssemblyName(session, launch.connectedViewId)
|
|
80
81
|
: undefined) ?? connectedView?.assembly,
|
|
81
82
|
featureTypes,
|
|
83
|
+
clinVar: (linkage, idPrefix) => clinVarTrackConfFor({ session, linkage, idPrefix }),
|
|
82
84
|
});
|
|
83
85
|
}
|
|
84
86
|
catch (e) {
|
|
@@ -58,15 +58,13 @@ function infoField(info, key) {
|
|
|
58
58
|
return new RegExp(`(?:^|;)${key}=([^;]*)`).exec(info)?.[1];
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* The substitution a ClinVar VCF line records, when
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* `Conflicting_classifications_of_pathogenicity` holds no such term, so a
|
|
66
|
-
* conflicted call does not count.
|
|
61
|
+
* The substitution a ClinVar VCF line records, when it is a single base,
|
|
62
|
+
* missense on some transcript, and carries a germline classification.
|
|
63
|
+
* `CLNSIG` joins classifications with `/`, `|` and `,`
|
|
64
|
+
* (`Pathogenic/Likely_pathogenic`, `Pathogenic,_low_penetrance`).
|
|
67
65
|
*/
|
|
68
|
-
export function
|
|
69
|
-
const [, pos, , ref, alt, , , info = ''] = line.split('\t');
|
|
66
|
+
export function parseClinVarMissense(line) {
|
|
67
|
+
const [, pos, id, ref, alt, , , info = ''] = line.split('\t');
|
|
70
68
|
const significance = infoField(info, 'CLNSIG')?.split(/[/|,]/);
|
|
71
69
|
const consequences = infoField(info, 'MC')?.split(',');
|
|
72
70
|
return pos &&
|
|
@@ -74,27 +72,70 @@ export function parseClinVarSnv(line) {
|
|
|
74
72
|
alt &&
|
|
75
73
|
BASE.test(ref) &&
|
|
76
74
|
BASE.test(alt) &&
|
|
77
|
-
significance
|
|
75
|
+
significance &&
|
|
78
76
|
consequences?.some(c => c.endsWith('|missense_variant'))
|
|
79
|
-
? {
|
|
77
|
+
? {
|
|
78
|
+
start: +pos - 1,
|
|
79
|
+
ref,
|
|
80
|
+
alt,
|
|
81
|
+
id: id && id !== '.' ? id : undefined,
|
|
82
|
+
significance,
|
|
83
|
+
}
|
|
84
|
+
: undefined;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Whether ClinVar's aggregate germline classification calls a variant
|
|
88
|
+
* pathogenic or likely pathogenic.
|
|
89
|
+
* `Conflicting_classifications_of_pathogenicity` holds no such term, so a
|
|
90
|
+
* conflicted call does not count.
|
|
91
|
+
*/
|
|
92
|
+
export function isPathogenic(significance) {
|
|
93
|
+
return significance.some(s => s === 'Pathogenic' || s === 'Likely_pathogenic');
|
|
94
|
+
}
|
|
95
|
+
/** The pathogenic or likely pathogenic missense substitution a line records */
|
|
96
|
+
export function parseClinVarSnv(line) {
|
|
97
|
+
const variant = parseClinVarMissense(line);
|
|
98
|
+
return variant && isPathogenic(variant.significance)
|
|
99
|
+
? { start: variant.start, ref: variant.ref, alt: variant.alt }
|
|
80
100
|
: undefined;
|
|
81
101
|
}
|
|
102
|
+
export const CLINVAR_CATEGORIES = [
|
|
103
|
+
'pathogenic',
|
|
104
|
+
'likely pathogenic',
|
|
105
|
+
'conflicting',
|
|
106
|
+
'uncertain',
|
|
107
|
+
'likely benign',
|
|
108
|
+
'benign',
|
|
109
|
+
'other',
|
|
110
|
+
];
|
|
111
|
+
const CATEGORY_TERMS = [
|
|
112
|
+
['Pathogenic', 'pathogenic'],
|
|
113
|
+
['Likely_pathogenic', 'likely pathogenic'],
|
|
114
|
+
['Conflicting_classifications_of_pathogenicity', 'conflicting'],
|
|
115
|
+
['Uncertain_significance', 'uncertain'],
|
|
116
|
+
['Benign', 'benign'],
|
|
117
|
+
['Likely_benign', 'likely benign'],
|
|
118
|
+
];
|
|
119
|
+
/** The one category a classification is shown under, its gravest term
|
|
120
|
+
* deciding: `Benign/Likely_benign` is benign, `Likely_pathogenic|risk_factor`
|
|
121
|
+
* likely pathogenic. */
|
|
122
|
+
export function clinVarCategory(significance) {
|
|
123
|
+
return (CATEGORY_TERMS.find(([term]) => significance.includes(term))?.[1] ?? 'other');
|
|
124
|
+
}
|
|
82
125
|
const COMPLEMENT = { A: 'T', C: 'G', G: 'C', T: 'A' };
|
|
83
126
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* `checked` counts the variants that landed on a codon, and `disagreeing`
|
|
95
|
-
* those whose `REF` the genome does not spell.
|
|
127
|
+
* Each variant translated on this transcript's own codon: `p2gCodon`
|
|
128
|
+
* (g2p_mapper's, 0-based) lists a codon's genome positions in reading order,
|
|
129
|
+
* so a codon split by an intron and a minus-strand codon both read right. A
|
|
130
|
+
* variant the VCF calls missense on another transcript but that is
|
|
131
|
+
* synonymous, nonsense or outside the coding sequence of this one is left
|
|
132
|
+
* out, as is one whose `REF` disagrees with the genome. `residues` lists
|
|
133
|
+
* every residue with a whole codon, so a residue ClinVar has no call for is
|
|
134
|
+
* told apart from one the structure cannot place. `checked` counts the
|
|
135
|
+
* variants that landed on a codon, and `disagreeing` those whose `REF` the
|
|
136
|
+
* genome does not spell.
|
|
96
137
|
*/
|
|
97
|
-
export function
|
|
138
|
+
export function placeMissenseOnTranscript({ variants, p2gCodon, strand, genomeBase, codonTable, }) {
|
|
98
139
|
const oriented = (base) => base && strand === -1 ? COMPLEMENT[base] : base;
|
|
99
140
|
const codons = new Map();
|
|
100
141
|
const residueAt = new Map();
|
|
@@ -107,10 +148,11 @@ export function pathogenicCountByTranscriptPosition({ variants, p2gCodon, strand
|
|
|
107
148
|
});
|
|
108
149
|
}
|
|
109
150
|
}
|
|
110
|
-
const
|
|
151
|
+
const placed = [];
|
|
111
152
|
let checked = 0;
|
|
112
153
|
let disagreeing = 0;
|
|
113
|
-
for (const
|
|
154
|
+
for (const variant of variants) {
|
|
155
|
+
const { start, ref, alt } = variant;
|
|
114
156
|
const at = residueAt.get(start);
|
|
115
157
|
const codon = at ? codons.get(at.residue) : undefined;
|
|
116
158
|
if (!at || !codon) {
|
|
@@ -125,15 +167,42 @@ export function pathogenicCountByTranscriptPosition({ variants, p2gCodon, strand
|
|
|
125
167
|
const from = codonTable[codon.join('')];
|
|
126
168
|
const to = codonTable[mutated.join('')];
|
|
127
169
|
if (from && to && from !== to && from !== '*' && to !== '*') {
|
|
128
|
-
|
|
129
|
-
seen.add(to);
|
|
130
|
-
substitutions.set(at.residue, seen);
|
|
170
|
+
placed.push({ variant, residue: at.residue, from, to });
|
|
131
171
|
}
|
|
132
172
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
.
|
|
136
|
-
|
|
173
|
+
return {
|
|
174
|
+
placed,
|
|
175
|
+
residues: [...codons.keys()].toSorted((a, b) => a - b),
|
|
176
|
+
checked,
|
|
177
|
+
disagreeing,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* How many distinct substitutions land on each residue: two codon changes to
|
|
182
|
+
* one amino acid count once, and every residue with a whole codon gets a
|
|
183
|
+
* count, zero included.
|
|
184
|
+
*/
|
|
185
|
+
export function substitutionCountByResidue(placed, residues) {
|
|
186
|
+
const substitutions = new Map();
|
|
187
|
+
for (const { residue, to } of placed) {
|
|
188
|
+
const seen = substitutions.get(residue) ?? new Set();
|
|
189
|
+
seen.add(to);
|
|
190
|
+
substitutions.set(residue, seen);
|
|
191
|
+
}
|
|
192
|
+
return new Map(residues.map(residue => [residue, substitutions.get(residue)?.size ?? 0]));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* How many distinct missense substitutions ClinVar calls pathogenic or likely
|
|
196
|
+
* pathogenic at each 0-based residue of a transcript, given the pathogenic
|
|
197
|
+
* ones.
|
|
198
|
+
*/
|
|
199
|
+
export function pathogenicCountByTranscriptPosition(args) {
|
|
200
|
+
const { placed, residues, checked, disagreeing } = placeMissenseOnTranscript(args);
|
|
201
|
+
return {
|
|
202
|
+
byPosition: substitutionCountByResidue(placed, residues),
|
|
203
|
+
checked,
|
|
204
|
+
disagreeing,
|
|
205
|
+
};
|
|
137
206
|
}
|
|
138
207
|
/**
|
|
139
208
|
* Whether the genome under a transcript is some other build than the VCF's:
|