@jbrowse/plugin-alignments 4.1.1 → 4.1.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 (52) hide show
  1. package/esm/AlignmentsFeatureDetail/configSchema.d.ts +1 -1
  2. package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +3 -3
  3. package/esm/AlignmentsTrack/configSchemaF.d.ts +8 -8
  4. package/esm/BamAdapter/configSchema.d.ts +4 -4
  5. package/esm/CramAdapter/configSchema.d.ts +2 -2
  6. package/esm/HtsgetBamAdapter/configSchema.d.ts +2 -2
  7. package/esm/LinearAlignmentsDisplay/configSchema.d.ts +3 -3
  8. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +22 -10
  9. package/esm/LinearPileupDisplay/configSchema.d.ts +6 -6
  10. package/esm/LinearPileupDisplay/model.d.ts +22 -10
  11. package/esm/LinearReadArcsDisplay/configSchema.d.ts +4 -4
  12. package/esm/LinearReadCloudDisplay/configSchema.d.ts +4 -4
  13. package/esm/LinearSNPCoverageDisplay/configSchema.d.ts +5 -5
  14. package/esm/LinearSNPCoverageDisplay/model.d.ts +12 -6
  15. package/esm/PileupRenderer/configSchema.d.ts +2 -2
  16. package/esm/PileupRenderer/makeImageData.js +3 -4
  17. package/esm/RenderLinearReadArcsDisplayRPC/drawFeatsRPC.d.ts +2 -1
  18. package/esm/RenderLinearReadArcsDisplayRPC/drawFeatsRPC.js +3 -4
  19. package/esm/RenderLinearReadArcsDisplayRPC/executeRenderLinearReadArcsDisplay.js +5 -4
  20. package/esm/RenderLinearReadCloudDisplayRPC/drawFeatsCommon.d.ts +2 -2
  21. package/esm/RenderLinearReadCloudDisplayRPC/drawFeatsCommon.js +3 -3
  22. package/esm/RenderLinearReadCloudDisplayRPC/drawLongReadChains.d.ts +3 -2
  23. package/esm/RenderLinearReadCloudDisplayRPC/drawLongReadChains.js +3 -4
  24. package/esm/RenderLinearReadCloudDisplayRPC/drawPairChains.d.ts +3 -2
  25. package/esm/RenderLinearReadCloudDisplayRPC/drawPairChains.js +4 -5
  26. package/esm/RenderLinearReadCloudDisplayRPC/executeRenderLinearReadCloudDisplay.js +5 -4
  27. package/esm/SNPCoverageAdapter/configSchema.d.ts +2 -2
  28. package/esm/SNPCoverageRenderer/buildClickMap.d.ts +5 -0
  29. package/esm/SNPCoverageRenderer/buildClickMap.js +17 -0
  30. package/esm/SNPCoverageRenderer/calculateModificationCounts.d.ts +1 -19
  31. package/esm/SNPCoverageRenderer/calculateModificationCounts.js +1 -6
  32. package/esm/SNPCoverageRenderer/configSchema.d.ts +2 -2
  33. package/esm/SNPCoverageRenderer/constants.d.ts +12 -0
  34. package/esm/SNPCoverageRenderer/constants.js +12 -0
  35. package/esm/SNPCoverageRenderer/createInterbaseItem.d.ts +7 -0
  36. package/esm/SNPCoverageRenderer/createInterbaseItem.js +13 -0
  37. package/esm/SNPCoverageRenderer/drawCrossHatches.d.ts +3 -0
  38. package/esm/SNPCoverageRenderer/drawCrossHatches.js +10 -0
  39. package/esm/SNPCoverageRenderer/drawNoncovEvents.d.ts +3 -0
  40. package/esm/SNPCoverageRenderer/drawNoncovEvents.js +56 -0
  41. package/esm/SNPCoverageRenderer/drawSecondPassMethylation.d.ts +2 -0
  42. package/esm/SNPCoverageRenderer/drawSecondPassMethylation.js +30 -0
  43. package/esm/SNPCoverageRenderer/drawSecondPassModifications.d.ts +6 -0
  44. package/esm/SNPCoverageRenderer/drawSecondPassModifications.js +85 -0
  45. package/esm/SNPCoverageRenderer/drawSecondPassSNPs.d.ts +2 -0
  46. package/esm/SNPCoverageRenderer/drawSecondPassSNPs.js +64 -0
  47. package/esm/SNPCoverageRenderer/drawStackedBars.d.ts +3 -0
  48. package/esm/SNPCoverageRenderer/drawStackedBars.js +10 -0
  49. package/esm/SNPCoverageRenderer/makeImage.d.ts +1 -1
  50. package/esm/SNPCoverageRenderer/makeImage.js +10 -306
  51. package/esm/SNPCoverageRenderer/types.d.ts +62 -1
  52. package/package.json +8 -8
@@ -37,6 +37,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
37
37
  statusMessage?: string;
38
38
  reactElement?: React.ReactElement;
39
39
  isRenderingPending?: boolean;
40
+ displayHeight?: number;
40
41
  };
41
42
  }) => import("react/jsx-runtime").JSX.Element;
42
43
  renderProps: any;
@@ -55,10 +56,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
55
56
  beforeDestroy(): void;
56
57
  } & {
57
58
  readonly statusMessage: any;
59
+ readonly displayHeight: number | undefined;
58
60
  } & {
59
61
  afterAttach(): void;
60
62
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
61
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
63
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
62
64
  maxFeatureScreenDensity: {
63
65
  type: string;
64
66
  description: string;
@@ -85,7 +87,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
85
87
  description: string;
86
88
  defaultValue: never[];
87
89
  };
88
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "displayId">>;
90
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
89
91
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
90
92
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
91
93
  } & {
@@ -152,6 +154,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
152
154
  statusMessage?: string;
153
155
  reactElement?: React.ReactElement;
154
156
  isRenderingPending?: boolean;
157
+ displayHeight?: number;
155
158
  };
156
159
  }) => import("react/jsx-runtime").JSX.Element;
157
160
  renderProps: any;
@@ -170,10 +173,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
170
173
  beforeDestroy(): void;
171
174
  } & {
172
175
  readonly statusMessage: any;
176
+ readonly displayHeight: number | undefined;
173
177
  } & {
174
178
  afterAttach(): void;
175
179
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
176
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
180
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
177
181
  maxFeatureScreenDensity: {
178
182
  type: string;
179
183
  description: string;
@@ -200,7 +204,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
200
204
  description: string;
201
205
  defaultValue: never[];
202
206
  };
203
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "displayId">>;
207
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
204
208
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
205
209
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
206
210
  } & {
@@ -267,6 +271,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
267
271
  statusMessage?: string;
268
272
  reactElement?: React.ReactElement;
269
273
  isRenderingPending?: boolean;
274
+ displayHeight?: number;
270
275
  };
271
276
  }) => import("react/jsx-runtime").JSX.Element;
272
277
  renderProps: any;
@@ -285,10 +290,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
285
290
  beforeDestroy(): void;
286
291
  } & {
287
292
  readonly statusMessage: any;
293
+ readonly displayHeight: number | undefined;
288
294
  } & {
289
295
  afterAttach(): void;
290
296
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
291
- configuration: import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaType<{
297
+ configuration: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
292
298
  maxFeatureScreenDensity: {
293
299
  type: string;
294
300
  description: string;
@@ -315,7 +321,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
315
321
  description: string;
316
322
  defaultValue: never[];
317
323
  };
318
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema.ts").ConfigurationSchemaOptions<undefined, "displayId">>;
324
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
319
325
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
320
326
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
321
327
  } & {
@@ -1,4 +1,4 @@
1
- declare const PileupRenderer: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const PileupRenderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  color: {
3
3
  type: string;
4
4
  description: string;
@@ -68,5 +68,5 @@ declare const PileupRenderer: import("node_modules/@jbrowse/core/src/configurati
68
68
  defaultValue: boolean;
69
69
  description: string;
70
70
  };
71
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
71
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
72
72
  export default PileupRenderer;
@@ -3,7 +3,7 @@ import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
3
3
  import { createJBrowseTheme } from '@jbrowse/core/ui';
4
4
  import { renderToAbstractCanvas } from '@jbrowse/core/util';
5
5
  import Flatbush from '@jbrowse/core/util/flatbush';
6
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
6
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
7
7
  import { layoutFeats } from "./layoutFeatures.js";
8
8
  import { renderAlignment } from "./renderers/renderAlignment.js";
9
9
  import { renderMismatchesCallback } from "./renderers/renderMismatchesCallback.js";
@@ -29,7 +29,7 @@ async function fetchRegionSequence(renderArgs, pluginManager) {
29
29
  });
30
30
  }
31
31
  function renderFeatures({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
32
- const { stopToken, config, showSoftClip, colorBy, theme: configTheme, } = renderArgs;
32
+ const { stopTokenCheck, config, showSoftClip, colorBy, theme: configTheme, } = renderArgs;
33
33
  const mismatchAlpha = readConfObject(config, 'mismatchAlpha');
34
34
  const minSubfeatureWidth = readConfObject(config, 'minSubfeatureWidth');
35
35
  const largeInsertionIndicatorScale = readConfObject(config, 'largeInsertionIndicatorScale');
@@ -46,7 +46,6 @@ function renderFeatures({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
46
46
  const drawIndels = shouldDrawIndels();
47
47
  const coords = [];
48
48
  const items = [];
49
- const lastCheck = createStopTokenChecker(stopToken);
50
49
  for (const feat of layoutRecords) {
51
50
  const alignmentRet = renderAlignment({
52
51
  ctx,
@@ -101,7 +100,7 @@ function renderFeatures({ ctx, layoutRecords, canvasWidth, renderArgs, }) {
101
100
  canvasWidth,
102
101
  });
103
102
  }
104
- checkStopToken2(lastCheck);
103
+ checkStopToken2(stopTokenCheck);
105
104
  }
106
105
  const flatbush = new Flatbush(Math.max(items.length, 1));
107
106
  if (coords.length) {
@@ -1,4 +1,5 @@
1
1
  import type { ChainData, ColorBy } from '../shared/types.ts';
2
+ import type { LastStopTokenCheck } from '@jbrowse/core/util';
2
3
  interface DrawFeatsRPCParams {
3
4
  ctx: CanvasRenderingContext2D;
4
5
  width: number;
@@ -18,7 +19,7 @@ interface DrawFeatsRPCParams {
18
19
  } | undefined;
19
20
  };
20
21
  offsetPx: number;
21
- stopToken?: string;
22
+ stopTokenCheck?: LastStopTokenCheck;
22
23
  }
23
24
  export declare function drawFeatsRPC(params: DrawFeatsRPCParams): void;
24
25
  export {};
@@ -1,4 +1,4 @@
1
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
1
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
2
2
  import { featurizeSA, getTag } from "../MismatchParser/index.js";
3
3
  import { drawVerticalLine, extractCoreFeat, extractCoreFeatBasic, filterAndSortLongReadChain, filterPairedChain, getMateInfo, getStrandRelativeFirstClipLength, jitter, toCoreFeat, toCoreFeatBasic, } from "../shared/arcUtils.js";
4
4
  import { getPairedInsertSizeAndOrientationColor, getPairedInsertSizeColor, getPairedOrientationColor, } from "../shared/color.js";
@@ -63,7 +63,7 @@ function drawBezierArc(ctx, startX, endX, destY, jitterVal) {
63
63
  ctx.stroke();
64
64
  }
65
65
  export function drawFeatsRPC(params) {
66
- const { ctx, height, chainData, colorBy, drawInter, drawLongRange, lineWidth, jitter: jitterVal, view, offsetPx, stopToken, } = params;
66
+ const { ctx, height, chainData, colorBy, drawInter, drawLongRange, lineWidth, jitter: jitterVal, view, offsetPx, stopTokenCheck, } = params;
67
67
  const { chains, stats } = chainData;
68
68
  const colorByType = colorBy.type;
69
69
  const hasPaired = hasPairedReads(chainData);
@@ -136,7 +136,6 @@ export function drawFeatsRPC(params) {
136
136
  draw(extractCoreFeat(filtered[i]), extractCoreFeatBasic(filtered[i + 1]), false);
137
137
  }
138
138
  }
139
- const lastCheck = createStopTokenChecker(stopToken);
140
139
  for (const chain of chains) {
141
140
  if (chain.length === 1 && drawLongRange) {
142
141
  const f = chain[0];
@@ -151,6 +150,6 @@ export function drawFeatsRPC(params) {
151
150
  else {
152
151
  drawMultiFeatureChain(chain);
153
152
  }
154
- checkStopToken2(lastCheck);
153
+ checkStopToken2(stopTokenCheck);
155
154
  }
156
155
  }
@@ -3,7 +3,7 @@ import { collectTransferables, dedupe, groupBy, max, min, renderToAbstractCanvas
3
3
  import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
4
4
  import Base1DView from '@jbrowse/core/util/Base1DViewModel';
5
5
  import { rpcResult } from '@jbrowse/core/util/librpc';
6
- import { checkStopToken } from '@jbrowse/core/util/stopToken';
6
+ import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
7
7
  import { getSnapshot } from '@jbrowse/mobx-state-tree';
8
8
  import { firstValueFrom } from 'rxjs';
9
9
  import { toArray } from 'rxjs/operators';
@@ -11,6 +11,7 @@ import { drawFeatsRPC } from "./drawFeatsRPC.js";
11
11
  import { getInsertSizeStats } from "../shared/insertSizeStats.js";
12
12
  export async function executeRenderLinearReadArcsDisplay({ pluginManager, args, }) {
13
13
  const { sessionId, view: viewSnapshot, adapterConfig, sequenceAdapter, colorBy, drawInter, drawLongRange, lineWidth, jitter, height, highResolutionScaling, exportSVG, statusCallback = () => { }, stopToken, } = args;
14
+ const stopTokenCheck = createStopTokenChecker(stopToken);
14
15
  const view = Base1DView.create(viewSnapshot);
15
16
  if (viewSnapshot.width) {
16
17
  view.setVolatileWidth(viewSnapshot.width);
@@ -39,7 +40,7 @@ export async function executeRenderLinearReadArcsDisplay({ pluginManager, args,
39
40
  dataAdapter.setSequenceAdapterConfig(sequenceAdapter);
40
41
  }
41
42
  const featuresArray = await updateStatus('Fetching alignments', statusCallback, () => firstValueFrom(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe(toArray())));
42
- checkStopToken(stopToken);
43
+ checkStopToken2(stopTokenCheck);
43
44
  const { chains, stats } = await updateStatus('Processing alignments', statusCallback, async () => {
44
45
  const deduped = dedupe(featuresArray, f => f.id());
45
46
  const filtered = deduped.filter(f => {
@@ -78,7 +79,7 @@ export async function executeRenderLinearReadArcsDisplay({ pluginManager, args,
78
79
  chains,
79
80
  stats,
80
81
  };
81
- checkStopToken(stopToken);
82
+ checkStopToken2(stopTokenCheck);
82
83
  const renderOpts = {
83
84
  highResolutionScaling,
84
85
  exportSVG,
@@ -96,7 +97,7 @@ export async function executeRenderLinearReadArcsDisplay({ pluginManager, args,
96
97
  jitter,
97
98
  view: viewSnap,
98
99
  offsetPx,
99
- stopToken,
100
+ stopTokenCheck,
100
101
  });
101
102
  return undefined;
102
103
  }));
@@ -3,7 +3,7 @@ import type { FlatbushItem } from '../PileupRenderer/types.ts';
3
3
  import type { FlatbushEntry } from '../shared/flatbushType.ts';
4
4
  import type { ChainData, ColorBy, ModificationTypeWithColor } from '../shared/types.ts';
5
5
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
6
- import type { Feature } from '@jbrowse/core/util';
6
+ import type { Feature, LastStopTokenCheck } from '@jbrowse/core/util';
7
7
  import type { BaseBlock } from '@jbrowse/core/util/blockTypes';
8
8
  import type { ThemeOptions } from '@mui/material';
9
9
  interface ViewForDrawing {
@@ -44,7 +44,7 @@ export interface DrawFeatsParams {
44
44
  regions: BaseBlock[];
45
45
  bpPerPx: number;
46
46
  canvasWidth: number;
47
- stopToken?: string;
47
+ stopTokenCheck?: LastStopTokenCheck;
48
48
  visibleModifications?: Record<string, ModificationTypeWithColor>;
49
49
  hideSmallIndels?: boolean;
50
50
  hideMismatches?: boolean;
@@ -176,7 +176,7 @@ export function addChainMouseoverRects(computedChains, chainYOffsets, featureHei
176
176
  }
177
177
  }
178
178
  export function drawFeatsCore({ ctx, params, view, calculateYOffsets, }) {
179
- const { chainData, featureHeight, colorBy, drawSingletons, drawProperPairs, flipStrandLongReadChains, stopToken, } = params;
179
+ const { chainData, featureHeight, colorBy, drawSingletons, drawProperPairs, flipStrandLongReadChains, stopTokenCheck, } = params;
180
180
  const type = colorBy.type || 'insertSizeAndOrientation';
181
181
  const { chains } = chainData;
182
182
  const filteredChains = filterChains(chains, drawSingletons, drawProperPairs, type, chainData);
@@ -210,7 +210,7 @@ export function drawFeatsCore({ ctx, params, view, calculateYOffsets, }) {
210
210
  bpPerPx: params.bpPerPx,
211
211
  colorBy: params.colorBy,
212
212
  visibleModifications: params.visibleModifications,
213
- stopToken,
213
+ stopTokenCheck,
214
214
  hideSmallIndels: params.hideSmallIndels,
215
215
  hideMismatches: params.hideMismatches,
216
216
  hideLargeIndels: params.hideLargeIndels,
@@ -231,7 +231,7 @@ export function drawFeatsCore({ ctx, params, view, calculateYOffsets, }) {
231
231
  bpPerPx: params.bpPerPx,
232
232
  colorBy: params.colorBy,
233
233
  visibleModifications: params.visibleModifications,
234
- stopToken,
234
+ stopTokenCheck,
235
235
  hideSmallIndels: params.hideSmallIndels,
236
236
  hideMismatches: params.hideMismatches,
237
237
  hideLargeIndels: params.hideLargeIndels,
@@ -2,9 +2,10 @@ import type { MismatchData } from './drawChainsUtil.ts';
2
2
  import type { ComputedChain } from './drawFeatsCommon.ts';
3
3
  import type { ChainData, ColorBy, ModificationTypeWithColor } from '../shared/types.ts';
4
4
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
+ import type { LastStopTokenCheck } from '@jbrowse/core/util';
5
6
  import type { BaseBlock } from '@jbrowse/core/util/blockTypes';
6
7
  import type { ThemeOptions } from '@mui/material';
7
- export declare function drawLongReadChains({ ctx, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, flipStrandLongReadChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopToken, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }: {
8
+ export declare function drawLongReadChains({ ctx, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, flipStrandLongReadChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopTokenCheck, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }: {
8
9
  ctx: CanvasRenderingContext2D;
9
10
  chainData: ChainData;
10
11
  chainYOffsets: Map<string, number>;
@@ -19,7 +20,7 @@ export declare function drawLongReadChains({ ctx, chainData, chainYOffsets, rend
19
20
  bpPerPx: number;
20
21
  colorBy: ColorBy;
21
22
  visibleModifications?: Record<string, ModificationTypeWithColor>;
22
- stopToken?: string;
23
+ stopTokenCheck?: LastStopTokenCheck;
23
24
  hideSmallIndels?: boolean;
24
25
  hideMismatches?: boolean;
25
26
  hideLargeIndels?: boolean;
@@ -1,17 +1,16 @@
1
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
1
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
2
2
  import { calculateFeaturePositionPx, featureOverlapsRegion, getChainBoundsOnRef, getConnectingLineColor, getMismatchRenderingConfig, getStrandColorKey, renderFeatureMismatchesAndModifications, renderFeatureShape, } from "./drawChainsUtil.js";
3
3
  import { lineToCtx } from "../shared/canvasUtils.js";
4
4
  import { fillColor, getSingletonColor, strokeColor } from "../shared/color.js";
5
5
  import { getPrimaryStrandFromFlags } from "../shared/primaryStrand.js";
6
- export function drawLongReadChains({ ctx, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, flipStrandLongReadChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopToken, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }) {
6
+ export function drawLongReadChains({ ctx, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, flipStrandLongReadChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopTokenCheck, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }) {
7
7
  const mismatchConfig = getMismatchRenderingConfig(ctx, config, configTheme, colorBy, { hideSmallIndels, hideMismatches, hideLargeIndels });
8
8
  const canvasWidth = region.widthPx;
9
9
  const regionStart = region.start;
10
10
  const allCoords = [];
11
11
  const allItems = [];
12
- const lastCheck = createStopTokenChecker(stopToken);
13
12
  for (const computedChain of computedChains) {
14
- checkStopToken2(lastCheck);
13
+ checkStopToken2(stopTokenCheck);
15
14
  const { id, chain, isPairedEnd, nonSupplementary } = computedChain;
16
15
  if (isPairedEnd) {
17
16
  continue;
@@ -2,9 +2,10 @@ import type { MismatchData } from './drawChainsUtil.ts';
2
2
  import type { ComputedChain } from './drawFeatsCommon.ts';
3
3
  import type { ChainData, ColorBy, ModificationTypeWithColor } from '../shared/types.ts';
4
4
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
5
+ import type { LastStopTokenCheck } from '@jbrowse/core/util';
5
6
  import type { BaseBlock } from '@jbrowse/core/util/blockTypes';
6
7
  import type { ThemeOptions } from '@mui/material';
7
- export declare function drawPairChains({ ctx, type, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopToken, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }: {
8
+ export declare function drawPairChains({ ctx, type, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopTokenCheck, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }: {
8
9
  ctx: CanvasRenderingContext2D;
9
10
  type: string;
10
11
  chainData: ChainData;
@@ -19,7 +20,7 @@ export declare function drawPairChains({ ctx, type, chainData, chainYOffsets, re
19
20
  bpPerPx: number;
20
21
  colorBy: ColorBy;
21
22
  visibleModifications?: Record<string, ModificationTypeWithColor>;
22
- stopToken?: string;
23
+ stopTokenCheck?: LastStopTokenCheck;
23
24
  hideSmallIndels?: boolean;
24
25
  hideMismatches?: boolean;
25
26
  hideLargeIndels?: boolean;
@@ -1,16 +1,15 @@
1
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
1
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
2
2
  import { calculateFeaturePositionPx, featureOverlapsRegion, getChainBoundsOnRef, getConnectingLineColor, getMismatchRenderingConfig, renderFeatureMismatchesAndModifications, renderFeatureShape, } from "./drawChainsUtil.js";
3
3
  import { lineToCtx } from "../shared/canvasUtils.js";
4
4
  import { fillColor, getPairedColor, strokeColor } from "../shared/color.js";
5
- export function drawPairChains({ ctx, type, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopToken, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }) {
5
+ export function drawPairChains({ ctx, type, chainData, chainYOffsets, renderChevrons, featureHeight, computedChains, config, theme: configTheme, region, regionStartPx, bpPerPx, colorBy, visibleModifications, stopTokenCheck, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, }) {
6
6
  const mismatchConfig = getMismatchRenderingConfig(ctx, config, configTheme, colorBy, { hideSmallIndels, hideMismatches, hideLargeIndels });
7
7
  const canvasWidth = region.widthPx;
8
8
  const regionStart = region.start;
9
9
  const allCoords = [];
10
10
  const allItems = [];
11
- const lastCheck = createStopTokenChecker(stopToken);
12
11
  for (const computedChain of computedChains) {
13
- checkStopToken2(lastCheck);
12
+ checkStopToken2(stopTokenCheck);
14
13
  const { id, chain, isPairedEnd, nonSupplementary } = computedChain;
15
14
  if (!isPairedEnd) {
16
15
  continue;
@@ -89,7 +88,7 @@ export function drawPairChains({ ctx, type, chainData, chainYOffsets, renderChev
89
88
  allItems,
90
89
  });
91
90
  }
92
- checkStopToken2(lastCheck);
91
+ checkStopToken2(stopTokenCheck);
93
92
  }
94
93
  return { coords: allCoords, items: allItems };
95
94
  }
@@ -3,7 +3,7 @@ import { collectTransferables, dedupe, groupBy, max, min, renderToAbstractCanvas
3
3
  import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
4
4
  import Base1DView from '@jbrowse/core/util/Base1DViewModel';
5
5
  import { rpcResult } from '@jbrowse/core/util/librpc';
6
- import { checkStopToken } from '@jbrowse/core/util/stopToken';
6
+ import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
7
7
  import { getSnapshot } from '@jbrowse/mobx-state-tree';
8
8
  import { firstValueFrom } from 'rxjs';
9
9
  import { toArray } from 'rxjs/operators';
@@ -13,6 +13,7 @@ import { calculateStackYOffsetsUtil } from "./drawFeatsStack.js";
13
13
  import { getInsertSizeStats } from "../shared/insertSizeStats.js";
14
14
  export async function executeRenderLinearReadCloudDisplay({ pluginManager, args, }) {
15
15
  const { sessionId, view: viewSnapshot, adapterConfig, sequenceAdapter, config, theme, featureHeight, noSpacing, drawCloud, colorBy, drawSingletons, drawProperPairs, flipStrandLongReadChains, trackMaxHeight, cloudModeHeight, highResolutionScaling, exportSVG, statusCallback = () => { }, stopToken, visibleModifications, hideSmallIndels, hideMismatches, hideLargeIndels, showOutline, } = args;
16
+ const stopTokenCheck = createStopTokenChecker(stopToken);
16
17
  const view = Base1DView.create(viewSnapshot);
17
18
  if (viewSnapshot.width) {
18
19
  view.setVolatileWidth(viewSnapshot.width);
@@ -45,7 +46,7 @@ export async function executeRenderLinearReadCloudDisplay({ pluginManager, args,
45
46
  dataAdapter.setSequenceAdapterConfig(sequenceAdapter);
46
47
  }
47
48
  const featuresArray = await updateStatus('Fetching alignments', statusCallback, () => firstValueFrom(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe(toArray())));
48
- checkStopToken(stopToken);
49
+ checkStopToken2(stopTokenCheck);
49
50
  const deduped = dedupe(featuresArray, f => f.id());
50
51
  const { chains, stats } = await updateStatus('Processing alignments', statusCallback, async () => {
51
52
  const tlens = [];
@@ -74,7 +75,7 @@ export async function executeRenderLinearReadCloudDisplay({ pluginManager, args,
74
75
  };
75
76
  });
76
77
  const chainData = { chains, stats };
77
- checkStopToken(stopToken);
78
+ checkStopToken2(stopTokenCheck);
78
79
  const { computedChains } = await updateStatus('Calculating layout', statusCallback, async () => {
79
80
  const filtered = filterChains(chains, drawSingletons, drawProperPairs, colorBy.type || 'insertSizeAndOrientation', chainData);
80
81
  const computed = computeChainBounds(filtered, viewSnap);
@@ -115,7 +116,7 @@ export async function executeRenderLinearReadCloudDisplay({ pluginManager, args,
115
116
  theme,
116
117
  regions,
117
118
  bpPerPx,
118
- stopToken,
119
+ stopTokenCheck,
119
120
  visibleModifications,
120
121
  hideSmallIndels,
121
122
  hideMismatches,
@@ -1,4 +1,4 @@
1
- declare const configSchema: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  subadapter: {
3
3
  type: string;
4
4
  defaultValue: null;
@@ -7,5 +7,5 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
7
7
  type: string;
8
8
  defaultValue: null;
9
9
  };
10
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
10
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
11
11
  export default configSchema;
@@ -0,0 +1,5 @@
1
+ import type { ClickMapItem } from './types.ts';
2
+ export declare function buildClickMap(coords: number[], items: ClickMapItem[]): {
3
+ flatbush: ArrayBufferLike;
4
+ items: ClickMapItem[];
5
+ };
@@ -0,0 +1,17 @@
1
+ import Flatbush from '@jbrowse/core/util/flatbush';
2
+ export function buildClickMap(coords, items) {
3
+ const flatbush = new Flatbush(Math.max(items.length, 1));
4
+ if (coords.length) {
5
+ for (let i = 0; i < coords.length; i += 4) {
6
+ flatbush.add(coords[i], coords[i + 1], coords[i + 2], coords[i + 3]);
7
+ }
8
+ }
9
+ else {
10
+ flatbush.add(0, 0);
11
+ }
12
+ flatbush.finish();
13
+ return {
14
+ flatbush: flatbush.data,
15
+ items,
16
+ };
17
+ }
@@ -1,20 +1,2 @@
1
- export interface StrandCounts {
2
- readonly entryDepth: number;
3
- readonly '1': number;
4
- readonly '-1': number;
5
- readonly '0': number;
6
- }
7
- export interface ModificationCountsParams {
8
- readonly base: string;
9
- readonly isSimplex: boolean;
10
- readonly refbase: string | undefined;
11
- readonly snps: Readonly<Record<string, Partial<StrandCounts>>>;
12
- readonly ref: StrandCounts;
13
- readonly score0: number;
14
- }
15
- interface ModificationCountsResult {
16
- readonly modifiable: number;
17
- readonly detectable: number;
18
- }
1
+ import type { ModificationCountsParams, ModificationCountsResult } from './types.ts';
19
2
  export declare function calculateModificationCounts({ base, isSimplex, refbase, snps, ref, score0, }: ModificationCountsParams): ModificationCountsResult;
20
- export {};
@@ -1,9 +1,4 @@
1
- const complementBase = {
2
- C: 'G',
3
- G: 'C',
4
- A: 'T',
5
- T: 'A',
6
- };
1
+ import { complementBase } from "./constants.js";
7
2
  export function calculateModificationCounts({ base, isSimplex, refbase, snps, ref, score0, }) {
8
3
  if (base === 'N') {
9
4
  return { modifiable: score0, detectable: score0 };
@@ -1,4 +1,4 @@
1
- declare const SNPCoverageRenderer: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
1
+ declare const SNPCoverageRenderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
2
2
  clipColor: {
3
3
  type: string;
4
4
  description: string;
@@ -29,5 +29,5 @@ declare const SNPCoverageRenderer: import("node_modules/@jbrowse/core/src/config
29
29
  description: string;
30
30
  defaultValue: string;
31
31
  };
32
- }, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
32
+ }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
33
33
  export default SNPCoverageRenderer;
@@ -0,0 +1,12 @@
1
+ export declare const INTERBASE_INDICATOR_WIDTH = 7;
2
+ export declare const INTERBASE_INDICATOR_HEIGHT = 4.5;
3
+ export declare const MINIMUM_INTERBASE_INDICATOR_READ_DEPTH = 7;
4
+ export declare const INTERBASE_DRAW_THRESHOLD = 0.1;
5
+ export declare const complementBase: {
6
+ readonly C: "G";
7
+ readonly G: "C";
8
+ readonly A: "T";
9
+ readonly T: "A";
10
+ };
11
+ export declare const fudgeFactor = 0.6;
12
+ export declare const SNP_CLICKMAP_THRESHOLD = 0.04;
@@ -0,0 +1,12 @@
1
+ export const INTERBASE_INDICATOR_WIDTH = 7;
2
+ export const INTERBASE_INDICATOR_HEIGHT = 4.5;
3
+ export const MINIMUM_INTERBASE_INDICATOR_READ_DEPTH = 7;
4
+ export const INTERBASE_DRAW_THRESHOLD = 0.1;
5
+ export const complementBase = {
6
+ C: 'G',
7
+ G: 'C',
8
+ A: 'T',
9
+ T: 'A',
10
+ };
11
+ export const fudgeFactor = 0.6;
12
+ export const SNP_CLICKMAP_THRESHOLD = 0.04;
@@ -0,0 +1,7 @@
1
+ import type { InterbaseIndicatorItem } from './types.ts';
2
+ export declare function createInterbaseItem(maxBase: string, count: number, total: number, start: number, maxEntry?: {
3
+ avgLength?: number;
4
+ minLength?: number;
5
+ maxLength?: number;
6
+ topSequence?: string;
7
+ }): InterbaseIndicatorItem;
@@ -0,0 +1,13 @@
1
+ export function createInterbaseItem(maxBase, count, total, start, maxEntry) {
2
+ return {
3
+ type: maxBase,
4
+ base: maxBase,
5
+ count,
6
+ total,
7
+ avgLength: maxEntry?.avgLength,
8
+ minLength: maxEntry?.minLength,
9
+ maxLength: maxEntry?.maxLength,
10
+ topSequence: maxEntry?.topSequence,
11
+ start,
12
+ };
13
+ }
@@ -0,0 +1,3 @@
1
+ export declare function drawCrossHatches(ctx: CanvasRenderingContext2D, ticks: {
2
+ values: number[];
3
+ }, width: number, toY: (n: number) => number): void;
@@ -0,0 +1,10 @@
1
+ export function drawCrossHatches(ctx, ticks, width, toY) {
2
+ ctx.lineWidth = 1;
3
+ ctx.strokeStyle = 'rgba(140,140,140,0.8)';
4
+ for (const tick of ticks.values) {
5
+ ctx.beginPath();
6
+ ctx.moveTo(0, Math.round(toY(tick)));
7
+ ctx.lineTo(width, Math.round(toY(tick)));
8
+ ctx.stroke();
9
+ }
10
+ }
@@ -0,0 +1,3 @@
1
+ import type { SecondPassContext } from './types.ts';
2
+ import type { BaseCoverageBin } from '../shared/types.ts';
3
+ export declare function drawNoncovEvents(passCtx: SecondPassContext, snpinfo: BaseCoverageBin, leftPx: number, score0: number, prevTotal: number, skipDraw: boolean, fstart: number): void;
@@ -0,0 +1,56 @@
1
+ import { INTERBASE_DRAW_THRESHOLD, INTERBASE_INDICATOR_HEIGHT, INTERBASE_INDICATOR_WIDTH, MINIMUM_INTERBASE_INDICATOR_READ_DEPTH, } from "./constants.js";
2
+ import { createInterbaseItem } from "./createInterbaseItem.js";
3
+ export function drawNoncovEvents(passCtx, snpinfo, leftPx, score0, prevTotal, skipDraw, fstart) {
4
+ const { ctx, colorMap, toHeight2, extraHorizontallyFlippedOffset, coords, items, bpPerPx, indicatorThreshold, showInterbaseCounts, showInterbaseIndicators, } = passCtx;
5
+ let totalCount = 0;
6
+ let maxDepth = 0;
7
+ let maxBase = '';
8
+ let totalHeight = 0;
9
+ const r = 0.6;
10
+ const x = leftPx - r + extraHorizontallyFlippedOffset;
11
+ for (const base in snpinfo.noncov) {
12
+ const { entryDepth } = snpinfo.noncov[base];
13
+ totalCount += entryDepth;
14
+ if (entryDepth > maxDepth) {
15
+ maxDepth = entryDepth;
16
+ maxBase = base;
17
+ }
18
+ }
19
+ const isSignificant = score0 > 0 && totalCount > score0 * INTERBASE_DRAW_THRESHOLD;
20
+ const showCounts = showInterbaseCounts && (!skipDraw || isSignificant);
21
+ if (showCounts) {
22
+ for (const base in snpinfo.noncov) {
23
+ const { entryDepth } = snpinfo.noncov[base];
24
+ const barHeight = toHeight2(entryDepth);
25
+ ctx.fillStyle = colorMap[base];
26
+ ctx.fillRect(x, INTERBASE_INDICATOR_HEIGHT + totalHeight, r * 2, barHeight);
27
+ totalHeight += barHeight;
28
+ }
29
+ }
30
+ if (totalCount > 0) {
31
+ const maxEntry = snpinfo.noncov[maxBase];
32
+ if (showCounts) {
33
+ if (bpPerPx < 50 || isSignificant) {
34
+ const clickWidth = Math.max(r * 2, 2);
35
+ coords.push(x, INTERBASE_INDICATOR_HEIGHT, x + clickWidth, INTERBASE_INDICATOR_HEIGHT + totalHeight);
36
+ items.push(createInterbaseItem(maxBase, totalCount, score0, fstart, maxEntry));
37
+ }
38
+ }
39
+ if (showInterbaseIndicators && (!skipDraw || isSignificant)) {
40
+ const indicatorComparatorScore = Math.max(score0, prevTotal);
41
+ if (totalCount > indicatorComparatorScore * indicatorThreshold &&
42
+ indicatorComparatorScore > MINIMUM_INTERBASE_INDICATOR_READ_DEPTH) {
43
+ ctx.fillStyle = colorMap[maxBase];
44
+ ctx.beginPath();
45
+ const l = leftPx + extraHorizontallyFlippedOffset;
46
+ ctx.moveTo(l - INTERBASE_INDICATOR_WIDTH / 2, 0);
47
+ ctx.lineTo(l + INTERBASE_INDICATOR_WIDTH / 2, 0);
48
+ ctx.lineTo(l, INTERBASE_INDICATOR_HEIGHT);
49
+ ctx.fill();
50
+ const hitboxPadding = 1;
51
+ coords.push(l - INTERBASE_INDICATOR_WIDTH / 2 - hitboxPadding, 0, l + INTERBASE_INDICATOR_WIDTH / 2 + hitboxPadding, INTERBASE_INDICATOR_HEIGHT + hitboxPadding);
52
+ items.push(createInterbaseItem(maxBase, totalCount, indicatorComparatorScore, fstart, maxEntry));
53
+ }
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,2 @@
1
+ import type { SecondPassContext, SecondPassStats } from './types.ts';
2
+ export declare function drawSecondPassMethylation(passCtx: SecondPassContext): SecondPassStats;