jbrowse-plugin-msaview 2.6.1 → 2.6.2

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/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "2.6.1";
1
+ export declare const version = "2.6.2";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.6.1';
1
+ export const version = '2.6.2';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.6.1",
2
+ "version": "2.6.2",
3
3
  "license": "MIT",
4
4
  "name": "jbrowse-plugin-msaview",
5
5
  "repository": {
@@ -1,73 +1,56 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager'
2
2
  import type { AbstractSessionModel } from '@jbrowse/core/util'
3
3
 
4
+ interface LaunchMsaViewArgs {
5
+ session: AbstractSessionModel
6
+ data?: { msa: string; tree?: string }
7
+ msaFileLocation?: { uri: string }
8
+ msaIndexedLocation?: { uri: string }
9
+ msaName?: string
10
+ treeFileLocation?: { uri: string }
11
+ connectedViewId?: string
12
+ connectedFeature?: Record<string, unknown>
13
+ displayName?: string
14
+ colorSchemeName?: string
15
+ colWidth?: number
16
+ rowHeight?: number
17
+ treeAreaWidth?: number
18
+ treeWidth?: number
19
+ drawNodeBubbles?: boolean
20
+ labelsAlignRight?: boolean
21
+ showBranchLen?: boolean
22
+ querySeqName?: string
23
+ highlightColumns?: number[]
24
+ }
25
+
4
26
  export default function LaunchMsaViewExtensionPointF(
5
27
  pluginManager: PluginManager,
6
28
  ) {
7
29
  pluginManager.addToExtensionPoint(
8
30
  'LaunchView-MsaView',
9
- // @ts-expect-error
10
- ({
11
- session,
12
- data,
13
- msaFileLocation,
14
- msaIndexedLocation,
15
- msaName,
16
- treeFileLocation,
17
- connectedViewId,
18
- connectedFeature,
19
- displayName,
20
- colorSchemeName,
21
- colWidth,
22
- rowHeight,
23
- treeAreaWidth,
24
- treeWidth,
25
- drawNodeBubbles,
26
- labelsAlignRight,
27
- showBranchLen,
28
- querySeqName,
29
- highlightColumns,
30
- }: {
31
- session: AbstractSessionModel
32
- data?: { msa: string; tree?: string }
33
- msaFileLocation?: { uri: string }
34
- msaIndexedLocation?: { uri: string }
35
- msaName?: string
36
- treeFileLocation?: { uri: string }
37
- connectedViewId?: string
38
- connectedFeature?: Record<string, unknown>
39
- displayName?: string
40
- colorSchemeName?: string
41
- colWidth?: number
42
- rowHeight?: number
43
- treeAreaWidth?: number
44
- treeWidth?: number
45
- drawNodeBubbles?: boolean
46
- labelsAlignRight?: boolean
47
- showBranchLen?: boolean
48
- querySeqName?: string
49
- highlightColumns?: number[]
50
- }) => {
31
+ (args: LaunchMsaViewArgs) => {
32
+ const {
33
+ session,
34
+ data,
35
+ msaFileLocation,
36
+ msaIndexedLocation,
37
+ msaName,
38
+ treeFileLocation,
39
+ querySeqName,
40
+ ...rest
41
+ } = args
42
+
51
43
  if (!data && !msaFileLocation && !msaIndexedLocation) {
52
44
  throw new Error(
53
45
  'No MSA data or file location provided when launching MSA view',
54
46
  )
55
47
  }
56
48
 
49
+ // all data sources flow through `init` so processInit is the single place
50
+ // that resolves them (AlphaFold detection, native filehandle loading, etc.)
57
51
  session.addView('MsaView', {
58
52
  type: 'MsaView',
59
- displayName,
60
- connectedViewId,
61
- connectedFeature,
62
- colorSchemeName,
63
- colWidth,
64
- rowHeight,
65
- treeAreaWidth,
66
- treeWidth,
67
- drawNodeBubbles,
68
- labelsAlignRight,
69
- showBranchLen,
70
- highlightColumns,
53
+ ...rest,
71
54
  init: {
72
55
  msaData: data?.msa,
73
56
  treeData: data?.tree,
@@ -78,6 +61,8 @@ export default function LaunchMsaViewExtensionPointF(
78
61
  querySeqName,
79
62
  },
80
63
  })
64
+
65
+ return args
81
66
  },
82
67
  )
83
68
  }
@@ -128,21 +128,25 @@ export function autoLoadProteinDomains(self: JBrowsePluginMsaViewModel) {
128
128
  }
129
129
  }
130
130
 
131
+ // Resolve the declarative `init` launch contract once. Inline strings go straight
132
+ // to the data model; URLs are handed to react-msaview's native filehandle loaders
133
+ // (openLocation + progress + abort + CORS-proxy) rather than a hand-rolled fetch;
134
+ // the bgzip name-indexed block is the one source with no native loader.
131
135
  export function processInit(self: JBrowsePluginMsaViewModel) {
132
136
  const { init } = self
133
137
  if (init) {
138
+ const {
139
+ msaData,
140
+ msaUrl,
141
+ msaIndexedLocation,
142
+ msaName,
143
+ treeData,
144
+ treeUrl,
145
+ querySeqName,
146
+ } = init
134
147
  void (async () => {
135
148
  try {
136
149
  self.setError(undefined)
137
- const {
138
- msaData,
139
- msaUrl,
140
- msaIndexedLocation,
141
- msaName,
142
- treeData,
143
- treeUrl,
144
- querySeqName,
145
- } = init
146
150
 
147
151
  if (msaUrl) {
148
152
  const id = getUniprotIdFromAlphaFoldUrl(msaUrl)
@@ -151,7 +155,6 @@ export function processInit(self: JBrowsePluginMsaViewModel) {
151
155
  self.setQuerySeqName('query')
152
156
  }
153
157
  }
154
-
155
158
  if (querySeqName) {
156
159
  self.setQuerySeqName(querySeqName)
157
160
  }
@@ -159,12 +162,7 @@ export function processInit(self: JBrowsePluginMsaViewModel) {
159
162
  if (msaData) {
160
163
  self.setMSA(msaData)
161
164
  } else if (msaUrl) {
162
- const response = await fetch(msaUrl)
163
- if (!response.ok) {
164
- throw new Error(`Failed to fetch MSA: ${response.status}`)
165
- }
166
- const data = await response.text()
167
- self.setMSA(data)
165
+ self.setMSAFilehandle({ uri: msaUrl, locationType: 'UriLocation' })
168
166
  } else if (msaIndexedLocation && msaName) {
169
167
  const fasta = await fetchIndexedMsa({
170
168
  location: msaIndexedLocation,
@@ -182,12 +180,7 @@ export function processInit(self: JBrowsePluginMsaViewModel) {
182
180
  if (treeData) {
183
181
  self.setTree(treeData)
184
182
  } else if (treeUrl) {
185
- const response = await fetch(treeUrl)
186
- if (!response.ok) {
187
- throw new Error(`Failed to fetch tree: ${response.status}`)
188
- }
189
- const data = await response.text()
190
- self.setTree(data)
183
+ self.setTreeFilehandle({ uri: treeUrl, locationType: 'UriLocation' })
191
184
  }
192
185
 
193
186
  self.setInit(undefined)
@@ -1,3 +1,6 @@
1
+ // Declarative launch contract, resolved once by processInit. This is also a
2
+ // cross-repo contract: jbrowse-plugin-protein3d builds an MsaView snapshot
3
+ // directly with `init: { msaUrl }`, so these keys must stay stable.
1
4
  export interface MsaViewInitState {
2
5
  msaData?: string
3
6
  msaUrl?: string
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.6.1'
1
+ export const version = '2.6.2'