jbrowse-plugin-msaview 2.4.2 → 2.4.4

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 (72) hide show
  1. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js +3 -4
  2. package/dist/LaunchMsaView/components/LaunchMsaViewDialog.js.map +1 -1
  3. package/dist/LaunchMsaView/components/LaunchPanelContent.d.ts +5 -0
  4. package/dist/LaunchMsaView/components/LaunchPanelContent.js +16 -0
  5. package/dist/LaunchMsaView/components/LaunchPanelContent.js.map +1 -0
  6. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +22 -25
  7. package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js.map +1 -1
  8. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js +12 -24
  9. package/dist/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.js.map +1 -1
  10. package/dist/LaunchMsaView/components/NCBIBlastQuery/MsaAlgorithmSelect.d.ts +7 -0
  11. package/dist/LaunchMsaView/components/NCBIBlastQuery/MsaAlgorithmSelect.js +10 -0
  12. package/dist/LaunchMsaView/components/NCBIBlastQuery/MsaAlgorithmSelect.js.map +1 -0
  13. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js +23 -32
  14. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.js.map +1 -1
  15. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js +9 -15
  16. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.js.map +1 -1
  17. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.d.ts +3 -2
  18. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.js.map +1 -1
  19. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.d.ts +25 -0
  20. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.js.map +1 -1
  21. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js +22 -32
  22. package/dist/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.js.map +1 -1
  23. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js +2 -9
  24. package/dist/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.js.map +1 -1
  25. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +30 -29
  26. package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js.map +1 -1
  27. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.js +8 -6
  28. package/dist/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.js.map +1 -1
  29. package/dist/LaunchMsaView/components/SubmitCancelActions.d.ts +8 -0
  30. package/dist/LaunchMsaView/components/SubmitCancelActions.js +12 -0
  31. package/dist/LaunchMsaView/components/SubmitCancelActions.js.map +1 -0
  32. package/dist/LaunchMsaView/components/TranscriptSelector.d.ts +2 -2
  33. package/dist/LaunchMsaView/components/TranscriptSelector.js +2 -2
  34. package/dist/LaunchMsaView/components/TranscriptSelector.js.map +1 -1
  35. package/dist/LaunchMsaView/components/useSWRFeatureSequence.js +3 -13
  36. package/dist/LaunchMsaView/components/useSWRFeatureSequence.js.map +1 -1
  37. package/dist/LaunchMsaView/components/useTranscriptSelection.js +10 -12
  38. package/dist/LaunchMsaView/components/useTranscriptSelection.js.map +1 -1
  39. package/dist/LaunchMsaView/util.d.ts +4 -1
  40. package/dist/LaunchMsaView/util.js +29 -24
  41. package/dist/LaunchMsaView/util.js.map +1 -1
  42. package/dist/MsaViewPanel/model.d.ts +1 -0
  43. package/dist/jbrowse-plugin-msaview.umd.production.min.js +26 -25
  44. package/dist/jbrowse-plugin-msaview.umd.production.min.js.map +4 -4
  45. package/dist/{LaunchMsaView/components/PreLoadedMSA/consts.d.ts → utils/swrConfig.d.ts} +1 -1
  46. package/dist/{LaunchMsaView/components/PreLoadedMSA/consts.js → utils/swrConfig.js} +2 -2
  47. package/dist/utils/swrConfig.js.map +1 -0
  48. package/dist/version.d.ts +1 -1
  49. package/dist/version.js +1 -1
  50. package/package.json +10 -10
  51. package/src/LaunchMsaView/components/LaunchMsaViewDialog.tsx +9 -6
  52. package/src/LaunchMsaView/components/LaunchPanelContent.tsx +27 -0
  53. package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +28 -60
  54. package/src/LaunchMsaView/components/NCBIBlastQuery/CachedBlastResults.tsx +21 -33
  55. package/src/LaunchMsaView/components/NCBIBlastQuery/MsaAlgorithmSelect.tsx +37 -0
  56. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastAutomaticPanel.tsx +29 -75
  57. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastManualPanel.tsx +10 -31
  58. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastMethodSelector.tsx +5 -3
  59. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastPanel.tsx +5 -2
  60. package/src/LaunchMsaView/components/NCBIBlastQuery/NCBIBlastRIDPanel.tsx +28 -78
  61. package/src/LaunchMsaView/components/NCBIBlastQuery/useCachedBlastResults.ts +2 -10
  62. package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +34 -57
  63. package/src/LaunchMsaView/components/PreLoadedMSA/fetchMSAData.ts +17 -8
  64. package/src/LaunchMsaView/components/SubmitCancelActions.tsx +41 -0
  65. package/src/LaunchMsaView/components/TranscriptSelector.tsx +3 -3
  66. package/src/LaunchMsaView/components/useSWRFeatureSequence.ts +6 -15
  67. package/src/LaunchMsaView/components/useTranscriptSelection.ts +13 -15
  68. package/src/LaunchMsaView/util.ts +35 -25
  69. package/src/MsaViewPanel/util.ts +3 -3
  70. package/src/{LaunchMsaView/components/PreLoadedMSA/consts.ts → utils/swrConfig.ts} +1 -1
  71. package/src/version.ts +1 -1
  72. package/dist/LaunchMsaView/components/PreLoadedMSA/consts.js.map +0 -1
@@ -5,26 +5,24 @@ import { useFeatureSequence } from './useFeatureSequence'
5
5
 
6
6
  import type { Feature } from '@jbrowse/core/util'
7
7
 
8
- function featureInValidIds(feature: Feature, validIds: string[]): boolean {
9
- return validIds.some(id => featureMatchesId(feature, id))
10
- }
11
-
12
8
  function findValidSelection(
13
9
  currentId: string,
14
10
  options: Feature[],
15
11
  validIds: string[] | undefined,
16
12
  ): string | undefined {
17
- if (!validIds || validIds.length === 0) {
18
- return undefined
13
+ if (validIds && validIds.length > 0) {
14
+ const currentFeature = options.find(opt => getId(opt) === currentId)
15
+ const currentIsValid =
16
+ currentFeature &&
17
+ validIds.some(id => featureMatchesId(currentFeature, id))
18
+ if (currentFeature && !currentIsValid) {
19
+ const validOption = options.find(opt =>
20
+ validIds.some(id => featureMatchesId(opt, id)),
21
+ )
22
+ return validOption ? getId(validOption) : undefined
23
+ }
19
24
  }
20
-
21
- const currentFeature = options.find(opt => getId(opt) === currentId)
22
- if (!currentFeature || featureInValidIds(currentFeature, validIds)) {
23
- return undefined
24
- }
25
-
26
- const validOption = options.find(opt => featureInValidIds(opt, validIds))
27
- return validOption ? getId(validOption) : undefined
25
+ return undefined
28
26
  }
29
27
 
30
28
  export function useTranscriptSelection({
@@ -39,7 +37,7 @@ export function useTranscriptSelection({
39
37
  const options = useMemo(() => getSortedTranscriptFeatures(feature), [feature])
40
38
  const [selectedId, setSelectedId] = useState(() => getId(options[0]))
41
39
  const validatedSelectedId =
42
- findValidSelection(selectedId, options, validIds) || selectedId
40
+ findValidSelection(selectedId, options, validIds) ?? selectedId
43
41
  const selectedTranscript = options.find(
44
42
  val => getId(val) === validatedSelectedId,
45
43
  )
@@ -1,6 +1,19 @@
1
- import { sum } from '@jbrowse/core/util'
1
+ import { getContainingView, sum } from '@jbrowse/core/util'
2
2
 
3
- import type { Feature } from '@jbrowse/core/util'
3
+ import type { AbstractTrackModel, Feature } from '@jbrowse/core/util'
4
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
5
+
6
+ export function getLinearGenomeView(model: AbstractTrackModel) {
7
+ return getContainingView(model) as LinearGenomeViewModel
8
+ }
9
+
10
+ function uniqueDefined(vals: (string | undefined)[]): string[] {
11
+ return [...new Set(vals.filter((v): v is string => !!v))]
12
+ }
13
+
14
+ function joinDefined(sep: string, parts: (string | undefined)[]): string {
15
+ return parts.filter((p): p is string => !!p).join(sep)
16
+ }
4
17
 
5
18
  export function getTranscriptFeatures(feature: Feature) {
6
19
  // check if we are looking at a 'two-level' or 'three-level' feature by
@@ -42,16 +55,14 @@ export function getId(val?: Feature): string {
42
55
  }
43
56
 
44
57
  export function getMatchableIds(val?: Feature): string[] {
45
- if (!val) {
46
- return []
47
- }
48
- const ids = [
49
- val.id(),
50
- val.get('name'),
51
- val.get('id'),
52
- val.get('transcript_id'),
53
- ].filter((id): id is string => !!id)
54
- return [...new Set(ids)]
58
+ return val
59
+ ? uniqueDefined([
60
+ val.id(),
61
+ val.get('name'),
62
+ val.get('id'),
63
+ val.get('transcript_id'),
64
+ ])
65
+ : []
55
66
  }
56
67
 
57
68
  export function featureMatchesId(feature: Feature, id: string): boolean {
@@ -59,20 +70,20 @@ export function featureMatchesId(feature: Feature, id: string): boolean {
59
70
  }
60
71
 
61
72
  export function getTranscriptDisplayName(val?: Feature) {
62
- return val === undefined
63
- ? ''
64
- : [val.get('name'), val.get('id')].filter(f => !!f).join(' ')
73
+ return val ? joinDefined(' ', [val.get('name'), val.get('id')]) : ''
65
74
  }
66
75
 
67
76
  export function getGeneDisplayName(val?: Feature) {
68
- return val === undefined
69
- ? ''
70
- : [
77
+ return val
78
+ ? joinDefined(' ', [
71
79
  val.get('gene_name') ?? val.get('name'),
72
- val.get('id') ? `(${val.get('id')})` : '',
73
- ]
74
- .filter(f => !!f)
75
- .join(' ')
80
+ val.get('id') ? `(${val.get('id')})` : undefined,
81
+ ])
82
+ : ''
83
+ }
84
+
85
+ export function getBlastViewTitle(feature: Feature, transcript: Feature) {
86
+ return `BLAST - ${getGeneDisplayName(feature)} - ${getTranscriptDisplayName(transcript)}`
76
87
  }
77
88
 
78
89
  export function getSortedTranscriptFeatures(feature: Feature) {
@@ -87,12 +98,11 @@ export function cleanProteinSequence(seq: string) {
87
98
  }
88
99
 
89
100
  export function getGeneIdentifiers(feature: Feature): string[] {
90
- const ids = [
101
+ return uniqueDefined([
91
102
  feature.id(),
92
103
  feature.get('id'),
93
104
  feature.get('name'),
94
105
  feature.get('gene_id'),
95
106
  feature.get('gene_name'),
96
- ].filter((id): id is string => !!id)
97
- return [...new Set(ids)]
107
+ ])
98
108
  }
@@ -14,9 +14,9 @@ export function checkHovered(hovered: unknown): hovered is {
14
14
  }
15
15
 
16
16
  interface AssemblyManagerLike {
17
- get: (name: string) =>
18
- | { getCanonicalRefName: (r: string) => string | undefined }
19
- | undefined
17
+ get: (
18
+ name: string,
19
+ ) => { getCanonicalRefName: (r: string) => string | undefined } | undefined
20
20
  }
21
21
 
22
22
  export function getCanonicalRefName({
@@ -1,4 +1,4 @@
1
- export const swrFlags = {
1
+ export const staticSwrConfig = {
2
2
  revalidateOnFocus: false,
3
3
  revalidateOnReconnect: false,
4
4
  revalidateIfStale: false,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.4.2'
1
+ export const version = '2.4.4'
@@ -1 +0,0 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../../src/LaunchMsaView/components/PreLoadedMSA/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,iBAAiB,EAAE,KAAK;IACxB,qBAAqB,EAAE,KAAK;IAC5B,iBAAiB,EAAE,KAAK;IACxB,iBAAiB,EAAE,KAAK;IACxB,kBAAkB,EAAE,KAAK;IACzB,kBAAkB,EAAE,KAAK;CAC1B,CAAA"}