@jbrowse/plugin-alignments 2.13.1 → 2.14.0

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 (155) hide show
  1. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +5 -3
  2. package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.js +12 -4
  3. package/dist/AlignmentsFeatureDetail/Formatter.js +6 -2
  4. package/dist/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.js +4 -2
  5. package/dist/AlignmentsFeatureDetail/getSAFeatures.js +4 -4
  6. package/dist/AlignmentsFeatureDetail/launchBreakpointSplitView.js +2 -2
  7. package/dist/BamAdapter/BamAdapter.js +12 -18
  8. package/dist/BamAdapter/BamSlightlyLazyFeature.js +0 -1
  9. package/dist/CramAdapter/CramAdapter.d.ts +1 -1
  10. package/dist/CramAdapter/CramAdapter.js +7 -6
  11. package/dist/CramAdapter/CramTestAdapters.js +8 -2
  12. package/dist/GuessAlignmentsTypes/index.js +2 -2
  13. package/dist/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +2 -2
  14. package/dist/LinearAlignmentsDisplay/models/model.d.ts +13 -20
  15. package/dist/LinearAlignmentsDisplay/models/model.js +13 -3
  16. package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +7 -4
  17. package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +36 -21
  18. package/dist/LinearPileupDisplay/components/{ColorByModifications.js → ColorByModificationsDialog.js} +3 -1
  19. package/dist/LinearPileupDisplay/components/{ColorByTag.js → ColorByTagDialog.js} +4 -2
  20. package/dist/LinearPileupDisplay/components/GroupByDialog.d.ts +11 -0
  21. package/dist/LinearPileupDisplay/components/GroupByDialog.js +129 -0
  22. package/dist/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +1 -3
  23. package/dist/LinearPileupDisplay/components/{SetFeatureHeight.js → SetFeatureHeightDialog.js} +9 -3
  24. package/{esm/LinearPileupDisplay/components/SetMaxHeight.d.ts → dist/LinearPileupDisplay/components/SetMaxHeightDialog.d.ts} +1 -1
  25. package/dist/LinearPileupDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +6 -2
  26. package/dist/LinearPileupDisplay/components/{SortByTag.d.ts → SortByTagDialog.d.ts} +1 -1
  27. package/dist/LinearPileupDisplay/components/{SortByTag.js → SortByTagDialog.js} +7 -3
  28. package/dist/LinearPileupDisplay/configSchema.js +0 -1
  29. package/dist/LinearPileupDisplay/model.d.ts +58 -46
  30. package/dist/LinearPileupDisplay/model.js +69 -41
  31. package/dist/LinearReadArcsDisplay/components/ReactComponent.js +1 -0
  32. package/dist/LinearReadArcsDisplay/model.d.ts +2 -2
  33. package/dist/LinearReadArcsDisplay/model.js +37 -13
  34. package/dist/LinearReadCloudDisplay/components/ReactComponent.js +4 -1
  35. package/dist/LinearReadCloudDisplay/drawPairChains.js +3 -3
  36. package/dist/LinearReadCloudDisplay/model.d.ts +4 -8
  37. package/dist/LinearReadCloudDisplay/model.js +16 -6
  38. package/dist/LinearSNPCoverageDisplay/components/Tooltip.d.ts +1 -1
  39. package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
  40. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +1 -1
  41. package/dist/LinearSNPCoverageDisplay/models/model.js +15 -5
  42. package/dist/MismatchParser/index.js +11 -9
  43. package/dist/PileupRPC/base.d.ts +1 -1
  44. package/dist/PileupRPC/methods/GetGlobalValueForTag.d.ts +1 -1
  45. package/dist/PileupRPC/methods/GetReducedFeatures.d.ts +3 -3
  46. package/dist/PileupRPC/methods/GetVisibleModifications.d.ts +1 -1
  47. package/dist/PileupRenderer/PileupLayoutSession.d.ts +1 -1
  48. package/dist/PileupRenderer/PileupLayoutSession.js +3 -2
  49. package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
  50. package/dist/PileupRenderer/PileupRenderer.js +16 -13
  51. package/dist/PileupRenderer/colorBy.js +3 -5
  52. package/dist/PileupRenderer/components/PileupRendering.d.ts +1 -1
  53. package/dist/PileupRenderer/components/PileupRendering.js +65 -60
  54. package/dist/PileupRenderer/getAlignmentShapeColor.js +24 -16
  55. package/dist/PileupRenderer/layoutFeature.js +6 -1
  56. package/dist/PileupRenderer/layoutFeatures.js +1 -7
  57. package/dist/PileupRenderer/makeImageData.d.ts +1 -1
  58. package/dist/PileupRenderer/makeImageData.js +1 -0
  59. package/dist/PileupRenderer/renderAlignmentShape.js +1 -1
  60. package/dist/PileupRenderer/renderMismatches.js +1 -1
  61. package/dist/PileupRenderer/renderSoftClipping.js +1 -1
  62. package/dist/PileupRenderer/util.js +3 -5
  63. package/dist/SNPCoverageAdapter/generateCoverageBins.js +4 -10
  64. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +2 -2
  65. package/dist/SNPCoverageRenderer/SNPCoverageRenderer.js +2 -5
  66. package/dist/index.js +3 -1
  67. package/dist/shared/BaseDisplayComponent.js +3 -1
  68. package/dist/shared/{FilterByTag.js → FilterByTagDialog.js} +16 -6
  69. package/dist/shared/color.js +2 -2
  70. package/dist/shared/index.d.ts +24 -20
  71. package/dist/shared/index.js +4 -5
  72. package/dist/shared/renderSvg.js +1 -3
  73. package/dist/util.d.ts +1 -1
  74. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +5 -3
  75. package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.js +12 -4
  76. package/esm/AlignmentsFeatureDetail/Formatter.js +6 -2
  77. package/esm/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.js +4 -2
  78. package/esm/AlignmentsFeatureDetail/getSAFeatures.js +4 -4
  79. package/esm/AlignmentsFeatureDetail/launchBreakpointSplitView.js +2 -2
  80. package/esm/BamAdapter/BamAdapter.js +12 -18
  81. package/esm/BamAdapter/BamSlightlyLazyFeature.js +0 -1
  82. package/esm/CramAdapter/CramAdapter.d.ts +1 -1
  83. package/esm/CramAdapter/CramAdapter.js +7 -6
  84. package/esm/CramAdapter/CramTestAdapters.js +8 -2
  85. package/esm/GuessAlignmentsTypes/index.js +2 -2
  86. package/esm/LinearAlignmentsDisplay/components/AlignmentsDisplay.d.ts +2 -2
  87. package/esm/LinearAlignmentsDisplay/models/model.d.ts +13 -20
  88. package/esm/LinearAlignmentsDisplay/models/model.js +13 -3
  89. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +7 -4
  90. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +36 -21
  91. package/esm/LinearPileupDisplay/components/{ColorByModifications.js → ColorByModificationsDialog.js} +3 -1
  92. package/esm/LinearPileupDisplay/components/{ColorByTag.js → ColorByTagDialog.js} +4 -2
  93. package/esm/LinearPileupDisplay/components/GroupByDialog.d.ts +11 -0
  94. package/esm/LinearPileupDisplay/components/GroupByDialog.js +104 -0
  95. package/esm/LinearPileupDisplay/components/LinearPileupDisplayBlurb.js +1 -3
  96. package/esm/LinearPileupDisplay/components/{SetFeatureHeight.js → SetFeatureHeightDialog.js} +9 -3
  97. package/{dist/LinearPileupDisplay/components/SetMaxHeight.d.ts → esm/LinearPileupDisplay/components/SetMaxHeightDialog.d.ts} +1 -1
  98. package/esm/LinearPileupDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +6 -2
  99. package/esm/LinearPileupDisplay/components/{SortByTag.d.ts → SortByTagDialog.d.ts} +1 -1
  100. package/esm/LinearPileupDisplay/components/{SortByTag.js → SortByTagDialog.js} +7 -3
  101. package/esm/LinearPileupDisplay/configSchema.js +0 -1
  102. package/esm/LinearPileupDisplay/model.d.ts +58 -46
  103. package/esm/LinearPileupDisplay/model.js +69 -41
  104. package/esm/LinearReadArcsDisplay/components/ReactComponent.js +1 -0
  105. package/esm/LinearReadArcsDisplay/model.d.ts +2 -2
  106. package/esm/LinearReadArcsDisplay/model.js +37 -13
  107. package/esm/LinearReadCloudDisplay/components/ReactComponent.js +4 -1
  108. package/esm/LinearReadCloudDisplay/drawPairChains.js +3 -3
  109. package/esm/LinearReadCloudDisplay/model.d.ts +4 -8
  110. package/esm/LinearReadCloudDisplay/model.js +16 -6
  111. package/esm/LinearSNPCoverageDisplay/components/Tooltip.d.ts +1 -1
  112. package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +1 -1
  113. package/esm/LinearSNPCoverageDisplay/models/model.d.ts +1 -1
  114. package/esm/LinearSNPCoverageDisplay/models/model.js +15 -5
  115. package/esm/MismatchParser/index.js +11 -9
  116. package/esm/PileupRPC/base.d.ts +1 -1
  117. package/esm/PileupRPC/methods/GetGlobalValueForTag.d.ts +1 -1
  118. package/esm/PileupRPC/methods/GetReducedFeatures.d.ts +3 -3
  119. package/esm/PileupRPC/methods/GetVisibleModifications.d.ts +1 -1
  120. package/esm/PileupRenderer/PileupLayoutSession.d.ts +1 -1
  121. package/esm/PileupRenderer/PileupLayoutSession.js +3 -2
  122. package/esm/PileupRenderer/PileupRenderer.d.ts +1 -1
  123. package/esm/PileupRenderer/PileupRenderer.js +16 -13
  124. package/esm/PileupRenderer/colorBy.js +3 -5
  125. package/esm/PileupRenderer/components/PileupRendering.d.ts +1 -1
  126. package/esm/PileupRenderer/components/PileupRendering.js +65 -60
  127. package/esm/PileupRenderer/getAlignmentShapeColor.js +24 -16
  128. package/esm/PileupRenderer/layoutFeature.js +6 -1
  129. package/esm/PileupRenderer/layoutFeatures.js +1 -7
  130. package/esm/PileupRenderer/makeImageData.d.ts +1 -1
  131. package/esm/PileupRenderer/makeImageData.js +1 -0
  132. package/esm/PileupRenderer/renderAlignmentShape.js +1 -1
  133. package/esm/PileupRenderer/renderMismatches.js +1 -1
  134. package/esm/PileupRenderer/renderSoftClipping.js +1 -1
  135. package/esm/PileupRenderer/util.js +3 -5
  136. package/esm/SNPCoverageAdapter/generateCoverageBins.js +4 -10
  137. package/esm/SNPCoverageRenderer/SNPCoverageRenderer.d.ts +2 -2
  138. package/esm/SNPCoverageRenderer/SNPCoverageRenderer.js +2 -5
  139. package/esm/index.js +3 -1
  140. package/esm/shared/BaseDisplayComponent.js +3 -1
  141. package/esm/shared/{FilterByTag.js → FilterByTagDialog.js} +16 -6
  142. package/esm/shared/color.js +2 -2
  143. package/esm/shared/index.d.ts +24 -20
  144. package/esm/shared/index.js +4 -5
  145. package/esm/shared/renderSvg.js +1 -3
  146. package/esm/util.d.ts +1 -1
  147. package/package.json +4 -4
  148. /package/dist/LinearPileupDisplay/components/{ColorByModifications.d.ts → ColorByModificationsDialog.d.ts} +0 -0
  149. /package/dist/LinearPileupDisplay/components/{ColorByTag.d.ts → ColorByTagDialog.d.ts} +0 -0
  150. /package/dist/LinearPileupDisplay/components/{SetFeatureHeight.d.ts → SetFeatureHeightDialog.d.ts} +0 -0
  151. /package/dist/shared/{FilterByTag.d.ts → FilterByTagDialog.d.ts} +0 -0
  152. /package/esm/LinearPileupDisplay/components/{ColorByModifications.d.ts → ColorByModificationsDialog.d.ts} +0 -0
  153. /package/esm/LinearPileupDisplay/components/{ColorByTag.d.ts → ColorByTagDialog.d.ts} +0 -0
  154. /package/esm/LinearPileupDisplay/components/{SetFeatureHeight.d.ts → SetFeatureHeightDialog.d.ts} +0 -0
  155. /package/esm/shared/{FilterByTag.d.ts → FilterByTagDialog.d.ts} +0 -0
@@ -26,15 +26,21 @@ const BreakendOptionDialog = observer(function ({ model, handleClose, f1, f2, })
26
26
  const [mirror, setMirror] = useState(true);
27
27
  return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Breakpoint split view options" },
28
28
  React.createElement(DialogContent, null,
29
- React.createElement(Checkbox2, { checked: copyTracks, onChange: event => setCopyTracks(event.target.checked), label: "Copy tracks into the new view" }),
30
- React.createElement(Checkbox2, { checked: mirror, onChange: event => setMirror(event.target.checked), label: "Mirror tracks vertically in vertically stacked view" })),
29
+ React.createElement(Checkbox2, { checked: copyTracks, onChange: event => {
30
+ setCopyTracks(event.target.checked);
31
+ }, label: "Copy tracks into the new view" }),
32
+ React.createElement(Checkbox2, { checked: mirror, onChange: event => {
33
+ setMirror(event.target.checked);
34
+ }, label: "Mirror tracks vertically in vertically stacked view" })),
31
35
  React.createElement(DialogActions, null,
32
36
  React.createElement(Button, { onClick: () => {
33
37
  const { view } = model;
34
38
  const session = getSession(model);
35
39
  try {
36
40
  const viewSnapshot = getBreakpointSplitView({ view, f1, f2 });
37
- const [view1, view2] = viewSnapshot.views;
41
+ const views = viewSnapshot.views;
42
+ const view1 = views[0];
43
+ const view2 = views[1];
38
44
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
39
45
  const viewTracks = getSnapshot(view.tracks);
40
46
  session.addView('BreakpointSplitView', {
@@ -59,6 +65,8 @@ const BreakendOptionDialog = observer(function ({ model, handleClose, f1, f2, })
59
65
  }
60
66
  handleClose();
61
67
  }, variant: "contained", color: "primary", autoFocus: true }, "OK"),
62
- React.createElement(Button, { onClick: () => handleClose(), color: "secondary", variant: "contained" }, "Cancel"))));
68
+ React.createElement(Button, { onClick: () => {
69
+ handleClose();
70
+ }, color: "secondary", variant: "contained" }, "Cancel"))));
63
71
  });
64
72
  export default BreakendOptionDialog;
@@ -11,8 +11,12 @@ export default function Formatter({ value }) {
11
11
  React.createElement("button", { type: "button", onClick: () => {
12
12
  copy(display);
13
13
  setCopied(true);
14
- setTimeout(() => setCopied(false), 700);
14
+ setTimeout(() => {
15
+ setCopied(false);
16
+ }, 700);
15
17
  } }, copied ? 'Copied to clipboard' : 'Copy'),
16
- React.createElement("button", { type: "button", onClick: () => setShow(val => !val) }, show ? 'Show less' : 'Show more'),
18
+ React.createElement("button", { type: "button", onClick: () => {
19
+ setShow(val => !val);
20
+ } }, show ? 'Show less' : 'Show more'),
17
21
  React.createElement("div", null, show ? display : `${display.slice(0, 100)}...`))) : (React.createElement("div", null, display));
18
22
  }
@@ -9,7 +9,7 @@ export default function SuppAlignmentsLocStrings({ tag, model, }) {
9
9
  React.createElement("ul", null, tag
10
10
  .split(';')
11
11
  .filter(SA => !!SA)
12
- .map((SA, index) => {
12
+ .map((SA, idx) => {
13
13
  const [saRef, saStart, saStrand, saCigar] = SA.split(',');
14
14
  const saLength = getLengthOnRef(saCigar);
15
15
  const extra = Math.floor(saLength / 5);
@@ -21,7 +21,9 @@ export default function SuppAlignmentsLocStrings({ tag, model, }) {
21
21
  const displayStart = start.toLocaleString('en-US');
22
22
  const displayEnd = end.toLocaleString('en-US');
23
23
  const displayString = `${saRef}:${displayStart}-${displayEnd} (${saStrand}) [${saLength}bp]`;
24
- return (React.createElement("li", { key: `${locString}-${index}` },
24
+ return (
25
+ /* biome-ignore lint/suspicious/noArrayIndexKey: */
26
+ React.createElement("li", { key: `${locString}-${idx}` },
25
27
  React.createElement(Link, { href: "#", onClick: async (event) => {
26
28
  event.preventDefault();
27
29
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
@@ -9,9 +9,9 @@ export async function getSAFeatures({ view, feature, }) {
9
9
  const SA = getTag(feature, 'SA') || '';
10
10
  const readName = feature.get('name');
11
11
  const clipPos = getClip(cigar, 1);
12
- // get the canonical refname for the read because if the
13
- // read.get('refName') is chr1 and the actual fasta refName is 1 then no
14
- // tracks can be opened on the top panel of the linear read vs ref
12
+ // get the canonical refname for the read because if the read.get('refName')
13
+ // is chr1 and the actual fasta refName is 1 then no tracks can be opened on
14
+ // the top panel of the linear read vs ref
15
15
  const assembly = await assemblyManager.waitForAssembly(view.assemblyNames[0]);
16
16
  if (!assembly) {
17
17
  throw new Error('assembly not found');
@@ -27,7 +27,7 @@ export async function getSAFeatures({ view, feature, }) {
27
27
  };
28
28
  const features = [feat, ...suppAlns];
29
29
  features.forEach((f, idx) => {
30
- f.refName = (assembly === null || assembly === void 0 ? void 0 : assembly.getCanonicalRefName(f.refName)) || f.refName;
30
+ f.refName = assembly.getCanonicalRefName(f.refName) || f.refName;
31
31
  f.syntenyId = idx;
32
32
  f.mate.syntenyId = idx;
33
33
  f.mate.uniqueId = `${f.uniqueId}_mate`;
@@ -12,7 +12,7 @@ export function getBreakpointSplitView({ f1, f2, view, }) {
12
12
  const topRegion = assembly.regions.find(f => f.refName === f1.refName);
13
13
  const bottomRegion = assembly.regions.find(f => f.refName === f2.refName);
14
14
  if (!topRegion || !bottomRegion) {
15
- throw new Error(`unable to find the refName for the top or bottom of the breakpoint view`);
15
+ throw new Error('unable to find the refName for the top or bottom of the breakpoint view');
16
16
  }
17
17
  const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
18
18
  const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
@@ -41,6 +41,6 @@ export function getBreakpointSplitView({ f1, f2, view, }) {
41
41
  offsetPx: (bottomRegion.start + e) / bpPerPx,
42
42
  },
43
43
  ],
44
- displayName: `breakend split detail`,
44
+ displayName: 'breakend split detail',
45
45
  };
46
46
  }
@@ -8,8 +8,8 @@ import { firstValueFrom } from 'rxjs';
8
8
  // locals
9
9
  import BamSlightlyLazyFeature from './BamSlightlyLazyFeature';
10
10
  export default class BamAdapter extends BaseFeatureDataAdapter {
11
- // derived classes may not use the same configuration so a custom
12
- // configure method allows derived classes to override this behavior
11
+ // derived classes may not use the same configuration so a custom configure
12
+ // method allows derived classes to override this behavior
13
13
  async configurePre() {
14
14
  const bamLocation = this.getConf('bamLocation');
15
15
  const location = this.getConf(['index', 'location']);
@@ -20,10 +20,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
20
20
  bamFilehandle: openLocation(bamLocation, pm),
21
21
  csiFilehandle: csi ? openLocation(location, pm) : undefined,
22
22
  baiFilehandle: !csi ? openLocation(location, pm) : undefined,
23
- // chunkSizeLimit and fetchSizeLimit are more troublesome than
24
- // helpful, and have given overly large values on the ultra long
25
- // nanopore reads even with 500MB limits, so disabled with infinity
26
- yieldThreadTime: Infinity,
23
+ yieldThreadTime: Number.POSITIVE_INFINITY,
27
24
  });
28
25
  const adapterConfig = this.getConf('sequenceAdapter');
29
26
  if (adapterConfig && this.getSubAdapter) {
@@ -33,13 +30,11 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
33
30
  sequenceAdapter: dataAdapter,
34
31
  };
35
32
  }
36
- else {
37
- return { bam };
38
- }
33
+ return { bam };
39
34
  }
40
35
  async configure() {
41
36
  if (!this.configureP) {
42
- this.configureP = this.configurePre().catch(e => {
37
+ this.configureP = this.configurePre().catch((e) => {
43
38
  this.configureP = undefined;
44
39
  throw e;
45
40
  });
@@ -74,7 +69,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
74
69
  }
75
70
  async setup(opts) {
76
71
  if (!this.setupP) {
77
- this.setupP = this.setupPre(opts).catch(e => {
72
+ this.setupP = this.setupPre(opts).catch((e) => {
78
73
  this.setupP = undefined;
79
74
  throw e;
80
75
  });
@@ -137,10 +132,11 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
137
132
  continue;
138
133
  }
139
134
  if (tagFilter) {
140
- const v = record.get(tagFilter.tag);
141
- if (!(tagFilter.value === '*'
142
- ? v !== undefined
143
- : `${v}` === tagFilter.value)) {
135
+ const readVal = record.get(tagFilter.tag);
136
+ const filterVal = tagFilter.value;
137
+ if (filterVal === '*'
138
+ ? readVal !== undefined
139
+ : `${readVal}` !== `${filterVal}`) {
144
140
  continue;
145
141
  }
146
142
  }
@@ -161,9 +157,7 @@ export default class BamAdapter extends BaseFeatureDataAdapter {
161
157
  const fetchSizeLimit = this.getConf('fetchSizeLimit');
162
158
  return { bytes, fetchSizeLimit };
163
159
  }
164
- else {
165
- return super.getMultiRegionFeatureDensityStats(regions, opts);
166
- }
160
+ return super.getMultiRegionFeatureDensityStats(regions, opts);
167
161
  }
168
162
  freeResources( /* { region } */) { }
169
163
  // depends on setup being called before the BAM constructor
@@ -60,7 +60,6 @@ export default class BamSlightlyLazyFeature {
60
60
  id() {
61
61
  return `${this.adapter.id}-${this.record.id()}`;
62
62
  }
63
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
64
63
  get(field) {
65
64
  const methodName = `_get_${field}`;
66
65
  // @ts-expect-error
@@ -29,7 +29,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
29
29
  getRefNames(opts?: BaseOptions): Promise<string[]>;
30
30
  refNameToId(refName: string): number | undefined;
31
31
  refIdToName(refId: number): string | undefined;
32
- refIdToOriginalName(refId: number): string;
32
+ refIdToOriginalName(refId: number): string | undefined;
33
33
  getFeatures(region: Region & {
34
34
  originalRefName?: string;
35
35
  }, opts?: BaseOptions & {
@@ -39,7 +39,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
39
39
  }
40
40
  async configure() {
41
41
  if (!this.configureP) {
42
- this.configureP = this.configurePre().catch(e => {
42
+ this.configureP = this.configurePre().catch((e) => {
43
43
  this.configureP = undefined;
44
44
  throw e;
45
45
  });
@@ -113,7 +113,7 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
113
113
  }
114
114
  async setup(opts) {
115
115
  if (!this.setupP) {
116
- this.setupP = this.setupPre(opts).catch(e => {
116
+ this.setupP = this.setupPre(opts).catch((e) => {
117
117
  this.setupP = undefined;
118
118
  throw e;
119
119
  });
@@ -172,12 +172,13 @@ export default class CramAdapter extends BaseFeatureDataAdapter {
172
172
  continue;
173
173
  }
174
174
  if (tagFilter) {
175
- const v = tagFilter.tag === 'RG'
175
+ const readVal = tagFilter.tag === 'RG'
176
176
  ? (_a = samHeader.readGroups) === null || _a === void 0 ? void 0 : _a[record.readGroupId]
177
177
  : record.tags[tagFilter.tag];
178
- if (!(tagFilter.value === '*'
179
- ? v !== undefined
180
- : `${v}` === tagFilter.value)) {
178
+ const filterVal = tagFilter.value;
179
+ if (filterVal === '*'
180
+ ? readVal !== undefined
181
+ : `${readVal}` !== `${filterVal}`) {
181
182
  continue;
182
183
  }
183
184
  }
@@ -12,7 +12,11 @@ export function parseSmallFasta(text) {
12
12
  const [id, ...descriptionLines] = defLine.split(' ');
13
13
  const description = descriptionLines.join(' ');
14
14
  const sequence = seqLines.join('').replaceAll(/\s/g, '');
15
- return { id, description, sequence };
15
+ return {
16
+ id: id,
17
+ description,
18
+ sequence,
19
+ };
16
20
  });
17
21
  }
18
22
  export class FetchableSmallFasta {
@@ -63,7 +67,9 @@ export class SequenceAdapter extends BaseFeatureDataAdapter {
63
67
  }));
64
68
  observer.complete();
65
69
  })
66
- .catch(e => observer.error(e));
70
+ .catch((e) => {
71
+ observer.error(e);
72
+ });
67
73
  return { unsubscribe: () => { } };
68
74
  });
69
75
  }
@@ -13,7 +13,7 @@ export default function GuessAlignmentsTypesF(pluginManager) {
13
13
  if (regexGuess.test(fileName) && !adapterHint) {
14
14
  return obj;
15
15
  }
16
- else if (adapterHint === adapterName) {
16
+ if (adapterHint === adapterName) {
17
17
  return obj;
18
18
  }
19
19
  return adapterGuesser(file, index, adapterHint);
@@ -36,7 +36,7 @@ export default function GuessAlignmentsTypesF(pluginManager) {
36
36
  if (regexGuess.test(fileName) && !adapterHint) {
37
37
  return obj;
38
38
  }
39
- else if (adapterHint === adapterName) {
39
+ if (adapterHint === adapterName) {
40
40
  return obj;
41
41
  }
42
42
  return adapterGuesser(file, index, adapterHint);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { AlignmentsDisplayModel } from '../models/model';
2
+ import { LinearAlignmentsDisplayModel } from '../models/model';
3
3
  declare const AlignmentsDisplay: ({ model, }: {
4
- model: AlignmentsDisplayModel;
4
+ model: LinearAlignmentsDisplayModel;
5
5
  }) => React.JSX.Element | null;
6
6
  export default AlignmentsDisplay;
@@ -4,6 +4,7 @@ import { AnyConfigurationModel, AnyConfigurationSchemaType } from '@jbrowse/core
4
4
  import PluginManager from '@jbrowse/core/PluginManager';
5
5
  import { MenuItem } from '@jbrowse/core/ui';
6
6
  import { FeatureDensityStats } from '@jbrowse/core/data_adapters/BaseAdapter';
7
+ import { IFilter } from '../../shared';
7
8
  /**
8
9
  * #stateModel LinearAlignmentsDisplay
9
10
  * extends
@@ -46,7 +47,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
46
47
  error: unknown;
47
48
  message: string | undefined;
48
49
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
49
- onHorizontalScroll?: Function;
50
+ onHorizontalScroll?: () => void;
50
51
  blockState?: Record<string, any>;
51
52
  }>;
52
53
  readonly DisplayBlurb: React.FC<{
@@ -59,26 +60,14 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
59
60
  error: unknown;
60
61
  message: string | undefined;
61
62
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
62
- id: import("mobx-state-tree").IOptionalIType<import(
63
- /**
64
- * #action
65
- */
66
- "mobx-state-tree").ISimpleType<string>, [undefined]>;
67
- type: import("mobx-state-tree" /**
68
- * #getter
69
- */).ISimpleType<string>;
70
- rpcDriverName: import("mobx-state-tree" /**
71
- * #getter
72
- */).IMaybe<import("mobx-state-tree").ISimpleType<string>>;
63
+ id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
64
+ type: import("mobx-state-tree").ISimpleType<string>;
65
+ rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
73
66
  }, {
74
67
  rendererTypeName: string;
75
68
  error: unknown;
76
69
  message: string | undefined;
77
- }, import("mobx-state-tree")._NotCustomized, import(
78
- /**
79
- * #getter
80
- */
81
- "mobx-state-tree")._NotCustomized>>;
70
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
82
71
  }> | null;
83
72
  readonly adapterConfig: any;
84
73
  readonly parentTrack: any;
@@ -131,7 +120,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
131
120
  */
132
121
  readonly features: any;
133
122
  /**
134
- * #getter
123
+ * #getteralignmentsdisplaymodel
135
124
  */
136
125
  readonly DisplayBlurb: any;
137
126
  /**
@@ -159,6 +148,10 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
159
148
  * #action
160
149
  */
161
150
  setHeight(n: number): number;
151
+ /**
152
+ * #action
153
+ */
154
+ setFilterBy(filter: IFilter): void;
162
155
  /**
163
156
  * #action
164
157
  */
@@ -195,5 +188,5 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
195
188
  lowerPanelType: import("mobx-state-tree").IType<string | undefined, string, string>;
196
189
  }>>, import("mobx-state-tree")._NotCustomized>;
197
190
  export default stateModelFactory;
198
- export type AlignmentsDisplayStateModel = ReturnType<typeof stateModelFactory>;
199
- export type AlignmentsDisplayModel = Instance<AlignmentsDisplayStateModel>;
191
+ export type LinearAlignmentsDisplayStateModel = ReturnType<typeof stateModelFactory>;
192
+ export type LinearAlignmentsDisplayModel = Instance<LinearAlignmentsDisplayStateModel>;
@@ -111,7 +111,7 @@ function stateModelFactory(pluginManager, configSchema) {
111
111
  return self.PileupDisplay.features;
112
112
  },
113
113
  /**
114
- * #getter
114
+ * #getteralignmentsdisplaymodel
115
115
  */
116
116
  get DisplayBlurb() {
117
117
  var _a;
@@ -168,6 +168,13 @@ function stateModelFactory(pluginManager, configSchema) {
168
168
  self.heightPreConfig = Math.max(n, minDisplayHeight);
169
169
  return self.heightPreConfig;
170
170
  },
171
+ /**
172
+ * #action
173
+ */
174
+ setFilterBy(filter) {
175
+ self.PileupDisplay.setFilterBy(filter);
176
+ self.SNPCoverageDisplay.setFilterBy(filter);
177
+ },
171
178
  /**
172
179
  * #action
173
180
  */
@@ -239,7 +246,9 @@ function stateModelFactory(pluginManager, configSchema) {
239
246
  type: 'radio',
240
247
  label: d.displayName,
241
248
  checked: d.name === self.PileupDisplay.type,
242
- onClick: () => self.setLowerPanelType(d.name),
249
+ onClick: () => {
250
+ self.setLowerPanelType(d.name);
251
+ },
243
252
  }));
244
253
  return [
245
254
  ...superTrackMenuItems(),
@@ -255,7 +264,7 @@ function stateModelFactory(pluginManager, configSchema) {
255
264
  },
256
265
  {
257
266
  type: 'subMenu',
258
- label: `Replace lower panel with...`,
267
+ label: 'Replace lower panel with...',
259
268
  subMenu: extra,
260
269
  },
261
270
  ];
@@ -263,6 +272,7 @@ function stateModelFactory(pluginManager, configSchema) {
263
272
  };
264
273
  })
265
274
  .preProcessSnapshot(snap => {
275
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
266
276
  if (!snap) {
267
277
  return snap;
268
278
  }
@@ -138,7 +138,7 @@ export declare function SharedLinearPileupDisplayMixin(configSchema: AnyConfigur
138
138
  readName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
139
139
  tagFilter: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IModelType<{
140
140
  tag: import("mobx-state-tree").ISimpleType<string>;
141
- value: import("mobx-state-tree").ISimpleType<string>;
141
+ value: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
142
142
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
143
143
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
144
144
  /**
@@ -168,7 +168,7 @@ export declare function SharedLinearPileupDisplayMixin(configSchema: AnyConfigur
168
168
  error: unknown;
169
169
  message: string | undefined;
170
170
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
171
- onHorizontalScroll?: Function;
171
+ onHorizontalScroll?: () => void;
172
172
  blockState?: Record<string, any>;
173
173
  }>;
174
174
  readonly DisplayBlurb: import("react").FC<{
@@ -181,7 +181,9 @@ export declare function SharedLinearPileupDisplayMixin(configSchema: AnyConfigur
181
181
  error: unknown;
182
182
  message: string | undefined;
183
183
  } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
184
- id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
184
+ id: import("mobx-state-tree" /**
185
+ * #property
186
+ */).IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
185
187
  type: import("mobx-state-tree").ISimpleType<string>;
186
188
  rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
187
189
  }, {
@@ -284,7 +286,7 @@ export declare function SharedLinearPileupDisplayMixin(configSchema: AnyConfigur
284
286
  /**
285
287
  * #action
286
288
  */
287
- setMaxHeight(n: number): void;
289
+ setMaxHeight(n?: number): void;
288
290
  /**
289
291
  * #action
290
292
  */
@@ -417,6 +419,7 @@ export declare function SharedLinearPileupDisplayMixin(configSchema: AnyConfigur
417
419
  icon: import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
418
420
  muiName: string;
419
421
  };
422
+ priority: number;
420
423
  onClick: () => void;
421
424
  })[];
422
425
  } & {
@@ -16,11 +16,11 @@ import LinearPileupDisplayBlurb from './components/LinearPileupDisplayBlurb';
16
16
  import { getUniqueTagValues, FilterModel } from '../shared';
17
17
  import { createAutorun } from '../util';
18
18
  import { ColorByModel } from '../shared/color';
19
- // async
20
- const FilterByTagDialog = lazy(() => import('../shared/FilterByTag'));
21
- const ColorByTagDialog = lazy(() => import('./components/ColorByTag'));
22
- const SetFeatureHeightDialog = lazy(() => import('./components/SetFeatureHeight'));
23
- const SetMaxHeightDialog = lazy(() => import('./components/SetMaxHeight'));
19
+ // lazies
20
+ const FilterByTagDialog = lazy(() => import('../shared/FilterByTagDialog'));
21
+ const ColorByTagDialog = lazy(() => import('./components/ColorByTagDialog'));
22
+ const SetFeatureHeightDialog = lazy(() => import('./components/SetFeatureHeightDialog'));
23
+ const SetMaxHeightDialog = lazy(() => import('./components/SetMaxHeightDialog'));
24
24
  // using a map because it preserves order
25
25
  const rendererTypes = new Map([
26
26
  ['pileup', 'PileupRenderer'],
@@ -262,18 +262,14 @@ export function SharedLinearPileupDisplayMixin(configSchema) {
262
262
  icon: MenuOpenIcon,
263
263
  onClick: () => {
264
264
  self.clearFeatureSelection();
265
- if (feat) {
266
- self.selectFeature(feat);
267
- }
265
+ self.selectFeature(feat);
268
266
  },
269
267
  },
270
268
  {
271
269
  label: 'Copy info to clipboard',
272
270
  icon: ContentCopyIcon,
273
271
  onClick: () => {
274
- if (feat) {
275
- self.copyFeatureToClipboard(feat);
276
- }
272
+ self.copyFeatureToClipboard(feat);
277
273
  },
278
274
  },
279
275
  ]
@@ -366,27 +362,39 @@ export function SharedLinearPileupDisplayMixin(configSchema) {
366
362
  return [
367
363
  {
368
364
  label: 'Normal',
369
- onClick: () => self.setColorScheme({ type: 'normal' }),
365
+ onClick: () => {
366
+ self.setColorScheme({ type: 'normal' });
367
+ },
370
368
  },
371
369
  {
372
370
  label: 'Mapping quality',
373
- onClick: () => self.setColorScheme({ type: 'mappingQuality' }),
371
+ onClick: () => {
372
+ self.setColorScheme({ type: 'mappingQuality' });
373
+ },
374
374
  },
375
375
  {
376
376
  label: 'Strand',
377
- onClick: () => self.setColorScheme({ type: 'strand' }),
377
+ onClick: () => {
378
+ self.setColorScheme({ type: 'strand' });
379
+ },
378
380
  },
379
381
  {
380
382
  label: 'Per-base quality',
381
- onClick: () => self.setColorScheme({ type: 'perBaseQuality' }),
383
+ onClick: () => {
384
+ self.setColorScheme({ type: 'perBaseQuality' });
385
+ },
382
386
  },
383
387
  {
384
388
  label: 'Per-base lettering',
385
- onClick: () => self.setColorScheme({ type: 'perBaseLettering' }),
389
+ onClick: () => {
390
+ self.setColorScheme({ type: 'perBaseLettering' });
391
+ },
386
392
  },
387
393
  {
388
394
  label: 'First-of-pair strand',
389
- onClick: () => self.setColorScheme({ type: 'stranded' }),
395
+ onClick: () => {
396
+ self.setColorScheme({ type: 'stranded' });
397
+ },
390
398
  },
391
399
  {
392
400
  label: 'Color by tag...',
@@ -406,8 +414,9 @@ export function SharedLinearPileupDisplayMixin(configSchema) {
406
414
  return [
407
415
  ...superTrackMenuItems(),
408
416
  {
409
- label: 'Filter by',
417
+ label: 'Filter by...',
410
418
  icon: FilterListIcon,
419
+ priority: -1,
411
420
  onClick: () => {
412
421
  getSession(self).queueDialog(doneCallback => [
413
422
  FilterByTagDialog,
@@ -416,7 +425,8 @@ export function SharedLinearPileupDisplayMixin(configSchema) {
416
425
  },
417
426
  },
418
427
  {
419
- label: 'Set feature height',
428
+ label: 'Set feature height...',
429
+ priority: -1,
420
430
  subMenu: [
421
431
  {
422
432
  label: 'Normal',
@@ -471,7 +481,11 @@ export function SharedLinearPileupDisplayMixin(configSchema) {
471
481
  const { colorBy, tagsReady } = self;
472
482
  const { staticBlocks } = view;
473
483
  if ((colorBy === null || colorBy === void 0 ? void 0 : colorBy.tag) && !tagsReady) {
474
- const vals = await getUniqueTagValues(self, colorBy, staticBlocks);
484
+ const vals = await getUniqueTagValues({
485
+ self,
486
+ tag: colorBy.tag,
487
+ blocks: staticBlocks,
488
+ });
475
489
  self.updateColorTagMap(vals);
476
490
  }
477
491
  self.setTagsReady(true);
@@ -501,7 +515,8 @@ export function SharedLinearPileupDisplayMixin(configSchema) {
501
515
  // feature.id that was returned e.g. that the user hasn't
502
516
  // moused over to a new position during the async operation
503
517
  // above
504
- if (self.featureIdUnderMouse === (feature === null || feature === void 0 ? void 0 : feature.uniqueId)) {
518
+ if (feature &&
519
+ self.featureIdUnderMouse === feature.uniqueId) {
505
520
  self.setFeatureUnderMouse(new SimpleFeature(feature));
506
521
  }
507
522
  }
@@ -29,6 +29,8 @@ const ColorByModificationsDialog = observer(function ({ model, handleClose, }) {
29
29
  model.setColorScheme({ type: 'methylation' });
30
30
  handleClose();
31
31
  } }, "Methylation"),
32
- React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
32
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => {
33
+ handleClose();
34
+ } }, "Cancel")))));
33
35
  });
34
36
  export default ColorByModificationsDialog;
@@ -4,12 +4,14 @@ import { Button, DialogContent, DialogActions, TextField, Typography, } from '@m
4
4
  import { Dialog } from '@jbrowse/core/ui';
5
5
  const ColorByTagDialog = observer(function ({ model, handleClose, }) {
6
6
  const [tag, setTag] = useState('');
7
- const validTag = tag.match(/^[A-Za-z][A-Za-z0-9]$/);
7
+ const validTag = /^[A-Za-z][A-Za-z0-9]$/.exec(tag);
8
8
  return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Color by tag" },
9
9
  React.createElement(DialogContent, { style: { overflowX: 'hidden' } },
10
10
  React.createElement(Typography, null, "Enter tag to color by: "),
11
11
  React.createElement(Typography, { color: "textSecondary" }, "Examples: XS or TS for RNA-seq inferred read strand, ts (lower-case) for minimap2 read strand, HP for haplotype, RG for read group, etc."),
12
- React.createElement(TextField, { value: tag, onChange: event => setTag(event.target.value), placeholder: "Enter tag name", inputProps: { maxLength: 2 }, error: tag.length === 2 && !validTag, helperText: tag.length === 2 && !validTag ? 'Not a valid tag' : '', autoComplete: "off" }),
12
+ React.createElement(TextField, { value: tag, onChange: event => {
13
+ setTag(event.target.value);
14
+ }, placeholder: "Enter tag name", inputProps: { maxLength: 2 }, error: tag.length === 2 && !validTag, helperText: tag.length === 2 && !validTag ? 'Not a valid tag' : '', autoComplete: "off" }),
13
15
  React.createElement(DialogActions, null,
14
16
  React.createElement(Button, { variant: "contained", color: "primary", onClick: () => {
15
17
  model.setColorScheme({ type: 'tag', tag });
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { IAnyStateTreeNode } from 'mobx-state-tree';
3
+ import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
+ declare const GroupByTagDialog: (props: {
5
+ model: {
6
+ adapterConfig: AnyConfigurationModel;
7
+ configuration: AnyConfigurationModel;
8
+ } & IAnyStateTreeNode;
9
+ handleClose: () => void;
10
+ }) => React.JSX.Element;
11
+ export default GroupByTagDialog;