jbrowse-plugin-protein3d 1.30.0 → 1.31.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/AlphaFoldComplexesTable.js +101 -0
- package/dist/LaunchProteinView/components/AlphaFoldDBSearch.js +15 -2
- package/dist/LaunchProteinView/components/UniProtResultsTable.js +1 -1
- package/dist/LaunchProteinView/hooks/useAlphaFoldComplexes.js +31 -0
- package/dist/LaunchProteinView/hooks/useAlphaFoldDBSearch.js +16 -5
- package/dist/LaunchProteinViewExtensionPoint/normalizeLaunch.js +8 -4
- package/dist/ProteinView/fileUniProt.js +25 -0
- package/dist/ProteinView/proteinViewSpec.js +1 -0
- package/dist/ProteinView/structureLoader.js +28 -9
- package/dist/ProteinView/structureModel.js +40 -10
- package/dist/ProteinView/structureReport.js +4 -2
- package/dist/chunks/{AddStructureDialog-VO35RYOW.js → AddStructureDialog-GZ7YSFJO.js} +2 -2
- package/dist/chunks/LaunchProteinViewDialog-332ZRCKH.js +2 -0
- package/dist/chunks/LaunchProteinViewDialog-332ZRCKH.js.map +7 -0
- package/dist/chunks/{ManualAlignmentDialog-VGHPVBF5.js → ManualAlignmentDialog-UN6O2FJS.js} +2 -2
- package/dist/chunks/{ProteinView-AEOQCJ35.js → ProteinView-7F7VEAFI.js} +2 -2
- package/dist/chunks/{chunk-OT7KMAGM.js → chunk-2PBRTULS.js} +2 -2
- package/dist/chunks/{chunk-MHLZDRGW.js → chunk-5Q2KX5AR.js} +2 -2
- package/dist/chunks/chunk-5Q2KX5AR.js.map +7 -0
- package/dist/chunks/{chunk-RQCZWHQQ.js → chunk-7IAHWS5M.js} +2 -2
- package/dist/chunks/{chunk-5KWZTAUL.js → chunk-DLVAQOU6.js} +2 -2
- package/dist/chunks/{chunk-AFVOEGWH.js → chunk-E27SMIZ5.js} +2 -2
- package/dist/chunks/chunk-EX3JB7B4.js +2 -0
- package/dist/chunks/chunk-EX3JB7B4.js.map +7 -0
- package/dist/chunks/{chunk-22HNUQZG.js → chunk-H5GTPPVG.js} +2 -2
- package/dist/chunks/{chunk-IL53MSBO.js → chunk-HION7YP4.js} +2 -2
- package/dist/chunks/{chunk-KIR7LMDB.js → chunk-KEGV4ZRS.js} +2 -2
- package/dist/chunks/{chunk-MRFSMEU2.js → chunk-Q6MXLDYV.js} +2 -2
- package/dist/chunks/chunk-QPRIEAI4.js +29 -0
- package/dist/chunks/chunk-QPRIEAI4.js.map +7 -0
- package/dist/chunks/{chunk-BIJXO4M2.js → chunk-Y2KQAAF2.js} +2 -2
- package/dist/chunks/{chunk-WGXE3R2M.js → chunk-YXRW2525.js} +2 -2
- package/dist/chunks/chunk-ZCVU73CX.js +2 -0
- package/dist/chunks/chunk-ZCVU73CX.js.map +7 -0
- package/dist/chunks/clinVarSource-MZZ3FS3R.js +2 -0
- package/dist/chunks/esm-P5VQ7RXE.js +2 -0
- package/dist/chunks/isoformRanking-ZNEIFWWG.js +2 -0
- package/dist/chunks/{launchAnnotationView-NENNHQJN.js → launchAnnotationView-W6TZNXJW.js} +2 -2
- package/dist/chunks/{launchProteinView-HJOBR66M.js → launchProteinView-NMZQQBXU.js} +2 -2
- package/dist/chunks/launchViewUtils-4ZY4L37J.js +2 -0
- package/dist/chunks/model-RPEEIRC2.js +2 -0
- package/dist/chunks/model-RPEEIRC2.js.map +7 -0
- package/dist/chunks/{molstarExports-VWIGD7KO.js → molstarExports-E5KKETWP.js} +2 -2
- package/dist/chunks/resolveGeneLaunch-QZL3HMFN.js +2 -0
- package/dist/jbrowse-plugin-protein3d.esm.js +1 -1
- package/dist/jbrowse-plugin-protein3d.esm.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
- package/src/LaunchProteinView/components/AlphaFoldComplexesTable.tsx +189 -0
- package/src/LaunchProteinView/components/AlphaFoldDBSearch.tsx +27 -1
- package/src/LaunchProteinView/components/UniProtResultsTable.tsx +1 -1
- package/src/LaunchProteinView/hooks/useAlphaFoldComplexes.test.ts +72 -0
- package/src/LaunchProteinView/hooks/useAlphaFoldComplexes.ts +52 -0
- package/src/LaunchProteinView/hooks/useAlphaFoldDBSearch.ts +20 -4
- package/src/LaunchProteinView/resolveGeneLaunch.ts +1 -1
- package/src/LaunchProteinViewExtensionPoint/normalizeLaunch.test.ts +17 -2
- package/src/LaunchProteinViewExtensionPoint/normalizeLaunch.ts +8 -4
- package/src/ProteinView/fileUniProt.test.ts +77 -0
- package/src/ProteinView/fileUniProt.ts +32 -0
- package/src/ProteinView/proteinViewSpec.ts +4 -1
- package/src/ProteinView/structureLoader.test.ts +43 -0
- package/src/ProteinView/structureLoader.ts +38 -8
- package/src/ProteinView/structureModel.test.ts +67 -0
- package/src/ProteinView/structureModel.ts +42 -9
- package/src/ProteinView/structureReport.ts +4 -1
- package/src/version.ts +1 -1
- package/dist/chunks/LaunchProteinViewDialog-B4U5V2WV.js +0 -2
- package/dist/chunks/LaunchProteinViewDialog-B4U5V2WV.js.map +0 -7
- package/dist/chunks/chunk-B23VVDVS.js +0 -2
- package/dist/chunks/chunk-B23VVDVS.js.map +0 -7
- package/dist/chunks/chunk-CQBWGFIR.js +0 -2
- package/dist/chunks/chunk-CQBWGFIR.js.map +0 -7
- package/dist/chunks/chunk-DDPGOM6D.js +0 -29
- package/dist/chunks/chunk-DDPGOM6D.js.map +0 -7
- package/dist/chunks/chunk-MHLZDRGW.js.map +0 -7
- package/dist/chunks/clinVarSource-4M3NMFEI.js +0 -2
- package/dist/chunks/esm-VXBU2PVU.js +0 -2
- package/dist/chunks/isoformRanking-UGZ5OBYY.js +0 -2
- package/dist/chunks/launchViewUtils-NAACT5YD.js +0 -2
- package/dist/chunks/model-IWX5PO7C.js +0 -2
- package/dist/chunks/model-IWX5PO7C.js.map +0 -7
- package/dist/chunks/resolveGeneLaunch-NVKHBKVI.js +0 -2
- /package/dist/chunks/{AddStructureDialog-VO35RYOW.js.map → AddStructureDialog-GZ7YSFJO.js.map} +0 -0
- /package/dist/chunks/{ManualAlignmentDialog-VGHPVBF5.js.map → ManualAlignmentDialog-UN6O2FJS.js.map} +0 -0
- /package/dist/chunks/{ProteinView-AEOQCJ35.js.map → ProteinView-7F7VEAFI.js.map} +0 -0
- /package/dist/chunks/{chunk-OT7KMAGM.js.map → chunk-2PBRTULS.js.map} +0 -0
- /package/dist/chunks/{chunk-RQCZWHQQ.js.map → chunk-7IAHWS5M.js.map} +0 -0
- /package/dist/chunks/{chunk-5KWZTAUL.js.map → chunk-DLVAQOU6.js.map} +0 -0
- /package/dist/chunks/{chunk-AFVOEGWH.js.map → chunk-E27SMIZ5.js.map} +0 -0
- /package/dist/chunks/{chunk-22HNUQZG.js.map → chunk-H5GTPPVG.js.map} +0 -0
- /package/dist/chunks/{chunk-IL53MSBO.js.map → chunk-HION7YP4.js.map} +0 -0
- /package/dist/chunks/{chunk-KIR7LMDB.js.map → chunk-KEGV4ZRS.js.map} +0 -0
- /package/dist/chunks/{chunk-MRFSMEU2.js.map → chunk-Q6MXLDYV.js.map} +0 -0
- /package/dist/chunks/{chunk-BIJXO4M2.js.map → chunk-Y2KQAAF2.js.map} +0 -0
- /package/dist/chunks/{chunk-WGXE3R2M.js.map → chunk-YXRW2525.js.map} +0 -0
- /package/dist/chunks/{clinVarSource-4M3NMFEI.js.map → clinVarSource-MZZ3FS3R.js.map} +0 -0
- /package/dist/chunks/{esm-VXBU2PVU.js.map → esm-P5VQ7RXE.js.map} +0 -0
- /package/dist/chunks/{isoformRanking-UGZ5OBYY.js.map → isoformRanking-ZNEIFWWG.js.map} +0 -0
- /package/dist/chunks/{launchAnnotationView-NENNHQJN.js.map → launchAnnotationView-W6TZNXJW.js.map} +0 -0
- /package/dist/chunks/{launchProteinView-HJOBR66M.js.map → launchProteinView-NMZQQBXU.js.map} +0 -0
- /package/dist/chunks/{launchViewUtils-NAACT5YD.js.map → launchViewUtils-4ZY4L37J.js.map} +0 -0
- /package/dist/chunks/{molstarExports-VWIGD7KO.js.map → molstarExports-E5KKETWP.js.map} +0 -0
- /package/dist/chunks/{resolveGeneLaunch-NVKHBKVI.js.map → resolveGeneLaunch-QZL3HMFN.js.map} +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Paper, Radio, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Tooltip, Typography, } from '@mui/material';
|
|
3
|
+
import { observer } from 'mobx-react';
|
|
4
|
+
import { uniprotEntryUrl } from 'p2s_mapper';
|
|
5
|
+
import { makeStyles } from 'tss-react/mui';
|
|
6
|
+
import ExternalLink from '../../components/ExternalLink';
|
|
7
|
+
const useStyles = makeStyles()(theme => ({
|
|
8
|
+
tableContainer: {
|
|
9
|
+
maxHeight: 300,
|
|
10
|
+
},
|
|
11
|
+
headerCell: {
|
|
12
|
+
fontWeight: 'bold',
|
|
13
|
+
backgroundColor: theme.palette.mode === 'dark'
|
|
14
|
+
? theme.palette.grey[900]
|
|
15
|
+
: theme.palette.grey[100],
|
|
16
|
+
},
|
|
17
|
+
selectedRow: {
|
|
18
|
+
backgroundColor: theme.palette.action.selected,
|
|
19
|
+
},
|
|
20
|
+
clickableRow: {
|
|
21
|
+
cursor: 'pointer',
|
|
22
|
+
'&:hover': {
|
|
23
|
+
backgroundColor: theme.palette.action.hover,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
}));
|
|
27
|
+
export function alphaFoldEntryUrl(entity) {
|
|
28
|
+
return `https://alphafold.ebi.ac.uk/entry/${entity}`;
|
|
29
|
+
}
|
|
30
|
+
function complexKind({ homomer, oligomericState }) {
|
|
31
|
+
return `${homomer ? 'Homo' : 'Hetero'}${oligomericState ?? 'mer'}`;
|
|
32
|
+
}
|
|
33
|
+
function fixed(value, digits) {
|
|
34
|
+
return value === undefined ? '-' : value.toFixed(digits);
|
|
35
|
+
}
|
|
36
|
+
const Member = observer(function Member({ member, }) {
|
|
37
|
+
return (React.createElement("div", null,
|
|
38
|
+
React.createElement("strong", null, member.gene ?? member.accession),
|
|
39
|
+
member.copies > 1 ? ` ×${member.copies}` : '',
|
|
40
|
+
' ',
|
|
41
|
+
member.description ? `${member.description} ` : '',
|
|
42
|
+
React.createElement(ExternalLink, { href: uniprotEntryUrl(member.accession) }, member.accession)));
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* The structures AlphaFold DB predicted for a protein: optionally its monomer
|
|
46
|
+
* first, then each complex with the proteins it pairs with. `selected`
|
|
47
|
+
* undefined is the monomer.
|
|
48
|
+
*/
|
|
49
|
+
const AlphaFoldComplexesTable = observer(function AlphaFoldComplexesTable({ complexes, accession, monomer, selected, onSelect, }) {
|
|
50
|
+
const { classes } = useStyles();
|
|
51
|
+
const entry = accession.replace(/-\d+$/, '');
|
|
52
|
+
const rowClass = (isSelected) => `${classes.clickableRow} ${isSelected ? classes.selectedRow : ''}`;
|
|
53
|
+
return (React.createElement(React.Fragment, null,
|
|
54
|
+
React.createElement(Typography, { variant: "body2", color: "textSecondary" }, complexes.length === 0
|
|
55
|
+
? `AlphaFold DB has predicted no complex with ${entry}`
|
|
56
|
+
: `${complexes.length} complex${complexes.length === 1 ? '' : 'es'} AlphaFold DB predicted with ${entry}, homomers first, then by ipTM`),
|
|
57
|
+
React.createElement(TableContainer, { component: Paper, className: classes.tableContainer },
|
|
58
|
+
React.createElement(Table, { size: "small", stickyHeader: true, "data-testid": "alphafold-complexes-table" },
|
|
59
|
+
React.createElement(TableHead, null,
|
|
60
|
+
React.createElement(TableRow, null,
|
|
61
|
+
React.createElement(TableCell, { className: classes.headerCell, padding: "checkbox" }),
|
|
62
|
+
React.createElement(TableCell, { className: classes.headerCell }, "Structure"),
|
|
63
|
+
React.createElement(TableCell, { className: classes.headerCell }, "With"),
|
|
64
|
+
React.createElement(TableCell, { className: classes.headerCell },
|
|
65
|
+
React.createElement(Tooltip, { title: "Interface predicted TM-score, 0 to 1: how sure the prediction is of how the chains sit against each other. Above 0.8 is confident; below 0.6 the interface is likely wrong." },
|
|
66
|
+
React.createElement("span", null, "ipTM"))),
|
|
67
|
+
React.createElement(TableCell, { className: classes.headerCell },
|
|
68
|
+
React.createElement(Tooltip, { title: "Mean per-residue confidence, 0 to 100" },
|
|
69
|
+
React.createElement("span", null, "pLDDT"))),
|
|
70
|
+
React.createElement(TableCell, { className: classes.headerCell }, "AlphaFold DB"))),
|
|
71
|
+
React.createElement(TableBody, null,
|
|
72
|
+
monomer ? (React.createElement(TableRow, { className: rowClass(selected === undefined), onClick: () => {
|
|
73
|
+
onSelect(undefined);
|
|
74
|
+
} },
|
|
75
|
+
React.createElement(TableCell, { padding: "checkbox" },
|
|
76
|
+
React.createElement(Radio, { checked: selected === undefined, size: "small" })),
|
|
77
|
+
React.createElement(TableCell, null, "Monomer"),
|
|
78
|
+
React.createElement(TableCell, null, "-"),
|
|
79
|
+
React.createElement(TableCell, null, "-"),
|
|
80
|
+
React.createElement(TableCell, null, fixed(monomer.meanPlddt, 1)),
|
|
81
|
+
React.createElement(TableCell, null,
|
|
82
|
+
React.createElement(ExternalLink, { href: alphaFoldEntryUrl(entry) }, entry)))) : null,
|
|
83
|
+
complexes.map(complex => {
|
|
84
|
+
const isSelected = complex.entity === selected;
|
|
85
|
+
const partners = complex.homomer
|
|
86
|
+
? complex.members
|
|
87
|
+
: complex.members.filter(m => m.accession !== entry);
|
|
88
|
+
return (React.createElement(TableRow, { key: complex.entity, className: rowClass(isSelected), onClick: () => {
|
|
89
|
+
onSelect(complex.entity);
|
|
90
|
+
} },
|
|
91
|
+
React.createElement(TableCell, { padding: "checkbox" },
|
|
92
|
+
React.createElement(Radio, { checked: isSelected, size: "small" })),
|
|
93
|
+
React.createElement(TableCell, null, complexKind(complex)),
|
|
94
|
+
React.createElement(TableCell, null, partners.map(m => (React.createElement(Member, { key: m.accession, member: m })))),
|
|
95
|
+
React.createElement(TableCell, null, fixed(complex.iptm, 2)),
|
|
96
|
+
React.createElement(TableCell, null, fixed(complex.meanPlddt, 1)),
|
|
97
|
+
React.createElement(TableCell, null,
|
|
98
|
+
React.createElement(ExternalLink, { href: alphaFoldEntryUrl(complex.entity) }, complex.entity))));
|
|
99
|
+
}))))));
|
|
100
|
+
});
|
|
101
|
+
export default AlphaFoldComplexesTable;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
|
|
3
3
|
import { DialogActions, DialogContent, Typography } from '@mui/material';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
5
|
import { makeStyles } from 'tss-react/mui';
|
|
6
|
+
import AlphaFoldComplexesTable from './AlphaFoldComplexesTable';
|
|
6
7
|
import AlphaFoldDBSearchStatus from './AlphaFoldDBSearchStatus';
|
|
7
8
|
import PartialFailureNotice from './PartialFailureNotice';
|
|
8
9
|
import ProteinViewActions from './ProteinViewActions';
|
|
9
10
|
import TranscriptSelector from './TranscriptSelector';
|
|
10
11
|
import UniProtLookupControls from './UniProtLookupControls';
|
|
11
12
|
import UniProtLookupResults from './UniProtLookupResults';
|
|
13
|
+
import { errorMessage } from '../../ProteinView/util';
|
|
14
|
+
import { useAlphaFoldComplexes } from '../hooks/useAlphaFoldComplexes';
|
|
12
15
|
import useAlphaFoldDBSearch from '../hooks/useAlphaFoldDBSearch';
|
|
13
16
|
const useStyles = makeStyles()({
|
|
14
17
|
dialogContent: {
|
|
@@ -29,11 +32,16 @@ const useStyles = makeStyles()({
|
|
|
29
32
|
});
|
|
30
33
|
const AlphaFoldDBSearch = observer(function AlphaFoldDBSearch({ feature, preferredTranscriptId, session, view, handleClose, lookup, sideBySide, onSideBySideChange, }) {
|
|
31
34
|
const { classes } = useStyles();
|
|
35
|
+
const [complexEntity, setComplexEntity] = useState();
|
|
36
|
+
const { complexes, error: complexesError } = useAlphaFoldComplexes(lookup.uniprotId);
|
|
37
|
+
// a choice from another accession's list is no choice
|
|
38
|
+
const chosenComplex = complexes?.find(c => c.entity === complexEntity);
|
|
32
39
|
const state = useAlphaFoldDBSearch({
|
|
33
40
|
feature,
|
|
34
41
|
view,
|
|
35
42
|
lookup,
|
|
36
43
|
preferredTranscriptId,
|
|
44
|
+
complexEntity: chosenComplex?.entity,
|
|
37
45
|
});
|
|
38
46
|
return (React.createElement(React.Fragment, null,
|
|
39
47
|
React.createElement(DialogContent, { className: classes.dialogContent },
|
|
@@ -56,7 +64,12 @@ const AlphaFoldDBSearch = observer(function AlphaFoldDBSearch({ feature, preferr
|
|
|
56
64
|
state.uniprotId ? (React.createElement(React.Fragment, null,
|
|
57
65
|
React.createElement("div", { className: classes.selectorsRow },
|
|
58
66
|
React.createElement(TranscriptSelector, { val: state.userSelection, setVal: state.setUserSelection, structureSequence: state.structureSequence, feature: feature, isoforms: state.transcriptOptions, ranking: state.ranking })),
|
|
59
|
-
React.createElement(AlphaFoldDBSearchStatus, { uniprotId: state.modelAccession ?? state.uniprotId, url: state.url }))) : null
|
|
67
|
+
React.createElement(AlphaFoldDBSearchStatus, { uniprotId: state.modelAccession ?? state.uniprotId, url: state.url }))) : null,
|
|
68
|
+
state.uniprotId && complexes ? (React.createElement(AlphaFoldComplexesTable, { complexes: complexes, accession: state.uniprotId, monomer: state.noModel ? undefined : { meanPlddt: state.meanPlddt }, selected: chosenComplex?.entity, onSelect: setComplexEntity })) : null,
|
|
69
|
+
complexesError ? (React.createElement(Typography, { variant: "body2", color: "textSecondary" },
|
|
70
|
+
"AlphaFold DB's complex list did not answer:",
|
|
71
|
+
' ',
|
|
72
|
+
errorMessage(complexesError))) : null),
|
|
60
73
|
React.createElement(DialogActions, null,
|
|
61
74
|
React.createElement(ProteinViewActions, { handleClose: handleClose, uniprotId: state.modelAccession ?? state.uniprotId, userSelectedProteinSequence: state.userSelectedProteinSequence, selectedTranscript: state.selectedTranscript, url: state.url, confidenceUrl: state.confidenceUrl, feature: feature, view: view, session: session, sideBySide: sideBySide, onSideBySideChange: onSideBySideChange, sequencesMatch: state.sequencesMatch, isLoading: state.isLoading, error: state.error }))));
|
|
62
75
|
});
|
|
@@ -44,7 +44,7 @@ const UniProtResultsTable = observer(function UniProtResultsTable({ entries, sel
|
|
|
44
44
|
entries.length,
|
|
45
45
|
" UniProt entries. Select one:"),
|
|
46
46
|
React.createElement(TableContainer, { component: Paper, className: classes.tableContainer },
|
|
47
|
-
React.createElement(Table, { size: "small", stickyHeader: true },
|
|
47
|
+
React.createElement(Table, { size: "small", stickyHeader: true, "data-testid": "uniprot-results-table" },
|
|
48
48
|
React.createElement(TableHead, null,
|
|
49
49
|
React.createElement(TableRow, null,
|
|
50
50
|
React.createElement(TableCell, { className: classes.headerCell, padding: "checkbox" }),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { fetchAlphaFoldComplexModel, fetchAlphaFoldComplexes } from 'p2s_mapper';
|
|
3
|
+
import useSWR from 'swr';
|
|
4
|
+
import { STATIC_SWR_OPTIONS } from './swrOptions';
|
|
5
|
+
/** Homomers first, as the protein's own assembly, then the partners AlphaFold
|
|
6
|
+
* is surest of how they sit together */
|
|
7
|
+
export function rankAlphaFoldComplexes(complexes) {
|
|
8
|
+
return [...complexes].sort((a, b) => Number(b.homomer) - Number(a.homomer) || (b.iptm ?? 0) - (a.iptm ?? 0));
|
|
9
|
+
}
|
|
10
|
+
/** Every complex AlphaFold DB predicted with an accession's protein in it.
|
|
11
|
+
* An isoform's complexes are its entry's. */
|
|
12
|
+
export function useAlphaFoldComplexes(uniprotId) {
|
|
13
|
+
const entry = uniprotId?.replace(/-\d+$/, '');
|
|
14
|
+
const { data, error, isLoading } = useSWR(entry ? ['alphafold-complexes', entry] : null, ([, id]) => fetchAlphaFoldComplexes(id), STATIC_SWR_OPTIONS);
|
|
15
|
+
const complexes = useMemo(() => (data ? rankAlphaFoldComplexes(data) : undefined), [data]);
|
|
16
|
+
const complexesError = error;
|
|
17
|
+
return { complexes, error: complexesError, isLoading };
|
|
18
|
+
}
|
|
19
|
+
/** One complex's file and the protein of each of its chains, asked for once
|
|
20
|
+
* the complex is chosen */
|
|
21
|
+
export function useAlphaFoldComplexModel(entity) {
|
|
22
|
+
const { data, error, isLoading } = useSWR(entity ? ['alphafold-complex-model', entity] : null, async ([, id]) => {
|
|
23
|
+
const model = await fetchAlphaFoldComplexModel(id);
|
|
24
|
+
if (!model) {
|
|
25
|
+
throw new Error(`AlphaFold DB has no files for complex ${id}`);
|
|
26
|
+
}
|
|
27
|
+
return model;
|
|
28
|
+
}, STATIC_SWR_OPTIONS);
|
|
29
|
+
const modelError = error;
|
|
30
|
+
return { model: data, error: modelError, isLoading };
|
|
31
|
+
}
|
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
import { useMemo } from 'react';
|
|
2
2
|
import { sameProtein } from 'p2s_mapper';
|
|
3
|
+
import { useAlphaFoldComplexModel } from './useAlphaFoldComplexes';
|
|
3
4
|
import useAlphaFoldData from './useAlphaFoldData';
|
|
4
5
|
import useTranscriptIsoformSelection from './useTranscriptIsoformSelection';
|
|
5
|
-
export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredTranscriptId, }) {
|
|
6
|
+
export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredTranscriptId, complexEntity, }) {
|
|
6
7
|
const { uniprotId, isLookupLoading } = lookup;
|
|
7
8
|
const { isLoading: isAlphaFoldLoading, isValidating: isAlphaFoldValidating, modelsUnreachable, model, noModel, } = useAlphaFoldData({ uniprotId, feature, view, preferredTranscriptId });
|
|
9
|
+
const complex = useAlphaFoldComplexModel(complexEntity);
|
|
10
|
+
// the transcripts rank against the gene's own chain of a complex
|
|
11
|
+
const entry = uniprotId?.replace(/-\d+$/, '');
|
|
12
|
+
const complexSequence = complex.model?.chains.find(c => c.accession === entry)?.sequence;
|
|
13
|
+
const url = complexEntity ? complex.model?.url : model?.url;
|
|
8
14
|
// a stable array, or the isoform picker realigns on every render
|
|
9
|
-
const modelSequence =
|
|
15
|
+
const modelSequence = complexEntity
|
|
16
|
+
? complex.model && (complexSequence ?? model?.sequence)
|
|
17
|
+
: model?.sequence;
|
|
10
18
|
const structureSequences = useMemo(() => (modelSequence ? [modelSequence] : undefined), [modelSequence]);
|
|
11
19
|
const { transcripts: transcriptOptions, isoformSequences, structureSequence, ranking, isLoading: isIsoformLoading, isRanking, error: isoformError, partialFailure: isoformPartialFailure, selectedTranscriptId: userSelection, setSelectedTranscriptId: setUserSelection, selectedTranscript, selectedIsoform: userSelectedProteinSequence, } = useTranscriptIsoformSelection({
|
|
12
20
|
feature,
|
|
13
21
|
view,
|
|
14
22
|
structureSequences,
|
|
15
23
|
preferredTranscriptId,
|
|
16
|
-
resetKey:
|
|
24
|
+
resetKey: url,
|
|
17
25
|
});
|
|
18
26
|
const loadingStatuses = [
|
|
19
27
|
isLookupLoading && 'Looking up UniProt ID',
|
|
20
28
|
isIsoformLoading && 'Loading protein sequences from transcript isoforms',
|
|
21
29
|
isRanking && 'Aligning isoforms to the structure',
|
|
22
30
|
isAlphaFoldLoading && 'Asking AlphaFold DB for models',
|
|
31
|
+
complex.isLoading && 'Asking AlphaFold DB for the complex',
|
|
23
32
|
].filter(s => typeof s === 'string');
|
|
24
33
|
const isLoading = loadingStatuses.length > 0;
|
|
25
34
|
// errors wait for loading to finish, so a lookup in flight doesn't flash one
|
|
26
|
-
const rawError = isoformError ?? lookup.lookupError;
|
|
35
|
+
const rawError = isoformError ?? lookup.lookupError ?? complex.error;
|
|
27
36
|
const error = isLoading ? undefined : rawError;
|
|
28
37
|
return {
|
|
29
38
|
...lookup,
|
|
@@ -35,7 +44,8 @@ export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredT
|
|
|
35
44
|
ranking,
|
|
36
45
|
isoformPartialFailure,
|
|
37
46
|
userSelectedProteinSequence,
|
|
38
|
-
url
|
|
47
|
+
url,
|
|
48
|
+
meanPlddt: model?.meanPlddt,
|
|
39
49
|
confidenceUrl: model?.confidenceUrl,
|
|
40
50
|
modelAccession: model?.accession,
|
|
41
51
|
structureSequence,
|
|
@@ -46,6 +56,7 @@ export default function useAlphaFoldDBSearch({ feature, view, lookup, preferredT
|
|
|
46
56
|
// While the structure is refetched, structureSequence is still the previous
|
|
47
57
|
// selection's (keepPreviousData), so a match is unknown until it settles.
|
|
48
58
|
sequencesMatch: !isAlphaFoldValidating &&
|
|
59
|
+
!complex.isLoading &&
|
|
49
60
|
userSelectedProteinSequence?.seq &&
|
|
50
61
|
structureSequence
|
|
51
62
|
? sameProtein(userSelectedProteinSequence.seq, structureSequence)
|
|
@@ -5,6 +5,7 @@ const STRUCTURE_KEY_ROLES = {
|
|
|
5
5
|
url: 'source',
|
|
6
6
|
data: 'source',
|
|
7
7
|
uniprotId: 'source',
|
|
8
|
+
alphaFoldComplexId: 'source',
|
|
8
9
|
pdbId: 'source',
|
|
9
10
|
initialSelection: 'selection',
|
|
10
11
|
initialResidues: 'selection',
|
|
@@ -176,6 +177,7 @@ function readStructure(fields, at, warnings) {
|
|
|
176
177
|
url: read('url', isString, 'a string'),
|
|
177
178
|
data: read('data', isString, 'a string'),
|
|
178
179
|
uniprotId: read('uniprotId', isString, 'a string'),
|
|
180
|
+
alphaFoldComplexId: read('alphaFoldComplexId', isString, 'a string'),
|
|
179
181
|
pdbId: read('pdbId', isString, 'a string'),
|
|
180
182
|
initialSelection: read('initialSelection', isResidueRanges, RANGES),
|
|
181
183
|
initialResidues: read('initialResidues', isResidueRanges, RANGES),
|
|
@@ -195,7 +197,8 @@ function readStructure(fields, at, warnings) {
|
|
|
195
197
|
function namesSource(structure) {
|
|
196
198
|
return (!!resolveStructureUrl(structure) ||
|
|
197
199
|
structure.data !== undefined ||
|
|
198
|
-
!!structure.uniprotId
|
|
200
|
+
!!structure.uniprotId ||
|
|
201
|
+
!!structure.alphaFoldComplexId);
|
|
199
202
|
}
|
|
200
203
|
function withUrl(structure) {
|
|
201
204
|
return { ...structure, url: resolveStructureUrl(structure) };
|
|
@@ -229,7 +232,7 @@ export function normalizeLaunch(launch) {
|
|
|
229
232
|
const looksUpGene = !!linkage.gene && !linkage.userProvidedTranscriptSequence;
|
|
230
233
|
const noStructure = linkage.gene
|
|
231
234
|
? 'the launch names no structure, and `gene` is not looked up beside `userProvidedTranscriptSequence`'
|
|
232
|
-
: 'No url, data, uniprotId, pdbId or gene provided when launching protein view';
|
|
235
|
+
: 'No url, data, uniprotId, alphaFoldComplexId, pdbId or gene provided when launching protein view';
|
|
233
236
|
const given = top.get('structures');
|
|
234
237
|
if (given !== undefined && !Array.isArray(given)) {
|
|
235
238
|
warnings.push('`structures` is not an array and was ignored');
|
|
@@ -245,6 +248,7 @@ export function normalizeLaunch(launch) {
|
|
|
245
248
|
warnings,
|
|
246
249
|
geneModel: looksUpGene &&
|
|
247
250
|
!!structure.uniprotId &&
|
|
251
|
+
structure.alphaFoldComplexId === undefined &&
|
|
248
252
|
structure.url === undefined &&
|
|
249
253
|
structure.data === undefined
|
|
250
254
|
? 'preferred'
|
|
@@ -282,7 +286,7 @@ export function normalizeLaunch(launch) {
|
|
|
282
286
|
}
|
|
283
287
|
const structure = readStructure(fields, key => `\`structures[${i}].${key}\``, warnings);
|
|
284
288
|
if (!namesSource(structure)) {
|
|
285
|
-
warnings.push(`structures[${i}] names no url, data, uniprotId or pdbId and was omitted`);
|
|
289
|
+
warnings.push(`structures[${i}] names no url, data, uniprotId, alphaFoldComplexId or pdbId and was omitted`);
|
|
286
290
|
return [];
|
|
287
291
|
}
|
|
288
292
|
return [withUrl(structure)];
|
|
@@ -301,7 +305,7 @@ export function normalizeLaunch(launch) {
|
|
|
301
305
|
: {
|
|
302
306
|
error: linkage.gene
|
|
303
307
|
? noStructure
|
|
304
|
-
: 'no entry of `structures` names a url, data, uniprotId or pdbId',
|
|
308
|
+
: 'no entry of `structures` names a url, data, uniprotId, alphaFoldComplexId or pdbId',
|
|
305
309
|
warnings,
|
|
306
310
|
};
|
|
307
311
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { entityUniProtMappings } from 'p2s_mapper';
|
|
2
|
+
const ISOFORM_SUFFIX = /-\d+$/;
|
|
3
|
+
/**
|
|
4
|
+
* The UniProt mappings a model file states for its entities, as SIFTS would
|
|
5
|
+
* give them, so whichever chain the transcript maps to names its own protein.
|
|
6
|
+
* An isoform's entry publishes no features of its own and its AlphaMissense
|
|
7
|
+
* scores number the canonical entry, so an isoform reference places nothing.
|
|
8
|
+
*/
|
|
9
|
+
export function fileUniProtMappings(entities) {
|
|
10
|
+
return entityUniProtMappings(entities ?? []).filter(m => !ISOFORM_SUFFIX.test(m.accession));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The proteins of a complex as its file names them, `GSTM1 + GSTP1` or
|
|
14
|
+
* `SOD1 ×2`, so the view header says what the structure is rather than a
|
|
15
|
+
* model id. Undefined until the file is loaded or when it names no gene.
|
|
16
|
+
*/
|
|
17
|
+
export function complexMembersLabel(entities) {
|
|
18
|
+
const members = (entities ?? []).flatMap(e => {
|
|
19
|
+
const name = e.uniProt?.gene ?? e.uniProt?.accession;
|
|
20
|
+
return name
|
|
21
|
+
? [e.chains.length > 1 ? `${name} ×${e.chains.length}` : name]
|
|
22
|
+
: [];
|
|
23
|
+
});
|
|
24
|
+
return members.length > 0 ? members.join(' + ') : undefined;
|
|
25
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isAlive } from '@jbrowse/mobx-state-tree';
|
|
2
|
-
import { fetchAlphaFoldModels, getAlphaFoldStructureUrl, pickAlphaFoldModel, } from 'p2s_mapper';
|
|
2
|
+
import { fetchAlphaFoldComplexModel, fetchAlphaFoldModels, getAlphaFoldStructureUrl, pickAlphaFoldModel, } from 'p2s_mapper';
|
|
3
3
|
import { loadStructureData } from './loadStructureData';
|
|
4
4
|
import { removeMolstarStructure } from './removeStructure';
|
|
5
5
|
/**
|
|
@@ -24,13 +24,30 @@ import { removeMolstarStructure } from './removeStructure';
|
|
|
24
24
|
* built with leaves Mol* and loads again, so every reaction keyed on its
|
|
25
25
|
* Mol* structures reaches the new chains.
|
|
26
26
|
*/
|
|
27
|
-
export function makeStructureLoader(host, fetchModels = fetchAlphaFoldModels) {
|
|
27
|
+
export function makeStructureLoader(host, fetchModels = fetchAlphaFoldModels, fetchComplex = fetchAlphaFoldComplexModel) {
|
|
28
28
|
const loadingIn = new Map();
|
|
29
29
|
const failedIn = new WeakMap();
|
|
30
|
-
/** The
|
|
31
|
-
function
|
|
32
|
-
const { url, data, uniprotId } = structure;
|
|
33
|
-
return url
|
|
30
|
+
/** The AlphaFold id a structure still has to turn into a file, if any. */
|
|
31
|
+
function unresolvedId(structure) {
|
|
32
|
+
const { url, data, uniprotId, alphaFoldComplexId } = structure;
|
|
33
|
+
return url !== undefined || data !== undefined
|
|
34
|
+
? undefined
|
|
35
|
+
: alphaFoldComplexId
|
|
36
|
+
? { kind: 'complex', id: alphaFoldComplexId }
|
|
37
|
+
: uniprotId
|
|
38
|
+
? { kind: 'accession', id: uniprotId }
|
|
39
|
+
: undefined;
|
|
40
|
+
}
|
|
41
|
+
/** A complex's file carries a model version that moves, so it is asked
|
|
42
|
+
* for, like an accession's */
|
|
43
|
+
async function resolveComplexUrl(structure, entity) {
|
|
44
|
+
const model = await fetchComplex(entity);
|
|
45
|
+
if (!model) {
|
|
46
|
+
throw new Error(`AlphaFold DB has no complex ${entity}`);
|
|
47
|
+
}
|
|
48
|
+
if (isAlive(structure)) {
|
|
49
|
+
structure.setUrl(model.url);
|
|
50
|
+
}
|
|
34
51
|
}
|
|
35
52
|
/**
|
|
36
53
|
* Which AlphaFold file an accession opens. Asked rather than spelled: a
|
|
@@ -81,10 +98,12 @@ export function makeStructureLoader(host, fetchModels = fetchAlphaFoldModels) {
|
|
|
81
98
|
structure.setError(undefined);
|
|
82
99
|
// a structure that already knows its file dispatches synchronously, so the
|
|
83
100
|
// in-flight guard covers it before the autorun body returns
|
|
84
|
-
const
|
|
85
|
-
const loaded =
|
|
101
|
+
const unresolved = unresolvedId(structure);
|
|
102
|
+
const loaded = unresolved === undefined
|
|
86
103
|
? loadStructureData({ structure, plugin })
|
|
87
|
-
:
|
|
104
|
+
: (unresolved.kind === 'complex'
|
|
105
|
+
? resolveComplexUrl(structure, unresolved.id)
|
|
106
|
+
: resolveAlphaFoldUrl(structure, unresolved.id)).then(() => isAlive(structure)
|
|
88
107
|
? loadStructureData({ structure, plugin })
|
|
89
108
|
: undefined);
|
|
90
109
|
loaded
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SimpleFeature, getSession, getTrackName } from '@jbrowse/core/util';
|
|
2
2
|
import { addDisposer, getParent, isAlive, types, } from '@jbrowse/mobx-state-tree';
|
|
3
3
|
import { autorun, untracked, when } from 'mobx';
|
|
4
|
-
import { alignTranscriptToEntity, alignmentCol, alignmentQuality, chooseMappedEntity, entityAlignedTo, entityLabel, fetchUniProtStructureMappings, fusionPartnerPositions, getPdbIdFromUrl, getUniprotIdFromAlphaFoldTarget, locateStructureResidue, locateTranscriptResidue, looksLikePlddt, makeCoordinateMapper, makeLabelSeqIdIndex, mappedStructureIdentity, positionRangeRuns, rangeList, rangeToLabelSeqIds, residueNumber, residueRuns, resolveStructureUrl, sameProtein, stripStopCodon, structureDisplayLabel, structurePos, toLabelSeqIds, transcriptPos, transcriptRuns, unmapStructurePositions, } from 'p2s_mapper';
|
|
4
|
+
import { alignTranscriptToEntity, alignmentCol, alignmentQuality, chooseMappedEntity, entityAlignedTo, entityLabel, fetchUniProtStructureMappings, fusionPartnerPositions, getAlphaFoldComplexId, getPdbIdFromUrl, getUniprotIdFromAlphaFoldTarget, locateStructureResidue, locateTranscriptResidue, looksLikePlddt, makeCoordinateMapper, makeLabelSeqIdIndex, mappedStructureIdentity, positionRangeRuns, rangeList, rangeToLabelSeqIds, residueNumber, residueRuns, resolveStructureUrl, sameProtein, stripStopCodon, structureDisplayLabel, structurePos, toLabelSeqIds, transcriptPos, transcriptRuns, unmapStructurePositions, } from 'p2s_mapper';
|
|
5
5
|
import { alignOffThread } from './alignOffThread';
|
|
6
6
|
import { decideAlignment } from './alignmentDecision';
|
|
7
7
|
import { alignmentDomainStatus, connectedAlignmentDomains, domainRows, } from './alignmentDomains';
|
|
@@ -9,6 +9,7 @@ import { cssScaleOf, rampKeyOf } from './colorScale';
|
|
|
9
9
|
import { connectedHoverTranscriptPos } from './connectedHover';
|
|
10
10
|
import { CHAR_WIDTH, MINOR_FEATURE_TYPES, trackGapOf, trackHeightOf, } from './constants';
|
|
11
11
|
import { exonLabel, exonStatus, exonsByTranscriptPosition, transcriptExons, withExon, } from './exons';
|
|
12
|
+
import { complexMembersLabel, fileUniProtMappings } from './fileUniProt';
|
|
12
13
|
import { frameResidues } from './frameSelection';
|
|
13
14
|
import { codonLocus, hoverReadout } from './hoverReadout';
|
|
14
15
|
import { resolvedColor } from './proteinColor';
|
|
@@ -51,6 +52,14 @@ const Structure = types
|
|
|
51
52
|
* filename this plugin can spell.
|
|
52
53
|
*/
|
|
53
54
|
uniprotId: types.maybe(types.string),
|
|
55
|
+
/**
|
|
56
|
+
* #property
|
|
57
|
+
* AlphaFold DB's id for a predicted complex, `AF-0000000066211449`: the
|
|
58
|
+
* one an `{ alphaFoldComplexId }` shorthand asked for. With no url the
|
|
59
|
+
* structure loader asks AlphaFold DB for the model's file and fills in
|
|
60
|
+
* `url`, as it does for a `uniprotId`.
|
|
61
|
+
*/
|
|
62
|
+
alphaFoldComplexId: types.maybe(types.string),
|
|
54
63
|
/**
|
|
55
64
|
* #property
|
|
56
65
|
*/
|
|
@@ -562,7 +571,21 @@ const Structure = types
|
|
|
562
571
|
* readout and marks whose alignment panel is open.
|
|
563
572
|
*/
|
|
564
573
|
get label() {
|
|
565
|
-
|
|
574
|
+
const members = this.complexId
|
|
575
|
+
? complexMembersLabel(self.entities)
|
|
576
|
+
: undefined;
|
|
577
|
+
return members
|
|
578
|
+
? `AlphaFold complex ${members}`
|
|
579
|
+
: structureDisplayLabel(self);
|
|
580
|
+
},
|
|
581
|
+
/**
|
|
582
|
+
* #getter
|
|
583
|
+
* AlphaFold DB's id for a predicted complex, from the shorthand or the
|
|
584
|
+
* file url
|
|
585
|
+
*/
|
|
586
|
+
get complexId() {
|
|
587
|
+
return (self.alphaFoldComplexId ??
|
|
588
|
+
(self.url ? getAlphaFoldComplexId(self.url) : undefined));
|
|
566
589
|
},
|
|
567
590
|
/**
|
|
568
591
|
* #getter
|
|
@@ -580,13 +603,19 @@ const Structure = types
|
|
|
580
603
|
* land on this structure's residues; see structureUniProt.
|
|
581
604
|
*/
|
|
582
605
|
get uniProtEntry() {
|
|
606
|
+
const { pdbId, complexId } = this;
|
|
607
|
+
// A complex's chains are different proteins, so its file names each
|
|
608
|
+
// one and outranks any single accession beside it
|
|
609
|
+
const fromFile = !pdbId && (!!complexId || !self.uniprotId);
|
|
583
610
|
return structureUniProt({
|
|
584
|
-
uniprotId: self.uniprotId,
|
|
585
|
-
pdbId
|
|
611
|
+
uniprotId: complexId ? undefined : self.uniprotId,
|
|
612
|
+
pdbId,
|
|
586
613
|
modelAccession: self.url
|
|
587
614
|
? getUniprotIdFromAlphaFoldTarget(self.url)
|
|
588
615
|
: undefined,
|
|
589
|
-
uniProtMappings:
|
|
616
|
+
uniProtMappings: fromFile
|
|
617
|
+
? fileUniProtMappings(self.entities)
|
|
618
|
+
: self.uniProtMappings,
|
|
590
619
|
uniProtMappingsError: self.uniProtMappingsError,
|
|
591
620
|
mappedEntity: this.mappedEntity,
|
|
592
621
|
});
|
|
@@ -824,11 +853,12 @@ const Structure = types
|
|
|
824
853
|
return undefined;
|
|
825
854
|
}
|
|
826
855
|
if (!self.loadedToMolstar) {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
self.
|
|
830
|
-
|
|
831
|
-
|
|
856
|
+
const unresolved = self.url === undefined && self.data === undefined;
|
|
857
|
+
return unresolved && self.alphaFoldComplexId
|
|
858
|
+
? `Resolving AlphaFold complex ${self.alphaFoldComplexId}`
|
|
859
|
+
: unresolved && self.uniprotId
|
|
860
|
+
? `Resolving AlphaFold model for ${self.uniprotId}`
|
|
861
|
+
: `Loading ${this.label}`;
|
|
832
862
|
}
|
|
833
863
|
if (this.alignmentPending) {
|
|
834
864
|
const name = self.feature?.name;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { alignmentQuality, getUniprotIdFromAlphaFoldTarget, isLowSimilarity, } from 'p2s_mapper';
|
|
1
|
+
import { alignmentQuality, getAlphaFoldComplexId, getUniprotIdFromAlphaFoldTarget, isLowSimilarity, } from 'p2s_mapper';
|
|
2
2
|
import { errorMessage } from './util';
|
|
3
3
|
function text(value) {
|
|
4
4
|
return typeof value === 'string' ? value : undefined;
|
|
@@ -27,7 +27,9 @@ function sourceOf({ pdbId, url, data }) {
|
|
|
27
27
|
? 'pdb'
|
|
28
28
|
: data !== undefined
|
|
29
29
|
? 'data'
|
|
30
|
-
: url === undefined ||
|
|
30
|
+
: url === undefined ||
|
|
31
|
+
getUniprotIdFromAlphaFoldTarget(url) ||
|
|
32
|
+
getAlphaFoldComplexId(url)
|
|
31
33
|
? 'alphafold'
|
|
32
34
|
: 'url';
|
|
33
35
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as b,b as E,c as M,d as L}from"./chunk-UXGREKQA.js";import{E as p,G as m,a as c,c as x,e as A,f as U,g as w,h as F,j as B,k as d,t as a,u as k}from"./chunk-SB4F5EHZ.js";import{b as I}from"./chunk-VQ5X2CAU.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as t,s as e,u as K}from"./chunk-INAB36B4.js";import{
|
|
2
|
-
//# sourceMappingURL=AddStructureDialog-
|
|
1
|
+
import{a as b,b as E,c as M,d as L}from"./chunk-UXGREKQA.js";import{E as p,G as m,a as c,c as x,e as A,f as U,g as w,h as F,j as B,k as d,t as a,u as k}from"./chunk-SB4F5EHZ.js";import{b as I}from"./chunk-VQ5X2CAU.js";import{a as D}from"./chunk-BWRMG55K.js";import{r as t,s as e,u as K}from"./chunk-INAB36B4.js";import{eb as f}from"./chunk-QPRIEAI4.js";import"./chunk-XBJKSIMP.js";K();var Q=D(function({model:g,handleClose:h}){let[n,N]=t(),[l,V]=t(""),[u,W]=t(""),[o,q]=t("pdb"),[s,_]=t(""),[v,y]=t(),[G,C]=t(!1),[S,J]=t(!0),O=!!g.primaryStructure?.userProvidedTranscriptSequence,H=async()=>{C(!0),y(void 0);try{let r=o==="pdb"&&l?{pdbId:l}:o==="uniprot"&&u?{uniprotId:u}:o==="url"&&s?{url:s}:o==="file"&&n?{data:await M(n)}:void 0;if(r){let i=g.primaryStructure,z=S&&i?.userProvidedTranscriptSequence?{userProvidedTranscriptSequence:i.userProvidedTranscriptSequence,feature:i.feature,connectedViewId:i.connectedViewId}:{};g.addStructure({...r,...z}),h()}}catch(r){console.error(r),y(r)}finally{C(!1)}},P=l!==""&&!f(l),T=u!==""&&!b(u),j=o==="url"&&s!==""||o==="file"&&n!==void 0||o==="pdb"&&f(l)||o==="uniprot"&&b(u);return e.createElement(A,{open:!0,onClose:h,maxWidth:"sm",fullWidth:!0},e.createElement(F,null,"Add structure"),e.createElement(w,null,v?e.createElement(I,{error:v}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mb:2}},"Add another structure to superpose on the existing structure(s)."),e.createElement(B,{component:"fieldset",sx:{mb:2}},e.createElement(k,{value:o,onChange:r=>{q(r.target.value)}},e.createElement(d,{value:"pdb",control:e.createElement(a,null),label:"PDB ID"}),e.createElement(d,{value:"uniprot",control:e.createElement(a,null),label:"UniProt ID (AlphaFold)"}),e.createElement(d,{value:"url",control:e.createElement(a,null),label:"URL"}),e.createElement(d,{value:"file",control:e.createElement(a,null),label:"File"}))),o==="pdb"?e.createElement(p,{fullWidth:!0,value:l,onChange:r=>{V(r.target.value.trim().toUpperCase())},label:"PDB ID (e.g. 1CRN)",placeholder:"Enter PDB ID",error:P,helperText:P?"A PDB ID is four characters beginning with a digit":void 0,sx:{mb:2}}):null,o==="uniprot"?e.createElement(p,{fullWidth:!0,value:u,onChange:r=>{W(r.target.value.trim().toUpperCase())},label:"UniProt ID (e.g. P04637)",placeholder:"Enter UniProt ID",error:T,helperText:T?E:"Fetches the AlphaFold predicted structure",sx:{mb:2}}):null,o==="url"?e.createElement(p,{fullWidth:!0,label:"Structure URL",value:s,onChange:r=>{_(r.target.value.trim())},placeholder:"https://files.rcsb.org/download/1CRN.cif",sx:{mb:2}}):null,o==="file"?e.createElement("div",{style:{marginBottom:16}},e.createElement(c,{variant:"outlined",component:"label"},n?n.name:"Choose file",e.createElement("input",{type:"file",hidden:!0,accept:L,onChange:({target:r})=>{let i=r.files?.[0];i&&N(i)}})),n?e.createElement(m,{variant:"body2",sx:{mt:1}},"Selected: ",n.name):null):null,O?e.createElement(d,{control:e.createElement(x,{checked:S,onChange:r=>{J(r.target.checked)}}),label:"Map to the same transcript as the first structure (alignment, hover and click linked to the genome)"}):null,e.createElement(m,{variant:"body2",color:"text.secondary",sx:{mt:1}},"Tip: Structures will be automatically superposed using TM-align. For manual control, use the Mol* controls (\u{1F527} wrench icon).")),e.createElement(U,null,e.createElement(c,{onClick:h},"Cancel"),e.createElement(c,{onClick:()=>{H()},variant:"contained",color:"primary",disabled:!j||G},"Add structure")))}),te=Q;export{te as default};
|
|
2
|
+
//# sourceMappingURL=AddStructureDialog-GZ7YSFJO.js.map
|