@jbrowse/plugin-hic 2.13.1 → 2.15.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.
@@ -70,7 +70,7 @@ class HicAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
70
70
  }
71
71
  statusCallback('');
72
72
  observer.complete();
73
- }, opts.signal); // eslint-disable-line @typescript-eslint/no-explicit-any
73
+ }, opts.signal);
74
74
  }
75
75
  // don't do feature stats estimation, similar to bigwigadapter
76
76
  async getMultiRegionFeatureDensityStats(_regions) {
@@ -28,7 +28,7 @@ export type ResultsSerialized = ServerSideResultsSerialized;
28
28
  export type ResultsDeserialized = ServerSideResultsDeserialized;
29
29
  export default class HicRenderer extends ServerSideRendererType {
30
30
  supportsSVG: boolean;
31
- makeImageData(ctx: CanvasRenderingContext2D, props: RenderArgsDeserializedWithFeatures): Promise<void>;
31
+ makeImageData(ctx: CanvasRenderingContext2D, props: RenderArgsDeserializedWithFeatures): Promise<undefined>;
32
32
  render(renderProps: RenderArgsDeserialized): Promise<{
33
33
  height: any;
34
34
  width: number;
@@ -11,9 +11,9 @@ const configuration_1 = require("@jbrowse/core/configuration");
11
11
  const dataAdapterCache_1 = require("@jbrowse/core/data_adapters/dataAdapterCache");
12
12
  const colord_1 = require("@jbrowse/core/util/colord");
13
13
  const rxjs_1 = require("rxjs");
14
- const d3_scale_1 = require("d3-scale");
15
- const d3_scale_chromatic_1 = require("d3-scale-chromatic");
16
- const d3_interpolate_1 = require("d3-interpolate");
14
+ const d3_scale_1 = require("@mui/x-charts-vendor/d3-scale");
15
+ const viridis_1 = __importDefault(require("./viridis"));
16
+ const d3_interpolate_1 = require("@mui/x-charts-vendor/d3-interpolate");
17
17
  class HicRenderer extends ServerSideRendererType_1.default {
18
18
  constructor() {
19
19
  super(...arguments);
@@ -21,7 +21,7 @@ class HicRenderer extends ServerSideRendererType_1.default {
21
21
  }
22
22
  async makeImageData(ctx, props) {
23
23
  const { features, config, bpPerPx, signal, resolution, sessionId, adapterConfig, useLogScale, colorScheme, regions, } = props;
24
- const [region] = regions;
24
+ const region = regions[0];
25
25
  const { dataAdapter } = await (0, dataAdapterCache_1.getAdapter)(this.pluginManager, sessionId, adapterConfig);
26
26
  const res = await dataAdapter.getResolution(bpPerPx / resolution);
27
27
  const width = (region.end - region.start) / bpPerPx;
@@ -54,7 +54,7 @@ class HicRenderer extends ServerSideRendererType_1.default {
54
54
  'rgb(128, 0, 38)',
55
55
  'rgb(0, 0, 0)',
56
56
  ]),
57
- viridis: d3_scale_chromatic_1.interpolateViridis,
57
+ viridis: viridis_1.default,
58
58
  };
59
59
  const m = useLogScale ? maxScore : maxScore / 20;
60
60
  // @ts-expect-error
@@ -85,10 +85,11 @@ class HicRenderer extends ServerSideRendererType_1.default {
85
85
  }
86
86
  ctx.restore();
87
87
  }
88
+ return undefined;
88
89
  }
89
90
  async render(renderProps) {
90
91
  const { config, regions, bpPerPx } = renderProps;
91
- const [region] = regions;
92
+ const region = regions[0];
92
93
  const width = (region.end - region.start) / bpPerPx;
93
94
  const height = (0, configuration_1.readConfObject)(config, 'maxHeight');
94
95
  const features = await this.getFeatures(renderProps);
@@ -120,7 +121,6 @@ class HicRenderer extends ServerSideRendererType_1.default {
120
121
  // cast to any to avoid return-type conflict, because the
121
122
  // types of features returned by our getFeatures are quite
122
123
  // different from the base interface
123
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
124
  return features;
125
125
  }
126
126
  }
@@ -21,7 +21,7 @@ const HicRenderer = (0, configuration_1.ConfigurationSchema)('HicRenderer', {
21
21
  color: {
22
22
  type: 'color',
23
23
  description: 'the color of each feature in a hic alignment',
24
- defaultValue: `jexl:interpolate(count,scale)`,
24
+ defaultValue: 'jexl:interpolate(count,scale)',
25
25
  contextVariable: ['count', 'maxScore', 'baseColor', 'scale'],
26
26
  },
27
27
  /**
@@ -0,0 +1,2 @@
1
+ declare const _default: (t: any) => any;
2
+ export default _default;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ // vendored from
4
+ // https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/viridis.js,
5
+ // license reproduced below
6
+ //
7
+ // Copyright 2010-2024 Mike Bostock
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ // Permission to use, copy, modify, and/or distribute this software for any purpose
10
+ // with or without fee is hereby granted, provided that the above copyright notice
11
+ // and this permission notice appear in all copies.
12
+ //
13
+ // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
+ // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
15
+ // FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
+ // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
17
+ // OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18
+ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
19
+ // THIS SOFTWARE.
20
+ function colors(specifier) {
21
+ const n = (specifier.length / 6) | 0;
22
+ const colors = new Array(n);
23
+ let i = 0;
24
+ while (i < n) {
25
+ colors[i] = `#${specifier.slice(i * 6, ++i * 6)}`;
26
+ }
27
+ return colors;
28
+ }
29
+ function ramp(range) {
30
+ const n = range.length;
31
+ return function (t) {
32
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
33
+ };
34
+ }
35
+ exports.default = ramp(colors('44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725'));
@@ -129,7 +129,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
129
129
  error: unknown;
130
130
  message: string | undefined;
131
131
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
132
- onHorizontalScroll?: Function;
132
+ onHorizontalScroll?: () => void;
133
133
  blockState?: Record<string, any>;
134
134
  }>;
135
135
  readonly DisplayBlurb: import("react").FC<{
@@ -105,7 +105,9 @@ function stateModelFactory(configSchema) {
105
105
  label: 'Use log scale',
106
106
  type: 'checkbox',
107
107
  checked: self.useLogScale,
108
- onClick: () => self.setUseLogScale(!self.useLogScale),
108
+ onClick: () => {
109
+ self.setUseLogScale(!self.useLogScale);
110
+ },
109
111
  },
110
112
  {
111
113
  label: 'Color scheme',
@@ -113,19 +115,27 @@ function stateModelFactory(configSchema) {
113
115
  subMenu: [
114
116
  {
115
117
  label: 'Fall',
116
- onClick: () => self.setColorScheme('fall'),
118
+ onClick: () => {
119
+ self.setColorScheme('fall');
120
+ },
117
121
  },
118
122
  {
119
123
  label: 'Viridis',
120
- onClick: () => self.setColorScheme('viridis'),
124
+ onClick: () => {
125
+ self.setColorScheme('viridis');
126
+ },
121
127
  },
122
128
  {
123
129
  label: 'Juicebox',
124
- onClick: () => self.setColorScheme('juicebox'),
130
+ onClick: () => {
131
+ self.setColorScheme('juicebox');
132
+ },
125
133
  },
126
134
  {
127
135
  label: 'Clear',
128
- onClick: () => self.setColorScheme(undefined),
136
+ onClick: () => {
137
+ self.setColorScheme(undefined);
138
+ },
129
139
  },
130
140
  ],
131
141
  },
@@ -134,11 +144,15 @@ function stateModelFactory(configSchema) {
134
144
  subMenu: [
135
145
  {
136
146
  label: 'Finer resolution',
137
- onClick: () => self.setResolution(self.resolution * 2),
147
+ onClick: () => {
148
+ self.setResolution(self.resolution * 2);
149
+ },
138
150
  },
139
151
  {
140
152
  label: 'Coarser resolution',
141
- onClick: () => self.setResolution(self.resolution / 2),
153
+ onClick: () => {
154
+ self.setResolution(self.resolution / 2);
155
+ },
142
156
  },
143
157
  ],
144
158
  },
@@ -64,7 +64,7 @@ export default class HicAdapter extends BaseFeatureDataAdapter {
64
64
  }
65
65
  statusCallback('');
66
66
  observer.complete();
67
- }, opts.signal); // eslint-disable-line @typescript-eslint/no-explicit-any
67
+ }, opts.signal);
68
68
  }
69
69
  // don't do feature stats estimation, similar to bigwigadapter
70
70
  async getMultiRegionFeatureDensityStats(_regions) {
@@ -28,7 +28,7 @@ export type ResultsSerialized = ServerSideResultsSerialized;
28
28
  export type ResultsDeserialized = ServerSideResultsDeserialized;
29
29
  export default class HicRenderer extends ServerSideRendererType {
30
30
  supportsSVG: boolean;
31
- makeImageData(ctx: CanvasRenderingContext2D, props: RenderArgsDeserializedWithFeatures): Promise<void>;
31
+ makeImageData(ctx: CanvasRenderingContext2D, props: RenderArgsDeserializedWithFeatures): Promise<undefined>;
32
32
  render(renderProps: RenderArgsDeserialized): Promise<{
33
33
  height: any;
34
34
  width: number;
@@ -6,9 +6,9 @@ import { readConfObject } from '@jbrowse/core/configuration';
6
6
  import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
7
7
  import { colord } from '@jbrowse/core/util/colord';
8
8
  import { firstValueFrom } from 'rxjs';
9
- import { scaleSequential, scaleSequentialLog } from 'd3-scale';
10
- import { interpolateViridis } from 'd3-scale-chromatic';
11
- import { interpolateRgbBasis } from 'd3-interpolate';
9
+ import { scaleSequential, scaleSequentialLog, } from '@mui/x-charts-vendor/d3-scale';
10
+ import interpolateViridis from './viridis';
11
+ import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
12
12
  export default class HicRenderer extends ServerSideRendererType {
13
13
  constructor() {
14
14
  super(...arguments);
@@ -16,7 +16,7 @@ export default class HicRenderer extends ServerSideRendererType {
16
16
  }
17
17
  async makeImageData(ctx, props) {
18
18
  const { features, config, bpPerPx, signal, resolution, sessionId, adapterConfig, useLogScale, colorScheme, regions, } = props;
19
- const [region] = regions;
19
+ const region = regions[0];
20
20
  const { dataAdapter } = await getAdapter(this.pluginManager, sessionId, adapterConfig);
21
21
  const res = await dataAdapter.getResolution(bpPerPx / resolution);
22
22
  const width = (region.end - region.start) / bpPerPx;
@@ -80,10 +80,11 @@ export default class HicRenderer extends ServerSideRendererType {
80
80
  }
81
81
  ctx.restore();
82
82
  }
83
+ return undefined;
83
84
  }
84
85
  async render(renderProps) {
85
86
  const { config, regions, bpPerPx } = renderProps;
86
- const [region] = regions;
87
+ const region = regions[0];
87
88
  const width = (region.end - region.start) / bpPerPx;
88
89
  const height = readConfObject(config, 'maxHeight');
89
90
  const features = await this.getFeatures(renderProps);
@@ -115,7 +116,6 @@ export default class HicRenderer extends ServerSideRendererType {
115
116
  // cast to any to avoid return-type conflict, because the
116
117
  // types of features returned by our getFeatures are quite
117
118
  // different from the base interface
118
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
119
119
  return features;
120
120
  }
121
121
  }
@@ -19,7 +19,7 @@ const HicRenderer = ConfigurationSchema('HicRenderer', {
19
19
  color: {
20
20
  type: 'color',
21
21
  description: 'the color of each feature in a hic alignment',
22
- defaultValue: `jexl:interpolate(count,scale)`,
22
+ defaultValue: 'jexl:interpolate(count,scale)',
23
23
  contextVariable: ['count', 'maxScore', 'baseColor', 'scale'],
24
24
  },
25
25
  /**
@@ -0,0 +1,2 @@
1
+ declare const _default: (t: any) => any;
2
+ export default _default;
@@ -0,0 +1,33 @@
1
+ // @ts-nocheck
2
+ // vendored from
3
+ // https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/viridis.js,
4
+ // license reproduced below
5
+ //
6
+ // Copyright 2010-2024 Mike Bostock
7
+ // Permission to use, copy, modify, and/or distribute this software for any purpose
8
+ // with or without fee is hereby granted, provided that the above copyright notice
9
+ // and this permission notice appear in all copies.
10
+ //
11
+ // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
12
+ // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
13
+ // FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
14
+ // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
15
+ // OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16
+ // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
17
+ // THIS SOFTWARE.
18
+ function colors(specifier) {
19
+ const n = (specifier.length / 6) | 0;
20
+ const colors = new Array(n);
21
+ let i = 0;
22
+ while (i < n) {
23
+ colors[i] = `#${specifier.slice(i * 6, ++i * 6)}`;
24
+ }
25
+ return colors;
26
+ }
27
+ function ramp(range) {
28
+ const n = range.length;
29
+ return function (t) {
30
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
31
+ };
32
+ }
33
+ export default ramp(colors('44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725'));
@@ -129,7 +129,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
129
129
  error: unknown;
130
130
  message: string | undefined;
131
131
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
132
- onHorizontalScroll?: Function;
132
+ onHorizontalScroll?: () => void;
133
133
  blockState?: Record<string, any>;
134
134
  }>;
135
135
  readonly DisplayBlurb: import("react").FC<{
@@ -102,7 +102,9 @@ export default function stateModelFactory(configSchema) {
102
102
  label: 'Use log scale',
103
103
  type: 'checkbox',
104
104
  checked: self.useLogScale,
105
- onClick: () => self.setUseLogScale(!self.useLogScale),
105
+ onClick: () => {
106
+ self.setUseLogScale(!self.useLogScale);
107
+ },
106
108
  },
107
109
  {
108
110
  label: 'Color scheme',
@@ -110,19 +112,27 @@ export default function stateModelFactory(configSchema) {
110
112
  subMenu: [
111
113
  {
112
114
  label: 'Fall',
113
- onClick: () => self.setColorScheme('fall'),
115
+ onClick: () => {
116
+ self.setColorScheme('fall');
117
+ },
114
118
  },
115
119
  {
116
120
  label: 'Viridis',
117
- onClick: () => self.setColorScheme('viridis'),
121
+ onClick: () => {
122
+ self.setColorScheme('viridis');
123
+ },
118
124
  },
119
125
  {
120
126
  label: 'Juicebox',
121
- onClick: () => self.setColorScheme('juicebox'),
127
+ onClick: () => {
128
+ self.setColorScheme('juicebox');
129
+ },
122
130
  },
123
131
  {
124
132
  label: 'Clear',
125
- onClick: () => self.setColorScheme(undefined),
133
+ onClick: () => {
134
+ self.setColorScheme(undefined);
135
+ },
126
136
  },
127
137
  ],
128
138
  },
@@ -131,11 +141,15 @@ export default function stateModelFactory(configSchema) {
131
141
  subMenu: [
132
142
  {
133
143
  label: 'Finer resolution',
134
- onClick: () => self.setResolution(self.resolution * 2),
144
+ onClick: () => {
145
+ self.setResolution(self.resolution * 2);
146
+ },
135
147
  },
136
148
  {
137
149
  label: 'Coarser resolution',
138
- onClick: () => self.setResolution(self.resolution / 2),
150
+ onClick: () => {
151
+ self.setResolution(self.resolution / 2);
152
+ },
139
153
  },
140
154
  ],
141
155
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-hic",
3
- "version": "2.13.1",
3
+ "version": "2.15.0",
4
4
  "description": "JBrowse 2 hic adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest plugins/hic",
27
+ "test": "cd ../..; jest --passWithNoTests plugins/hic",
28
28
  "prepublishOnly": "yarn test",
29
29
  "prepack": "yarn build && yarn useDist",
30
30
  "postpack": "yarn useSrc",
@@ -36,14 +36,13 @@
36
36
  "clean": "rimraf dist esm *.tsbuildinfo"
37
37
  },
38
38
  "dependencies": {
39
- "d3-interpolate": "^2.0.1",
40
- "d3-scale-chromatic": "^2.0.0",
39
+ "@mui/x-charts-vendor": "^7.12.0",
41
40
  "hic-straw": "^2.0.3"
42
41
  },
43
42
  "peerDependencies": {
44
43
  "@jbrowse/core": "^2.0.0",
45
44
  "@jbrowse/plugin-linear-genome-view": "^2.0.0",
46
- "@mui/material": "^5.0.0",
45
+ "@mui/material": "^6.0.0",
47
46
  "mobx": "^6.0.0",
48
47
  "mobx-react": "^9.0.0",
49
48
  "mobx-state-tree": "^5.0.0",
@@ -56,5 +55,5 @@
56
55
  "publishConfig": {
57
56
  "access": "public"
58
57
  },
59
- "gitHead": "fcebca71cc1d066654603e1a9accfa6c6d4f764d"
58
+ "gitHead": "87eeb1fbf8311dbf88d5e75b5a265f03beffdda8"
60
59
  }