@jbrowse/plugin-variants 4.1.1 → 4.1.3

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.
@@ -40,7 +40,7 @@ export default class LDRenderer extends ServerSideRendererType {
40
40
  ldData,
41
41
  regions,
42
42
  bpPerPx,
43
- stopToken: renderProps.stopToken,
43
+ stopTokenCheck: renderProps.stopTokenCheck,
44
44
  yScalar,
45
45
  useGenomicPositions,
46
46
  signedLD,
@@ -67,7 +67,7 @@ export default class LDRenderer extends ServerSideRendererType {
67
67
  return rpcResult(serialized, collectTransferables(serialized));
68
68
  }
69
69
  async getLDData(args) {
70
- const { regions, sessionId, adapterConfig, bpPerPx, ldMetric = 'r2', minorAlleleFrequencyFilter = 0.01, lengthCutoffFilter = Number.MAX_SAFE_INTEGER, hweFilterThreshold = 0.001, callRateFilter = 0, jexlFilters = [], signedLD = false, stopToken, } = args;
70
+ const { regions, sessionId, adapterConfig, bpPerPx, ldMetric = 'r2', minorAlleleFrequencyFilter = 0.01, lengthCutoffFilter = Number.MAX_SAFE_INTEGER, hweFilterThreshold = 0.001, callRateFilter = 0, jexlFilters = [], signedLD = false, stopTokenCheck, } = args;
71
71
  try {
72
72
  const adapterType = adapterConfig.type;
73
73
  if (adapterType === 'PlinkLDAdapter' ||
@@ -97,7 +97,7 @@ export default class LDRenderer extends ServerSideRendererType {
97
97
  callRateFilter,
98
98
  jexlFilters,
99
99
  signedLD,
100
- stopToken,
100
+ stopTokenCheck,
101
101
  },
102
102
  });
103
103
  }
@@ -1,6 +1,6 @@
1
1
  import type { LDFlatbushItem } from './types.ts';
2
2
  import type { LDMatrixResult } from '../VariantRPC/getLDMatrix.ts';
3
- import type { Region, StopToken } from '@jbrowse/core/util';
3
+ import type { LastStopTokenCheck, Region } from '@jbrowse/core/util';
4
4
  export interface MakeImageDataResult {
5
5
  flatbush: ArrayBufferLike;
6
6
  items: LDFlatbushItem[];
@@ -11,7 +11,7 @@ export interface MakeImageDataProps {
11
11
  ldData: LDMatrixResult;
12
12
  regions: Region[];
13
13
  bpPerPx: number;
14
- stopToken?: StopToken;
14
+ stopTokenCheck?: LastStopTokenCheck;
15
15
  yScalar: number;
16
16
  colorScheme?: string;
17
17
  useGenomicPositions?: boolean;
@@ -1,5 +1,5 @@
1
1
  import Flatbush from '@jbrowse/core/util/flatbush';
2
- import { checkStopToken2, checkStopToken, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
2
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
3
3
  import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
4
4
  import { scaleSequential } from '@mui/x-charts-vendor/d3-scale';
5
5
  const colorSchemes = {
@@ -59,14 +59,13 @@ const colorSchemes = {
59
59
  ]),
60
60
  };
61
61
  export function makeImageData(ctx, props) {
62
- const { ldData, regions, bpPerPx, stopToken, yScalar, useGenomicPositions = false, signedLD = false, } = props;
63
- const lastCheck = createStopTokenChecker(stopToken);
62
+ const { ldData, regions, bpPerPx, stopTokenCheck, yScalar, useGenomicPositions = false, signedLD = false, } = props;
64
63
  const { snps, ldValues, metric } = ldData;
65
64
  const n = snps.length;
66
65
  if (n === 0) {
67
66
  return undefined;
68
67
  }
69
- checkStopToken(stopToken);
68
+ checkStopToken2(stopTokenCheck);
70
69
  const region = regions[0];
71
70
  if (!region) {
72
71
  return undefined;
@@ -135,7 +134,7 @@ export function makeImageData(ctx, props) {
135
134
  snp2: snps[j],
136
135
  });
137
136
  ldIdx++;
138
- checkStopToken2(lastCheck);
137
+ checkStopToken2(stopTokenCheck);
139
138
  }
140
139
  }
141
140
  ctx.restore();
@@ -1,13 +1,12 @@
1
1
  import { updateStatus } from '@jbrowse/core/util';
2
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
2
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
3
3
  import { f2 } from "../shared/constants.js";
4
4
  import { drawColorAlleleCount, getAlleleColor, } from "../shared/drawAlleleCount.js";
5
5
  import { drawPhased } from "../shared/drawPhased.js";
6
6
  import { getFeaturesThatPassMinorAlleleFrequencyFilter } from "../shared/minorAlleleFrequencyUtils.js";
7
7
  function drawPhasedMode(drawCtx, mafs) {
8
- const { ctx, sources, startRow, endRow, h, w, scrollTop, splitCache, genotypesCache, stopToken, } = drawCtx;
8
+ const { ctx, sources, startRow, endRow, h, w, scrollTop, splitCache, genotypesCache, stopTokenCheck, } = drawCtx;
9
9
  const arr = [];
10
- const lastCheck = createStopTokenChecker(stopToken);
11
10
  for (let idx = 0, l = mafs.length; idx < l; idx++) {
12
11
  const { feature } = mafs[idx];
13
12
  const arr2 = [];
@@ -69,14 +68,13 @@ function drawPhasedMode(drawCtx, mafs) {
69
68
  }
70
69
  }
71
70
  arr.push(arr2);
72
- checkStopToken2(lastCheck);
71
+ checkStopToken2(stopTokenCheck);
73
72
  }
74
73
  return arr;
75
74
  }
76
75
  function drawAlleleCountMode(drawCtx, mafs) {
77
- const { ctx, sources, startRow, endRow, h, w, scrollTop, splitCache, stopToken, colorCache, genotypesCache, } = drawCtx;
76
+ const { ctx, sources, startRow, endRow, h, w, scrollTop, splitCache, stopTokenCheck, colorCache, genotypesCache, } = drawCtx;
78
77
  const arr = [];
79
- const lastCheck = createStopTokenChecker(stopToken);
80
78
  for (let idx = 0, l = mafs.length; idx < l; idx++) {
81
79
  const { feature, mostFrequentAlt } = mafs[idx];
82
80
  const arr2 = [];
@@ -123,21 +121,20 @@ function drawAlleleCountMode(drawCtx, mafs) {
123
121
  }
124
122
  }
125
123
  arr.push(arr2);
126
- checkStopToken2(lastCheck);
124
+ checkStopToken2(stopTokenCheck);
127
125
  }
128
126
  return arr;
129
127
  }
130
128
  export async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs, }) {
131
- const { renderingMode, minorAlleleFrequencyFilter, sources, features, stopToken, lengthCutoffFilter, rowHeight, scrollTop, statusCallback = () => { }, } = renderArgs;
129
+ const { renderingMode, minorAlleleFrequencyFilter, sources, features, stopTokenCheck, lengthCutoffFilter, rowHeight, scrollTop, statusCallback = () => { }, } = renderArgs;
132
130
  const h = rowHeight;
133
131
  const startRow = Math.floor(scrollTop / h);
134
132
  const endRow = Math.min(sources.length, Math.ceil((scrollTop + canvasHeight) / h));
135
- const lastCheck = createStopTokenChecker(stopToken);
136
133
  const genotypesCache = new Map();
137
134
  const colorCache = {};
138
135
  const splitCache = {};
139
136
  const mafs = await updateStatus('Calculating stats', statusCallback, () => getFeaturesThatPassMinorAlleleFrequencyFilter({
140
- lastCheck,
137
+ stopTokenCheck,
141
138
  features: features.values(),
142
139
  minorAlleleFrequencyFilter,
143
140
  lengthCutoffFilter,
@@ -157,7 +154,7 @@ export async function makeImageData({ ctx, canvasWidth, canvasHeight, renderArgs
157
154
  splitCache,
158
155
  colorCache,
159
156
  genotypesCache,
160
- stopToken,
157
+ stopTokenCheck,
161
158
  };
162
159
  const arr = await updateStatus('Drawing variant matrix', statusCallback, () => renderingMode === 'phased'
163
160
  ? drawPhasedMode(drawCtx, mafs)
@@ -1,14 +1,13 @@
1
1
  import { featureSpanPx, updateStatus } from '@jbrowse/core/util';
2
2
  import Flatbush from '@jbrowse/core/util/flatbush';
3
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
3
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
4
4
  import { f2 } from "../shared/constants.js";
5
5
  import { drawColorAlleleCount, getAlleleColor, } from "../shared/drawAlleleCount.js";
6
6
  import { drawPhased } from "../shared/drawPhased.js";
7
7
  import { getFeaturesThatPassMinorAlleleFrequencyFilter } from "../shared/minorAlleleFrequencyUtils.js";
8
8
  function drawPhasedMode(drawCtx, itemData, mafs) {
9
- const { ctx, sources, region, bpPerPx, startRow, endRow, h, drawH, scrollTop, splitCache, drawRef, genotypesCache, stopToken, } = drawCtx;
9
+ const { ctx, sources, region, bpPerPx, startRow, endRow, h, drawH, scrollTop, splitCache, drawRef, genotypesCache, stopTokenCheck, } = drawCtx;
10
10
  const { items, coords } = itemData;
11
- const lastCheck = createStopTokenChecker(stopToken);
12
11
  for (const { feature } of mafs) {
13
12
  const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
14
13
  const featureId = feature.id();
@@ -44,13 +43,12 @@ function drawPhasedMode(drawCtx, itemData, mafs) {
44
43
  }
45
44
  }
46
45
  }
47
- checkStopToken2(lastCheck);
46
+ checkStopToken2(stopTokenCheck);
48
47
  }
49
48
  }
50
49
  function drawAlleleCountMode(drawCtx, itemData, mafs, colorCache) {
51
- const { ctx, sources, region, bpPerPx, startRow, endRow, h, drawH, scrollTop, splitCache, drawRef, genotypesCache, stopToken, } = drawCtx;
50
+ const { ctx, sources, region, bpPerPx, startRow, endRow, h, drawH, scrollTop, splitCache, drawRef, genotypesCache, stopTokenCheck, } = drawCtx;
52
51
  const { items, coords } = itemData;
53
- const lastCheck = createStopTokenChecker(stopToken);
54
52
  for (const { mostFrequentAlt, feature } of mafs) {
55
53
  const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
56
54
  const featureId = feature.id();
@@ -78,13 +76,12 @@ function drawAlleleCountMode(drawCtx, itemData, mafs, colorCache) {
78
76
  }
79
77
  }
80
78
  }
81
- checkStopToken2(lastCheck);
79
+ checkStopToken2(stopTokenCheck);
82
80
  }
83
81
  }
84
82
  export async function makeImageData(ctx, props) {
85
- const { scrollTop, minorAlleleFrequencyFilter, sources, rowHeight, height: canvasHeight, features, regions, bpPerPx, renderingMode, stopToken, lengthCutoffFilter, referenceDrawingMode, statusCallback = () => { }, } = props;
83
+ const { scrollTop, minorAlleleFrequencyFilter, sources, rowHeight, height: canvasHeight, features, regions, bpPerPx, renderingMode, stopTokenCheck, lengthCutoffFilter, referenceDrawingMode, statusCallback = () => { }, } = props;
86
84
  const region = regions[0];
87
- const lastCheck = createStopTokenChecker(stopToken);
88
85
  const coords = [];
89
86
  const items = [];
90
87
  const colorCache = {};
@@ -96,7 +93,7 @@ export async function makeImageData(ctx, props) {
96
93
  const startRow = Math.floor(scrollTop / h);
97
94
  const endRow = Math.min(sources.length, Math.ceil((scrollTop + canvasHeight) / h));
98
95
  const mafs = await updateStatus('Calculating stats', statusCallback, () => getFeaturesThatPassMinorAlleleFrequencyFilter({
99
- lastCheck,
96
+ stopTokenCheck,
100
97
  features: features.values(),
101
98
  minorAlleleFrequencyFilter,
102
99
  lengthCutoffFilter,
@@ -116,7 +113,7 @@ export async function makeImageData(ctx, props) {
116
113
  splitCache,
117
114
  drawRef,
118
115
  genotypesCache,
119
- stopToken,
116
+ stopTokenCheck,
120
117
  };
121
118
  const itemData = { items, coords };
122
119
  await updateStatus('Drawing variants', statusCallback, () => {
@@ -1,11 +1,14 @@
1
1
  import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
2
+ import { createStopTokenChecker } from '@jbrowse/core/util/stopToken';
2
3
  import { getGenotypeMatrix } from "./getGenotypeMatrix.js";
3
4
  export class MultiVariantGetGenotypeMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
4
5
  name = 'MultiVariantGetGenotypeMatrix';
5
6
  async execute(args, rpcDriverClassName) {
7
+ const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
8
+ const stopTokenCheck = createStopTokenChecker(deserializedArgs.stopToken);
6
9
  return getGenotypeMatrix({
7
10
  pluginManager: this.pluginManager,
8
- args: await this.deserializeArguments(args, rpcDriverClassName),
11
+ args: { ...deserializedArgs, stopTokenCheck },
9
12
  });
10
13
  }
11
14
  }
@@ -8,6 +8,7 @@ export class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersA
8
8
  async execute(args, rpcDriverClassName) {
9
9
  const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
10
10
  const { lengthCutoffFilter, minorAlleleFrequencyFilter, regions, adapterConfig, stopToken, sessionId, } = deserializedArgs;
11
+ const stopTokenCheck = createStopTokenChecker(stopToken);
11
12
  const { dataAdapter } = await getAdapter(this.pluginManager, sessionId, adapterConfig);
12
13
  const rawFeatures = await firstValueFrom(dataAdapter
13
14
  .getFeaturesInMultipleRegions(regions, deserializedArgs)
@@ -15,11 +16,10 @@ export class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersA
15
16
  const sampleInfo = {};
16
17
  const genotypesCache = new Map();
17
18
  let hasPhased = false;
18
- const lastCheck = createStopTokenChecker(stopToken);
19
19
  const features = getFeaturesThatPassMinorAlleleFrequencyFilter({
20
20
  minorAlleleFrequencyFilter,
21
21
  lengthCutoffFilter,
22
- lastCheck,
22
+ stopTokenCheck,
23
23
  features: rawFeatures,
24
24
  genotypesCache,
25
25
  });
@@ -47,7 +47,7 @@ export class MultiVariantGetSimplifiedFeatures extends RpcMethodTypeWithFiltersA
47
47
  isPhased: existing?.isPhased || isPhased,
48
48
  };
49
49
  }
50
- checkStopToken2(lastCheck);
50
+ checkStopToken2(stopTokenCheck);
51
51
  }
52
52
  return {
53
53
  hasPhased,
@@ -1,14 +1,17 @@
1
1
  import { clusterData, toNewick } from '@gmod/hclust';
2
+ import { createStopTokenChecker } from '@jbrowse/core/util/stopToken';
2
3
  import { getGenotypeMatrix } from "./getGenotypeMatrix.js";
3
4
  import { getPhasedGenotypeMatrix } from "./getPhasedGenotypeMatrix.js";
4
5
  export async function executeClusterGenotypeMatrix({ pluginManager, args, }) {
5
- const { renderingMode, sampleInfo } = args;
6
+ const { renderingMode, sampleInfo, stopToken } = args;
7
+ const stopTokenCheck = createStopTokenChecker(stopToken);
8
+ const argsWithCheck = { ...args, stopTokenCheck };
6
9
  const matrix = renderingMode === 'phased' && sampleInfo
7
10
  ? await getPhasedGenotypeMatrix({
8
11
  pluginManager,
9
- args: { ...args, sampleInfo },
12
+ args: { ...argsWithCheck, sampleInfo },
10
13
  })
11
- : await getGenotypeMatrix({ pluginManager, args });
14
+ : await getGenotypeMatrix({ pluginManager, args: argsWithCheck });
12
15
  const sampleLabels = Object.keys(matrix);
13
16
  const result = await clusterData({
14
17
  data: Object.values(matrix),
@@ -1,13 +1,12 @@
1
1
  import type { Source } from '../shared/types.ts';
2
2
  import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
- import type { Region } from '@jbrowse/core/util';
5
- import type { StopToken } from '@jbrowse/core/util/stopToken';
4
+ import type { LastStopTokenCheck, Region } from '@jbrowse/core/util';
6
5
  export declare function getGenotypeMatrix({ pluginManager, args, }: {
7
6
  pluginManager: PluginManager;
8
7
  args: {
9
8
  adapterConfig: AnyConfigurationModel;
10
- stopToken?: StopToken;
9
+ stopTokenCheck?: LastStopTokenCheck;
11
10
  sessionId: string;
12
11
  headers?: Record<string, string>;
13
12
  regions: Region[];
@@ -1,11 +1,10 @@
1
1
  import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
2
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
2
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
3
3
  import { firstValueFrom, toArray } from 'rxjs';
4
4
  import { getFeaturesThatPassMinorAlleleFrequencyFilter } from "../shared/minorAlleleFrequencyUtils.js";
5
5
  const SPLITTER = /[/|]/;
6
6
  export async function getGenotypeMatrix({ pluginManager, args, }) {
7
- const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, stopToken, } = args;
8
- const lastCheck = createStopTokenChecker(stopToken);
7
+ const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, stopTokenCheck, } = args;
9
8
  const adapter = await getAdapter(pluginManager, sessionId, adapterConfig);
10
9
  const dataAdapter = adapter.dataAdapter;
11
10
  const rows = Object.fromEntries(sources.map(s => [s.name, []]));
@@ -13,7 +12,7 @@ export async function getGenotypeMatrix({ pluginManager, args, }) {
13
12
  const mafs = getFeaturesThatPassMinorAlleleFrequencyFilter({
14
13
  minorAlleleFrequencyFilter,
15
14
  lengthCutoffFilter,
16
- lastCheck,
15
+ stopTokenCheck,
17
16
  splitCache,
18
17
  features: await firstValueFrom(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe(toArray())),
19
18
  });
@@ -42,7 +41,7 @@ export async function getGenotypeMatrix({ pluginManager, args, }) {
42
41
  : 1;
43
42
  rows[name].push(genotypeStatus);
44
43
  }
45
- checkStopToken2(lastCheck);
44
+ checkStopToken2(stopTokenCheck);
46
45
  }
47
46
  return rows;
48
47
  }
@@ -1,7 +1,6 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
- import type { Region } from '@jbrowse/core/util';
4
- import type { StopToken } from '@jbrowse/core/util/stopToken';
3
+ import type { LastStopTokenCheck, Region } from '@jbrowse/core/util';
5
4
  export type LDMetric = 'r2' | 'dprime';
6
5
  export interface FilterStats {
7
6
  totalVariants: number;
@@ -32,7 +31,7 @@ export declare function getLDMatrix({ pluginManager, args, }: {
32
31
  pluginManager: PluginManager;
33
32
  args: {
34
33
  adapterConfig: AnyConfigurationModel;
35
- stopToken?: StopToken;
34
+ stopTokenCheck?: LastStopTokenCheck;
36
35
  sessionId: string;
37
36
  headers?: Record<string, string>;
38
37
  regions: Region[];
@@ -1,6 +1,6 @@
1
1
  import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
2
2
  import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
3
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
3
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
4
4
  import { firstValueFrom, toArray } from 'rxjs';
5
5
  import { getFeaturesThatPassMinorAlleleFrequencyFilter } from "../shared/minorAlleleFrequencyUtils.js";
6
6
  const SPLITTER = /[/|]/;
@@ -206,8 +206,7 @@ function calculateLDStats(geno1, geno2, signedLD = false) {
206
206
  return { r2: signedLD ? r : r2, dprime };
207
207
  }
208
208
  export async function getLDMatrix({ pluginManager, args, }) {
209
- const { minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, hweFilterThreshold = 0.001, callRateFilter = 0, jexlFilters = [], stopToken, ldMetric = 'r2', signedLD = false, } = args;
210
- const lastCheck = createStopTokenChecker(stopToken);
209
+ const { minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, hweFilterThreshold = 0.001, callRateFilter = 0, jexlFilters = [], stopTokenCheck, ldMetric = 'r2', signedLD = false, } = args;
211
210
  const adapter = await getAdapter(pluginManager, sessionId, adapterConfig);
212
211
  const dataAdapter = adapter.dataAdapter;
213
212
  const sources = await dataAdapter.getSources(regions);
@@ -238,7 +237,7 @@ export async function getLDMatrix({ pluginManager, args, }) {
238
237
  const filteredFeatures = getFeaturesThatPassMinorAlleleFrequencyFilter({
239
238
  minorAlleleFrequencyFilter,
240
239
  lengthCutoffFilter,
241
- lastCheck,
240
+ stopTokenCheck,
242
241
  splitCache,
243
242
  features: rawFeatures,
244
243
  });
@@ -339,7 +338,7 @@ export async function getLDMatrix({ pluginManager, args, }) {
339
338
  if (dataIsPhased) {
340
339
  phasedHaplotypes.push(encodePhasedHaplotypes(genotypes, samples));
341
340
  }
342
- checkStopToken2(lastCheck);
341
+ checkStopToken2(stopTokenCheck);
343
342
  }
344
343
  const n = snps.length;
345
344
  const ldSize = (n * (n - 1)) / 2;
@@ -352,7 +351,7 @@ export async function getLDMatrix({ pluginManager, args, }) {
352
351
  : calculateLDStats(encodedGenotypes[i], encodedGenotypes[j], signedLD);
353
352
  ldValues[idx++] = ldMetric === 'dprime' ? stats.dprime : stats.r2;
354
353
  }
355
- checkStopToken2(lastCheck);
354
+ checkStopToken2(stopTokenCheck);
356
355
  }
357
356
  const filterStats = {
358
357
  totalVariants,
@@ -1,13 +1,12 @@
1
1
  import type { SampleInfo, Source } from '../shared/types.ts';
2
2
  import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
- import type { Region } from '@jbrowse/core/util';
5
- import type { StopToken } from '@jbrowse/core/util/stopToken';
4
+ import type { LastStopTokenCheck, Region } from '@jbrowse/core/util';
6
5
  export declare function getPhasedGenotypeMatrix({ pluginManager, args, }: {
7
6
  pluginManager: PluginManager;
8
7
  args: {
9
8
  adapterConfig: AnyConfigurationModel;
10
- stopToken?: StopToken;
9
+ stopTokenCheck?: LastStopTokenCheck;
11
10
  sessionId: string;
12
11
  headers?: Record<string, string>;
13
12
  regions: Region[];
@@ -1,10 +1,9 @@
1
1
  import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
2
- import { checkStopToken2, createStopTokenChecker, } from '@jbrowse/core/util/stopToken';
2
+ import { checkStopToken2 } from '@jbrowse/core/util/stopToken';
3
3
  import { firstValueFrom, toArray } from 'rxjs';
4
4
  import { getFeaturesThatPassMinorAlleleFrequencyFilter } from "../shared/minorAlleleFrequencyUtils.js";
5
5
  export async function getPhasedGenotypeMatrix({ pluginManager, args, }) {
6
- const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, stopToken, sampleInfo, } = args;
7
- const lastCheck = createStopTokenChecker(stopToken);
6
+ const { sources, minorAlleleFrequencyFilter, regions, adapterConfig, sessionId, lengthCutoffFilter, stopTokenCheck, sampleInfo, } = args;
8
7
  const adapter = await getAdapter(pluginManager, sessionId, adapterConfig);
9
8
  const dataAdapter = adapter.dataAdapter;
10
9
  const rows = {};
@@ -19,7 +18,7 @@ export async function getPhasedGenotypeMatrix({ pluginManager, args, }) {
19
18
  const mafs = getFeaturesThatPassMinorAlleleFrequencyFilter({
20
19
  minorAlleleFrequencyFilter,
21
20
  lengthCutoffFilter,
22
- lastCheck,
21
+ stopTokenCheck,
23
22
  splitCache,
24
23
  features: await firstValueFrom(dataAdapter.getFeaturesInMultipleRegions(regions, args).pipe(toArray())),
25
24
  });
@@ -44,7 +43,7 @@ export async function getPhasedGenotypeMatrix({ pluginManager, args, }) {
44
43
  }
45
44
  }
46
45
  }
47
- checkStopToken2(lastCheck);
46
+ checkStopToken2(stopTokenCheck);
48
47
  }
49
48
  return rows;
50
49
  }
@@ -3,11 +3,11 @@ import type { Feature, LastStopTokenCheck } from '@jbrowse/core/util';
3
3
  export declare function calculateAlleleCountsFast(feature: VcfFeature): Record<string, number>;
4
4
  export declare function calculateAlleleCounts(genotypes: Record<string, string>, cacheSplit: Record<string, string[]>): Record<string, number>;
5
5
  export declare function calculateMinorAlleleFrequency(alleleCounts: Record<string, number>): number;
6
- export declare function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, lastCheck, genotypesCache, splitCache, }: {
6
+ export declare function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopTokenCheck, genotypesCache, splitCache, }: {
7
7
  features: Iterable<Feature>;
8
8
  minorAlleleFrequencyFilter: number;
9
9
  lengthCutoffFilter: number;
10
- lastCheck?: LastStopTokenCheck;
10
+ stopTokenCheck?: LastStopTokenCheck;
11
11
  genotypesCache?: Map<string, Record<string, string>>;
12
12
  splitCache?: Record<string, string[]>;
13
13
  }): {
@@ -275,7 +275,7 @@ function getMostFrequentAlt(alleleCounts) {
275
275
  }
276
276
  return mostFrequentAlt;
277
277
  }
278
- export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, lastCheck, genotypesCache, splitCache = {}, }) {
278
+ export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopTokenCheck, genotypesCache, splitCache = {}, }) {
279
279
  const results = [];
280
280
  for (const feature of features) {
281
281
  if (feature.get('end') - feature.get('start') <= lengthCutoffFilter) {
@@ -301,7 +301,7 @@ export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorA
301
301
  });
302
302
  }
303
303
  }
304
- checkStopToken2(lastCheck);
304
+ checkStopToken2(stopTokenCheck);
305
305
  }
306
306
  return results;
307
307
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 variant adapters, tracks, etc.",
6
6
  "keywords": [
@@ -38,10 +38,10 @@
38
38
  "mobx": "^6.15.0",
39
39
  "mobx-react": "^9.2.1",
40
40
  "rxjs": "^7.8.2",
41
- "@jbrowse/core": "^4.1.1",
42
- "@jbrowse/plugin-linear-genome-view": "^4.1.1",
43
- "@jbrowse/sv-core": "^4.1.1",
44
- "@jbrowse/plugin-circular-view": "^4.1.1"
41
+ "@jbrowse/plugin-linear-genome-view": "^4.1.3",
42
+ "@jbrowse/core": "^4.1.3",
43
+ "@jbrowse/plugin-circular-view": "^4.1.3",
44
+ "@jbrowse/sv-core": "^4.1.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": ">=18.0.0"