jbrowse-plugin-msaview 2.3.5 → 2.3.8

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.
Files changed (62) hide show
  1. package/README.md +15 -216
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
  3. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +19 -4
  4. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
  5. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +16 -7
  6. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +1 -1
  7. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +4 -2
  8. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
  9. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +4 -1
  10. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -1
  11. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +8 -1
  12. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +1 -1
  13. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +15 -7
  14. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +1 -1
  15. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js +8 -1
  16. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js.map +1 -1
  17. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +3 -0
  18. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js.map +1 -1
  19. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +7 -2
  20. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  21. package/dist/LaunchMsaView/components/TabPanel.js +1 -1
  22. package/dist/LaunchMsaView/components/TabPanel.js.map +1 -1
  23. package/dist/LaunchMsaView/components/TranscriptSelector.js +7 -3
  24. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -1
  25. package/dist/MsaViewPanel/afterCreateAutoruns.js +9 -15
  26. package/dist/MsaViewPanel/afterCreateAutoruns.js.map +1 -1
  27. package/dist/MsaViewPanel/components/ConnectStructureDialog.js +15 -10
  28. package/dist/MsaViewPanel/components/ConnectStructureDialog.js.map +1 -1
  29. package/dist/MsaViewPanel/components/MsaViewPanel.js +8 -1
  30. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
  31. package/dist/MsaViewPanel/model.d.ts +2 -2
  32. package/dist/MsaViewPanel/model.js +13 -10
  33. package/dist/MsaViewPanel/model.js.map +1 -1
  34. package/dist/MsaViewPanel/pairwiseAlignment.js +6 -6
  35. package/dist/MsaViewPanel/pairwiseAlignment.js.map +1 -1
  36. package/dist/MsaViewPanel/structureConnection.d.ts +22 -0
  37. package/dist/MsaViewPanel/structureConnection.js +4 -0
  38. package/dist/MsaViewPanel/structureConnection.js.map +1 -1
  39. package/dist/jbrowse-plugin-msaview.umd.production.min.js +24 -24
  40. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  41. package/dist/version.d.ts +1 -1
  42. package/dist/version.js +1 -1
  43. package/package.json +2 -4
  44. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +1 -2
  45. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +22 -7
  46. package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +17 -9
  47. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +8 -3
  48. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +4 -1
  49. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +9 -1
  50. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +15 -8
  51. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.tsx +9 -1
  52. package/src/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.ts +3 -0
  53. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +11 -2
  54. package/src/LaunchMsaView/components/TabPanel.tsx +1 -1
  55. package/src/LaunchMsaView/components/TranscriptSelector.tsx +7 -3
  56. package/src/MsaViewPanel/afterCreateAutoruns.ts +9 -27
  57. package/src/MsaViewPanel/components/ConnectStructureDialog.tsx +23 -25
  58. package/src/MsaViewPanel/components/MsaViewPanel.tsx +9 -1
  59. package/src/MsaViewPanel/model.ts +23 -18
  60. package/src/MsaViewPanel/pairwiseAlignment.ts +6 -6
  61. package/src/MsaViewPanel/structureConnection.ts +23 -0
  62. package/src/version.ts +1 -1
@@ -3,17 +3,25 @@ import React from 'react'
3
3
  import { LoadingEllipses } from '@jbrowse/core/ui'
4
4
  import { observer } from 'mobx-react'
5
5
  import { MSAView } from 'react-msaview'
6
+ import { makeStyles } from 'tss-react/mui'
6
7
 
7
8
  import { ErrorBoundary } from './ErrorBoundary'
8
9
  import LoadingBLAST from './LoadingBLAST'
9
10
 
10
11
  import type { JBrowsePluginMsaViewModel } from '../model'
11
12
 
13
+ const useStyles = makeStyles()({
14
+ loadingContainer: {
15
+ padding: 20,
16
+ },
17
+ })
18
+
12
19
  const MsaViewPanel = observer(function MsaViewPanel2({
13
20
  model,
14
21
  }: {
15
22
  model: JBrowsePluginMsaViewModel
16
23
  }) {
24
+ const { classes } = useStyles()
17
25
  const { blastParams, loadingStoredData } = model
18
26
  return (
19
27
  <ErrorBoundary>
@@ -21,7 +29,7 @@ const MsaViewPanel = observer(function MsaViewPanel2({
21
29
  {blastParams ? (
22
30
  <LoadingBLAST model={model} baseUrl={blastParams.baseUrl} />
23
31
  ) : loadingStoredData ? (
24
- <div style={{ padding: 20 }}>
32
+ <div className={classes.loadingContainer}>
25
33
  <LoadingEllipses message="Loading MSA data" variant="h6" />
26
34
  </div>
27
35
  ) : (
@@ -21,9 +21,13 @@ import {
21
21
  import { genomeToMSA } from './genomeToMSA'
22
22
  import { msaCoordToGenomeCoord } from './msaCoordToGenomeCoord'
23
23
  import { buildAlignmentMaps, runPairwiseAlignment } from './pairwiseAlignment'
24
- import { mapToRecord, ungappedToGappedPosition } from './structureConnection'
24
+ import {
25
+ isProteinView,
26
+ mapToRecord,
27
+ ungappedToGappedPosition,
28
+ } from './structureConnection'
25
29
 
26
- import type { StructureConnection } from './structureConnection'
30
+ import type { ProteinView, StructureConnection } from './structureConnection'
27
31
  import type { MafRegion, MsaViewInitState } from './types'
28
32
  import type { Feature } from '@jbrowse/core/util'
29
33
  import type { Instance } from '@jbrowse/mobx-state-tree'
@@ -195,18 +199,19 @@ export default function stateModelFactory() {
195
199
  */
196
200
  get connectedProteinViews() {
197
201
  const { views } = getSession(self)
198
- return self.connectedStructures
199
- .map(conn => {
200
- const proteinView = views.find(
201
- (v: unknown) =>
202
- (v as Record<string, unknown>).id === conn.proteinViewId,
203
- )
204
- return proteinView ? { ...conn, proteinView } : undefined
205
- })
206
- .filter(
207
- (c): c is StructureConnection & { proteinView: any } =>
208
- c !== undefined,
202
+ const unknownViews = views as unknown[]
203
+ const result: (StructureConnection & { proteinView: ProteinView })[] =
204
+ []
205
+ for (const conn of self.connectedStructures) {
206
+ const proteinView = unknownViews.find(
207
+ (v): v is ProteinView =>
208
+ isProteinView(v) && v.id === conn.proteinViewId,
209
209
  )
210
+ if (proteinView) {
211
+ result.push({ ...conn, proteinView })
212
+ }
213
+ }
214
+ return result
210
215
  },
211
216
  }))
212
217
 
@@ -216,7 +221,7 @@ export default function stateModelFactory() {
216
221
  */
217
222
  get structureHoverCol(): number | undefined {
218
223
  for (const conn of self.connectedProteinViews) {
219
- const structure = conn.proteinView?.structures?.[conn.structureIdx]
224
+ const structure = conn.proteinView.structures[conn.structureIdx]
220
225
  const structurePos = structure?.hoverPosition?.structureSeqPos
221
226
  if (structurePos !== undefined) {
222
227
  const msaUngapped = conn.structureToMsa[structurePos]
@@ -380,14 +385,14 @@ export default function stateModelFactory() {
380
385
 
381
386
  const { views } = getSession(self)
382
387
 
383
- const proteinView = views.find(
384
- (v: any) => v.id === proteinViewId,
385
- ) as any
388
+ const proteinView = (views as unknown[]).find(
389
+ (v): v is ProteinView => isProteinView(v) && v.id === proteinViewId,
390
+ )
386
391
  if (!proteinView) {
387
392
  throw new Error(`ProteinView "${proteinViewId}" not found`)
388
393
  }
389
394
 
390
- const structure = proteinView.structures?.[structureIdx]
395
+ const structure = proteinView.structures[structureIdx]
391
396
  if (!structure) {
392
397
  throw new Error(`Structure at index ${structureIdx} not found`)
393
398
  }
@@ -1,9 +1,7 @@
1
1
  import BLOSUM62 from './blosum62'
2
2
 
3
3
  function getScore(a: string, b: string) {
4
- const upper_a = a.toUpperCase()
5
- const upper_b = b.toUpperCase()
6
- return BLOSUM62[upper_a]?.[upper_b] ?? -4
4
+ return BLOSUM62[a.toUpperCase()]?.[b.toUpperCase()] ?? -4
7
5
  }
8
6
 
9
7
  const GAP_OPEN = -10
@@ -75,10 +73,12 @@ export function needlemanWunsch(
75
73
  let i = m
76
74
  let j = n
77
75
 
78
- const finalScores = [M[m]![n]!, Ix[m]![n]!, Iy[m]![n]!]
79
- const score = Math.max(...finalScores)
76
+ const mScore = M[m]![n]!
77
+ const ixScore = Ix[m]![n]!
78
+ const iyScore = Iy[m]![n]!
79
+ const score = Math.max(mScore, ixScore, iyScore)
80
80
  let currentMatrix: 'M' | 'Ix' | 'Iy' =
81
- score === M[m]![n]! ? 'M' : score === Ix[m]![n]! ? 'Ix' : 'Iy'
81
+ score === mScore ? 'M' : score === ixScore ? 'Ix' : 'Iy'
82
82
 
83
83
  while (i > 0 || j > 0) {
84
84
  if (currentMatrix === 'M' && i > 0 && j > 0) {
@@ -1,3 +1,26 @@
1
+ export interface ProteinViewStructure {
2
+ url?: string
3
+ connectedViewId?: string
4
+ uniprotId?: string
5
+ structureSequences?: string[]
6
+ hoverGenomeHighlights?: { start: number; end: number }[]
7
+ hoverPosition?: { structureSeqPos?: number }
8
+ clearHighlightFromExternal?: () => void
9
+ highlightFromExternal?: (pos: number) => void
10
+ }
11
+
12
+ export interface ProteinView {
13
+ type: 'ProteinView'
14
+ id: string
15
+ displayName?: string
16
+ structures: ProteinViewStructure[]
17
+ }
18
+
19
+ export function isProteinView(view: unknown): view is ProteinView {
20
+ const v = view as Record<string, unknown>
21
+ return v.type === 'ProteinView' && Array.isArray(v.structures)
22
+ }
23
+
1
24
  /**
2
25
  * Represents a connection between the MSA view and a protein structure
3
26
  */
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.3.5'
1
+ export const version = '2.3.8'