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.
@@ -1,24 +1,14 @@
1
1
  export default function LaunchMsaViewExtensionPointF(pluginManager) {
2
- pluginManager.addToExtensionPoint('LaunchView-MsaView',
3
- // @ts-expect-error
4
- ({ session, data, msaFileLocation, msaIndexedLocation, msaName, treeFileLocation, connectedViewId, connectedFeature, displayName, colorSchemeName, colWidth, rowHeight, treeAreaWidth, treeWidth, drawNodeBubbles, labelsAlignRight, showBranchLen, querySeqName, highlightColumns, }) => {
2
+ pluginManager.addToExtensionPoint('LaunchView-MsaView', (args) => {
3
+ const { session, data, msaFileLocation, msaIndexedLocation, msaName, treeFileLocation, querySeqName, ...rest } = args;
5
4
  if (!data && !msaFileLocation && !msaIndexedLocation) {
6
5
  throw new Error('No MSA data or file location provided when launching MSA view');
7
6
  }
7
+ // all data sources flow through `init` so processInit is the single place
8
+ // that resolves them (AlphaFold detection, native filehandle loading, etc.)
8
9
  session.addView('MsaView', {
9
10
  type: 'MsaView',
10
- displayName,
11
- connectedViewId,
12
- connectedFeature,
13
- colorSchemeName,
14
- colWidth,
15
- rowHeight,
16
- treeAreaWidth,
17
- treeWidth,
18
- drawNodeBubbles,
19
- labelsAlignRight,
20
- showBranchLen,
21
- highlightColumns,
11
+ ...rest,
22
12
  init: {
23
13
  msaData: data?.msa,
24
14
  treeData: data?.tree,
@@ -29,5 +19,6 @@ export default function LaunchMsaViewExtensionPointF(pluginManager) {
29
19
  querySeqName,
30
20
  },
31
21
  });
22
+ return args;
32
23
  });
33
24
  }
@@ -116,13 +116,17 @@ export function autoLoadProteinDomains(self) {
116
116
  })();
117
117
  }
118
118
  }
119
+ // Resolve the declarative `init` launch contract once. Inline strings go straight
120
+ // to the data model; URLs are handed to react-msaview's native filehandle loaders
121
+ // (openLocation + progress + abort + CORS-proxy) rather than a hand-rolled fetch;
122
+ // the bgzip name-indexed block is the one source with no native loader.
119
123
  export function processInit(self) {
120
124
  const { init } = self;
121
125
  if (init) {
126
+ const { msaData, msaUrl, msaIndexedLocation, msaName, treeData, treeUrl, querySeqName, } = init;
122
127
  void (async () => {
123
128
  try {
124
129
  self.setError(undefined);
125
- const { msaData, msaUrl, msaIndexedLocation, msaName, treeData, treeUrl, querySeqName, } = init;
126
130
  if (msaUrl) {
127
131
  const id = getUniprotIdFromAlphaFoldUrl(msaUrl);
128
132
  if (id) {
@@ -137,12 +141,7 @@ export function processInit(self) {
137
141
  self.setMSA(msaData);
138
142
  }
139
143
  else if (msaUrl) {
140
- const response = await fetch(msaUrl);
141
- if (!response.ok) {
142
- throw new Error(`Failed to fetch MSA: ${response.status}`);
143
- }
144
- const data = await response.text();
145
- self.setMSA(data);
144
+ self.setMSAFilehandle({ uri: msaUrl, locationType: 'UriLocation' });
146
145
  }
147
146
  else if (msaIndexedLocation && msaName) {
148
147
  const fasta = await fetchIndexedMsa({
@@ -160,12 +159,7 @@ export function processInit(self) {
160
159
  self.setTree(treeData);
161
160
  }
162
161
  else if (treeUrl) {
163
- const response = await fetch(treeUrl);
164
- if (!response.ok) {
165
- throw new Error(`Failed to fetch tree: ${response.status}`);
166
- }
167
- const data = await response.text();
168
- self.setTree(data);
162
+ self.setTreeFilehandle({ uri: treeUrl, locationType: 'UriLocation' });
169
163
  }
170
164
  self.setInit(undefined);
171
165
  }