jbrowse-plugin-msaview 2.3.3 → 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 (76) hide show
  1. package/README.md +15 -216
  2. package/dist/AddHighlightModel/GenomeMouseoverHighlight.js.map +1 -1
  3. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js +2 -11
  4. package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js.map +1 -1
  5. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +19 -4
  6. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
  7. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +39 -53
  8. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +1 -1
  9. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +9 -22
  10. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
  11. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +4 -1
  12. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -1
  13. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js +8 -1
  14. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +1 -1
  15. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +15 -7
  16. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +1 -1
  17. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js +8 -1
  18. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.js.map +1 -1
  19. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.d.ts +7 -0
  20. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +32 -0
  21. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js.map +1 -0
  22. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +7 -2
  23. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  24. package/dist/LaunchMsaView/components/TabPanel.js +1 -1
  25. package/dist/LaunchMsaView/components/TabPanel.js.map +1 -1
  26. package/dist/LaunchMsaView/components/TranscriptSelector.js +7 -3
  27. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -1
  28. package/dist/LaunchMsaView/components/useTranscriptSelection.js +15 -14
  29. package/dist/LaunchMsaView/components/useTranscriptSelection.js.map +1 -1
  30. package/dist/MsaViewPanel/afterCreateAutoruns.js +17 -18
  31. package/dist/MsaViewPanel/afterCreateAutoruns.js.map +1 -1
  32. package/dist/MsaViewPanel/components/ConnectStructureDialog.js +15 -10
  33. package/dist/MsaViewPanel/components/ConnectStructureDialog.js.map +1 -1
  34. package/dist/MsaViewPanel/components/ErrorBoundary.d.ts +19 -0
  35. package/dist/MsaViewPanel/components/ErrorBoundary.js +22 -0
  36. package/dist/MsaViewPanel/components/ErrorBoundary.js.map +1 -0
  37. package/dist/MsaViewPanel/components/MsaViewPanel.js +11 -2
  38. package/dist/MsaViewPanel/components/MsaViewPanel.js.map +1 -1
  39. package/dist/MsaViewPanel/model.d.ts +2 -14
  40. package/dist/MsaViewPanel/model.js +13 -10
  41. package/dist/MsaViewPanel/model.js.map +1 -1
  42. package/dist/MsaViewPanel/pairwiseAlignment.js +15 -10
  43. package/dist/MsaViewPanel/pairwiseAlignment.js.map +1 -1
  44. package/dist/MsaViewPanel/structureConnection.d.ts +22 -0
  45. package/dist/MsaViewPanel/structureConnection.js +4 -0
  46. package/dist/MsaViewPanel/structureConnection.js.map +1 -1
  47. package/dist/jbrowse-plugin-msaview.umd.production.min.js +26 -26
  48. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  49. package/dist/utils/blastCache.js +2 -3
  50. package/dist/utils/blastCache.js.map +1 -1
  51. package/dist/version.d.ts +1 -1
  52. package/dist/version.js +1 -1
  53. package/package.json +33 -35
  54. package/src/AddHighlightModel/GenomeMouseoverHighlight.tsx +1 -2
  55. package/src/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.ts +2 -11
  56. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +22 -7
  57. package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +40 -58
  58. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +14 -23
  59. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +4 -1
  60. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +9 -1
  61. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +15 -8
  62. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBISettingsDialog.tsx +9 -1
  63. package/src/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.ts +52 -0
  64. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +11 -2
  65. package/src/LaunchMsaView/components/TabPanel.tsx +1 -1
  66. package/src/LaunchMsaView/components/TranscriptSelector.tsx +7 -3
  67. package/src/LaunchMsaView/components/useTranscriptSelection.ts +25 -17
  68. package/src/MsaViewPanel/afterCreateAutoruns.ts +17 -18
  69. package/src/MsaViewPanel/components/ConnectStructureDialog.tsx +23 -25
  70. package/src/MsaViewPanel/components/ErrorBoundary.tsx +40 -0
  71. package/src/MsaViewPanel/components/MsaViewPanel.tsx +22 -11
  72. package/src/MsaViewPanel/model.ts +49 -33
  73. package/src/MsaViewPanel/pairwiseAlignment.ts +15 -10
  74. package/src/MsaViewPanel/structureConnection.ts +23 -0
  75. package/src/utils/blastCache.ts +2 -3
  76. package/src/version.ts +1 -1
@@ -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) {
@@ -88,10 +88,11 @@ export function needlemanWunsch(
88
88
  const matchScore = getScore(seq1[i - 1]!, seq2[j - 1]!)
89
89
  const prevM = M[i - 1]![j - 1]!
90
90
  const prevIx = Ix[i - 1]![j - 1]!
91
+ const currentScore = M[i]![j]!
91
92
 
92
- if (M[i]![j]! === prevM + matchScore) {
93
+ if (currentScore === prevM + matchScore) {
93
94
  currentMatrix = 'M'
94
- } else if (M[i]![j]! === prevIx + matchScore) {
95
+ } else if (currentScore === prevIx + matchScore) {
95
96
  currentMatrix = 'Ix'
96
97
  } else {
97
98
  currentMatrix = 'Iy'
@@ -102,13 +103,17 @@ export function needlemanWunsch(
102
103
  alignedSeq1 = seq1[i - 1] + alignedSeq1
103
104
  alignedSeq2 = '-' + alignedSeq2
104
105
 
105
- currentMatrix = Ix[i]![j]! === M[i - 1]![j]! + gapOpen ? 'M' : 'Ix'
106
+ const ixScore = Ix[i]![j]!
107
+ const mScore = M[i - 1]![j]! + gapOpen
108
+ currentMatrix = ixScore === mScore ? 'M' : 'Ix'
106
109
  i--
107
110
  } else if (j > 0) {
108
111
  alignedSeq1 = '-' + alignedSeq1
109
112
  alignedSeq2 = seq2[j - 1] + alignedSeq2
110
113
 
111
- currentMatrix = Iy[i]![j]! === M[i]![j - 1]! + gapOpen ? 'M' : 'Iy'
114
+ const iyScore = Iy[i]![j]!
115
+ const mScore = M[i]![j - 1]! + gapOpen
116
+ currentMatrix = iyScore === mScore ? 'M' : 'Iy'
112
117
  j--
113
118
  } else {
114
119
  break
@@ -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
  */
@@ -40,11 +40,10 @@ function createCacheKey(
40
40
  blastProgram: string,
41
41
  transcriptId?: string,
42
42
  ) {
43
- const seqKey = proteinSequence.slice(0, 100)
44
43
  if (transcriptId) {
45
- return `${blastDatabase}:${blastProgram}:${transcriptId}:${seqKey}`
44
+ return `${blastDatabase}:${blastProgram}:${transcriptId}:${proteinSequence}`
46
45
  }
47
- return `${blastDatabase}:${blastProgram}:${seqKey}`
46
+ return `${blastDatabase}:${blastProgram}:${proteinSequence}`
48
47
  }
49
48
 
50
49
  export async function getCachedBlastResult({
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.3.3'
1
+ export const version = '2.3.8'