1
- import { html , LitElement } from 'https://unpkg.com/[email protected] /index.js?module' ;
1
+ import { html , nothing , LitElement } from 'https://unpkg.com/[email protected] /index.js?module' ;
2
2
3
3
import { MolstarController } from '../controllers/molstarController.js' ;
4
4
import { ExonsController } from '../controllers/exonsController.js' ;
5
5
import { ProteinFeaturesController } from '../controllers/proteinFeaturesController.js' ;
6
6
import { VariantsController } from '../controllers/variantsController.js' ;
7
7
import { ConfidenceColorsController } from '../controllers/confidenceColorsController.js' ;
8
+ import { MissenseController } from '../controllers/missenseController.js' ;
9
+ import { ConfidenceMissenseColorsController } from '../controllers/confidenceMissenseController.js'
8
10
9
11
import {
10
12
fetchAlphaFoldId ,
@@ -15,6 +17,8 @@ import './exonsControlPanel.js';
15
17
import './variantsControlPanel.js' ;
16
18
import './defaultColorsPanel.js' ;
17
19
import './proteinFeaturesControlPanel.js' ;
20
+ import './missenseColorsPanel.js' ;
21
+ import './confidenceMissenseToggle.js' ;
18
22
19
23
20
24
export class EnsemblAlphafoldProtein extends LitElement {
@@ -35,6 +39,12 @@ export class EnsemblAlphafoldProtein extends LitElement {
35
39
this . confidenceColorsController = new ConfidenceColorsController ( {
36
40
host : this
37
41
} )
42
+ this . confidenceMissenseColorsController = new ConfidenceMissenseColorsController ( {
43
+ host : this
44
+ } )
45
+ this . missenseController = new MissenseController ( { host :this } ) ;
46
+
47
+
38
48
}
39
49
40
50
// prevent the component from rendering into the shadow DOM, see README.md for explanation
@@ -53,10 +63,14 @@ export class EnsemblAlphafoldProtein extends LitElement {
53
63
this . exonsController . load ( { rootUrl : restUrlRoot , enspId } ) ,
54
64
this . proteinFeaturesController . load ( { rootUrl : restUrlRoot , enspId } ) ,
55
65
this . variantsController . load ( { rootUrl : restUrlRoot , enspId } )
56
- ] ) . then ( ( [ alphafoldId ] ) => {
66
+ ] ) . then ( this . molstarController . getModelFileAndAnnotationUrl
67
+ ) . then ( ( alphafoldData ) => {
68
+ this . missenseController . load ( alphafoldData . annotation ) ;
69
+ return alphafoldData ;
70
+ } ) . then ( ( alphafoldData ) => {
57
71
// below is a promise; make sure it gets returned
58
72
return this . molstarController . renderAlphafoldStructure ( {
59
- moleculeId : alphafoldId ,
73
+ modelFileUrl : alphafoldData . cif ,
60
74
canvasContainer : molstarContainer
61
75
} ) ;
62
76
} ) . then ( ( ) => {
@@ -66,6 +80,7 @@ export class EnsemblAlphafoldProtein extends LitElement {
66
80
} ) ;
67
81
this . onLoadComplete ( ) ;
68
82
} ) . catch ( error => {
83
+ console . log ( error ) ;
69
84
this . onLoadFailed ( error ) ;
70
85
} ) ;
71
86
}
@@ -74,19 +89,27 @@ export class EnsemblAlphafoldProtein extends LitElement {
74
89
if ( ! this . loadCompleted ) {
75
90
return ;
76
91
}
92
+
77
93
const selections = [
78
94
this . exonsController . getSelectedExons ( ) ,
79
95
this . proteinFeaturesController . getSelectedFeatures ( ) ,
80
96
this . variantsController . getSelectedSiftVariants ( ) ,
81
97
this . variantsController . getSelectedPolyphenVariants ( )
82
- ] . flat ( ) ;
83
-
84
- const showConfidence = ! selections . length
98
+ ] . flat ( )
99
+ const hasNoSelection = ! selections . length
100
+
101
+ let updateData = {
102
+ selections : selections ,
103
+ showConfidence : hasNoSelection
104
+ }
85
105
86
- this . molstarController . updateSelections ( {
87
- selections,
88
- showConfidence
89
- } ) ;
106
+ if ( hasNoSelection && ! this . confidenceMissenseColorsController . showConfidence )
107
+ {
108
+ updateData . altSelection = this . missenseController . getSelection ( ) ;
109
+ updateData . showConfidence = false ;
110
+ }
111
+
112
+ this . molstarController . updateSelections ( updateData ) ;
90
113
}
91
114
92
115
onLoadComplete ( ) {
@@ -106,7 +129,7 @@ export class EnsemblAlphafoldProtein extends LitElement {
106
129
107
130
render ( ) {
108
131
return html `
109
- < link rel ="stylesheet " type ="text/css " href ="https://www.ebi.ac.uk/pdbe/pdb-component-library/css /pdbe-molstar-light-3.0.0 .css ">
132
+ < link rel ="stylesheet " type ="text/css " href ="https://cdn.jsdelivr.net/npm/[email protected] /build /pdbe-molstar-light.css ">
110
133
< div class ="container ">
111
134
< div class ="molstar-canvas "> </ div >
112
135
< div class ="controls ">
@@ -147,9 +170,22 @@ export class EnsemblAlphafoldProtein extends LitElement {
147
170
.onVariantSelectionChange=${ this . variantsController . onSelectionChange }
148
171
> </ variants-control-panel >
149
172
` }
150
- < default-colors-panel > </ default-colors-panel >
173
+
174
+ ${ this . missenseController . hasMissense ( ) ? html `
175
+ < confidence-missense-toggle
176
+ .onToggleChanged =${ this . confidenceMissenseColorsController . toggle }
177
+ .isConfidenceSelected =${ this . confidenceMissenseColorsController . getShowConfidence ( ) }
178
+ > </ confidence-missense-toggle >
179
+ ` : nothing }
180
+
181
+ ${ this . confidenceMissenseColorsController . showConfidence ? html `
182
+ < default-colors-panel > </ default-colors-panel > ` :
183
+ html `
184
+ < missense-colors-panel > </ missense-colors-panel > `
185
+ }
186
+
151
187
` ;
152
188
}
153
189
}
154
190
155
- customElements . define ( 'ensembl-alphafold-protein' , EnsemblAlphafoldProtein ) ;
191
+ customElements . define ( 'ensembl-alphafold-protein' , EnsemblAlphafoldProtein ) ;
0 commit comments