@@ -187,7 +187,12 @@ const AlphaFoldDBSearch = observer(function ({
187
187
connectedViewId : view . id ,
188
188
} ,
189
189
] ,
190
- displayName : `Protein view ${ uniprotId } - ${ getGeneDisplayName ( feature ) } - ${ getTranscriptDisplayName ( selectedTranscript ) } ` ,
190
+ displayName : [
191
+ 'Protein view' ,
192
+ uniprotId ,
193
+ getGeneDisplayName ( feature ) ,
194
+ getTranscriptDisplayName ( selectedTranscript ) ,
195
+ ] . join ( ' - ' ) ,
191
196
} )
192
197
handleClose ( )
193
198
} }
@@ -201,113 +206,140 @@ const AlphaFoldDBSearch = observer(function ({
201
206
}
202
207
onClick = { ( ) => {
203
208
if ( uniprotId && isSessionWithAddTracks ( session ) ) {
204
- session . addTemporaryAssembly ?.( {
205
- name : uniprotId ,
206
- sequence : {
207
- type : 'ReferenceSequenceTrack' ,
208
- trackId : `${ uniprotId } -ReferenceSequenceTrack` ,
209
- sequenceType : 'pep' ,
210
- adapter : {
211
- type : 'UnindexedFastaAdapter' ,
212
- rewriteRefNames : "jexl:split(refName,'|')[1]" ,
213
- fastaLocation : {
214
- uri : `https://rest.uniprot.org/uniprotkb/${ uniprotId } .fasta` ,
209
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
210
+ ; ( async ( ) => {
211
+ try {
212
+ session . addTemporaryAssembly ?.( {
213
+ name : uniprotId ,
214
+ sequence : {
215
+ type : 'ReferenceSequenceTrack' ,
216
+ trackId : `${ uniprotId } -ReferenceSequenceTrack` ,
217
+ sequenceType : 'pep' ,
218
+ adapter : {
219
+ type : 'UnindexedFastaAdapter' ,
220
+ rewriteRefNames : "jexl:split(refName,'|')[1]" ,
221
+ fastaLocation : {
222
+ uri : `https://rest.uniprot.org/uniprotkb/${ uniprotId } .fasta` ,
223
+ } ,
224
+ } ,
215
225
} ,
216
- } ,
217
- } ,
218
- } )
219
- ; [
220
- 'Alternative sequence' ,
221
- 'Beta strand' ,
222
- 'Binding site' ,
223
- 'Chain' ,
224
- 'Compositional bias' ,
225
- 'Cross-link' ,
226
- 'Disulfide bond' ,
227
- 'Domain' ,
228
- 'Glycosylation' ,
229
- 'Helix' ,
230
- 'Modified residue' ,
231
- 'Motif' ,
232
- 'Mutagenesis' ,
233
- 'Natural variant' ,
234
- 'Peptide' ,
235
- 'Region' ,
236
- 'Sequence conflict' ,
237
- 'Signal peptide' ,
238
- 'Site' ,
239
- 'Topological domain' ,
240
- 'Transmembrane' ,
241
- 'Turn' ,
242
- ] . forEach ( type => {
243
- const s = `${ uniprotId } -${ type } `
244
- session . addTrackConf ( {
245
- type : 'FeatureTrack' ,
246
- trackId : s ,
247
- name : type ,
248
- adapter : {
249
- type : 'Gff3Adapter' ,
250
- gffLocation : {
251
- uri : `https://rest.uniprot.org/uniprotkb/${ uniprotId } .gff` ,
226
+ } )
227
+ const url = `https://rest.uniprot.org/uniprotkb/${ uniprotId } .gff`
228
+ const res = await fetch ( url )
229
+ if ( ! res . ok ) {
230
+ throw new Error ( `HTTP ${ res . status } fetching ${ url } ` )
231
+ }
232
+ const data = await res . text ( )
233
+
234
+ const types = [
235
+ ...new Set (
236
+ data
237
+ . split ( '\n' )
238
+ . filter ( f => ! f . startsWith ( '#' ) )
239
+ . map ( f => f . trim ( ) )
240
+ . filter ( f => ! ! f )
241
+ . map ( f => f . split ( '\t' ) [ 2 ] ) ,
242
+ ) ,
243
+ ]
244
+ types . forEach ( type => {
245
+ const s = `${ uniprotId } -${ type } `
246
+ session . addTrackConf ( {
247
+ type : 'FeatureTrack' ,
248
+ trackId : s ,
249
+ name : type ,
250
+ adapter : {
251
+ type : 'Gff3Adapter' ,
252
+ gffLocation : {
253
+ uri : `https://rest.uniprot.org/uniprotkb/${ uniprotId } .gff` ,
254
+ } ,
255
+ } ,
256
+ assemblyNames : [ uniprotId ] ,
257
+ displays : [
258
+ {
259
+ displayId : `${ type } -LinearBasicDisplay` ,
260
+ type : 'LinearBasicDisplay' ,
261
+ jexlFilters : [ `get(feature,'type')=='${ type } '` ] ,
262
+ } ,
263
+ ] ,
264
+ } )
265
+ } )
266
+ session . addTrackConf ( {
267
+ type : 'FeatureTrack' ,
268
+ trackId : 'Antigen' ,
269
+ name : 'Antigen' ,
270
+ adapter : {
271
+ type : 'Gff3Adapter' ,
272
+ gffLocation : {
273
+ uri : `https://www.ebi.ac.uk/proteins/api/antigen/${ uniprotId } ?format=gff` ,
274
+ } ,
252
275
} ,
253
- } ,
254
- assemblyNames : [ uniprotId ] ,
255
- displays : [
256
- {
257
- displayId : `${ type } -LinearBasicDisplay` ,
258
- type : 'LinearBasicDisplay' ,
259
- jexlFilters : [ `get(feature,'type')=='${ type } '` ] ,
276
+ assemblyNames : [ uniprotId ] ,
277
+ } )
278
+ session . addTrackConf ( {
279
+ type : 'FeatureTrack' ,
280
+ trackId : 'Variation' ,
281
+ name : 'Variation' ,
282
+ adapter : {
283
+ type : 'UniProtVariationAdapter' ,
284
+ location : {
285
+ uri : `https://www.ebi.ac.uk/proteins/api/variation/${ uniprotId } .json` ,
286
+ } ,
260
287
} ,
261
- ] ,
262
- } )
263
- } )
264
- session . addTrackConf ( {
265
- type : 'QuantitativeTrack' ,
266
- trackId : 'AlphaFold confidence' ,
267
- name : 'AlphaFold confidence' ,
268
- adapter : {
269
- type : 'AlphaFoldConfidenceAdapter' ,
270
- location : {
271
- uri : `https://alphafold.ebi.ac.uk/files/AF-${ uniprotId } -F1-confidence_v4.json` ,
272
- locationType : 'UriLocation' ,
273
- } ,
274
- } ,
275
- assemblyNames : [ uniprotId ] ,
276
- } )
277
- session . addTrackConf ( {
278
- type : 'MultiQuantitativeTrack' ,
279
- trackId : 'AlphaMissense scores' ,
280
- name : 'AlphaMissense scores' ,
281
- assemblyNames : [ uniprotId ] ,
282
- adapter : {
283
- type : 'AlphaMissensePathogenicityAdapter' ,
284
- location : {
285
- locationType : 'UriLocation' ,
286
- uri : `https://alphafold.ebi.ac.uk/files/AF-${ uniprotId } -F1-aa-substitutions.csv` ,
287
- } ,
288
- } ,
289
- displays : [
290
- {
291
- type : 'MultiLinearWiggleDisplay' ,
292
- displayId : 'AlphaMissense scores-MultiLinearWiggleDisplay' ,
293
- defaultRendering : 'multirowdensity' ,
294
- renderers : {
295
- MultiDensityRenderer : {
296
- type : 'MultiDensityRenderer' ,
297
- bicolorPivotValue : 0.5 ,
288
+ assemblyNames : [ uniprotId ] ,
289
+ } )
290
+ session . addTrackConf ( {
291
+ type : 'QuantitativeTrack' ,
292
+ trackId : 'AlphaFold confidence' ,
293
+ name : 'AlphaFold confidence' ,
294
+ adapter : {
295
+ type : 'AlphaFoldConfidenceAdapter' ,
296
+ location : {
297
+ uri : `https://alphafold.ebi.ac.uk/files/AF-${ uniprotId } -F1-confidence_v4.json` ,
298
298
} ,
299
299
} ,
300
- } ,
301
- ] ,
302
- } )
303
- const view = session . addView ( 'LinearGenomeView' , {
304
- type : 'LinearGenomeView' ,
305
- displayName : `Protein view ${ uniprotId } ${ getGeneDisplayName ( feature ) } - ${ getTranscriptDisplayName ( selectedTranscript ) } ` ,
306
- } ) as LinearGenomeViewModel
307
- view . navToLocString ( uniprotId , uniprotId ) . catch ( ( e : unknown ) => {
308
- console . error ( e )
309
- session . notifyError ( `${ e } ` , e )
310
- } )
300
+ assemblyNames : [ uniprotId ] ,
301
+ } )
302
+ session . addTrackConf ( {
303
+ type : 'MultiQuantitativeTrack' ,
304
+ trackId : 'AlphaMissense scores' ,
305
+ name : 'AlphaMissense scores' ,
306
+ assemblyNames : [ uniprotId ] ,
307
+ adapter : {
308
+ type : 'AlphaMissensePathogenicityAdapter' ,
309
+ location : {
310
+ uri : `https://alphafold.ebi.ac.uk/files/AF-${ uniprotId } -F1-aa-substitutions.csv` ,
311
+ } ,
312
+ } ,
313
+ displays : [
314
+ {
315
+ type : 'MultiLinearWiggleDisplay' ,
316
+ displayId :
317
+ 'AlphaMissense scores-MultiLinearWiggleDisplay' ,
318
+ defaultRendering : 'multirowdensity' ,
319
+ renderers : {
320
+ MultiDensityRenderer : {
321
+ type : 'MultiDensityRenderer' ,
322
+ bicolorPivotValue : 0.5 ,
323
+ } ,
324
+ } ,
325
+ } ,
326
+ ] ,
327
+ } )
328
+ const view = session . addView ( 'LinearGenomeView' , {
329
+ type : 'LinearGenomeView' ,
330
+ displayName : [
331
+ 'Protein view' ,
332
+ uniprotId ,
333
+ getGeneDisplayName ( feature ) ,
334
+ getTranscriptDisplayName ( selectedTranscript ) ,
335
+ ] . join ( ' - ' ) ,
336
+ } ) as LinearGenomeViewModel
337
+ await view . navToLocString ( uniprotId , uniprotId )
338
+ } catch ( e ) {
339
+ console . error ( e )
340
+ session . notifyError ( `${ e } ` , e )
341
+ }
342
+ } ) ( )
311
343
}
312
344
handleClose ( )
313
345
} }
0 commit comments