@jbrowse/plugin-alignments 2.16.0 → 2.16.1

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.
@@ -30,7 +30,7 @@ const react_1 = __importStar(require("react"));
30
30
  const material_1 = require("@mui/material");
31
31
  const mobx_react_1 = require("mobx-react");
32
32
  const clone_1 = __importDefault(require("clone"));
33
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
33
+ const FeatureDetails_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails"));
34
34
  // locals
35
35
  const util_1 = require("./util");
36
36
  const tagInfo_1 = require("./tagInfo");
@@ -49,7 +49,7 @@ const AlignmentsFeatureDetails = (0, mobx_react_1.observer)(function (props) {
49
49
  const SA = (0, util_1.getTag)('SA', feat);
50
50
  const { flags } = feat;
51
51
  return (react_1.default.createElement(material_1.Paper, { "data-testid": "alignment-side-drawer" },
52
- react_1.default.createElement(BaseFeatureDetail_1.FeatureDetails, { ...props, omit: omit,
52
+ react_1.default.createElement(FeatureDetails_1.default, { ...props, omit: omit,
53
53
  // @ts-expect-error
54
54
  descriptions: { ...tagInfo_1.tags, tags: tagInfo_1.tags }, feature: feat, formatter: (value, key) => key === 'next_segment_position' ? (react_1.default.createElement(PairLink_1.default, { model: model, locString: value })) : (react_1.default.createElement(Formatter_1.default, { value: value })) }),
55
55
  SA !== undefined ? (react_1.default.createElement(SupplementaryAlignments, { model: model, tag: SA, feature: feat })) : null,
@@ -7,7 +7,7 @@ exports.default = AlignmentFlags;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const material_1 = require("@mui/material");
9
9
  const mui_1 = require("tss-react/mui");
10
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
10
+ const BaseCard_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard"));
11
11
  const SimpleField_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/SimpleField"));
12
12
  const useStyles = (0, mui_1.makeStyles)()({
13
13
  compact: {
@@ -34,7 +34,7 @@ function AlignmentFlags(props) {
34
34
  const { classes } = useStyles();
35
35
  const { feature } = props;
36
36
  const { flags } = feature;
37
- return (react_1.default.createElement(BaseFeatureDetail_1.BaseCard, { ...props, title: "Flags" },
37
+ return (react_1.default.createElement(BaseCard_1.default, { ...props, title: "Flags" },
38
38
  react_1.default.createElement(SimpleField_1.default, { name: "Flag", value: flags }),
39
39
  react_1.default.createElement(material_1.FormGroup, null, flagNames.map((name, idx) => {
40
40
  const val = flags & (1 << idx);
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = SuppAlignments;
7
7
  const react_1 = __importDefault(require("react"));
8
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
8
+ const BaseCard_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard"));
9
9
  const util_1 = require("@jbrowse/core/util");
10
10
  const LaunchPairedEndBreakpointSplitViewPanel_1 = __importDefault(require("./LaunchPairedEndBreakpointSplitViewPanel"));
11
11
  function SuppAlignments(props) {
@@ -19,5 +19,5 @@ function SuppAlignments(props) {
19
19
  catch (e) {
20
20
  // ignore
21
21
  }
22
- return (react_1.default.createElement(BaseFeatureDetail_1.BaseCard, { ...props, title: "Supplementary alignments" }, viewType ? (react_1.default.createElement(LaunchPairedEndBreakpointSplitViewPanel_1.default, { viewType: viewType, model: model, feature: feature })) : null));
22
+ return (react_1.default.createElement(BaseCard_1.default, { ...props, title: "Supplementary alignments" }, viewType ? (react_1.default.createElement(LaunchPairedEndBreakpointSplitViewPanel_1.default, { viewType: viewType, model: model, feature: feature })) : null));
23
23
  }
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = SupplementaryAlignments;
7
7
  const react_1 = __importDefault(require("react"));
8
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
9
8
  const util_1 = require("@jbrowse/core/util");
9
+ const BaseCard_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard"));
10
10
  const SupplementaryAlignmentsLocStrings_1 = __importDefault(require("./SupplementaryAlignmentsLocStrings"));
11
11
  const LaunchSupplementaryAlignmentBreakpointSplitViewPanel_1 = __importDefault(require("./LaunchSupplementaryAlignmentBreakpointSplitViewPanel"));
12
12
  function SupplementaryAlignments(props) {
@@ -20,7 +20,7 @@ function SupplementaryAlignments(props) {
20
20
  catch (e) {
21
21
  // ignore
22
22
  }
23
- return (react_1.default.createElement(BaseFeatureDetail_1.BaseCard, { ...props, title: "Supplementary alignments" },
23
+ return (react_1.default.createElement(BaseCard_1.default, { ...props, title: "Supplementary alignments" },
24
24
  react_1.default.createElement(SupplementaryAlignmentsLocStrings_1.default, { model: model, tag: tag }),
25
25
  viewType ? (react_1.default.createElement(LaunchSupplementaryAlignmentBreakpointSplitViewPanel_1.default, { viewType: viewType, model: model, feature: feature })) : null));
26
26
  }
@@ -61,11 +61,9 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
61
61
  setLoading(abortController: AbortController): void;
62
62
  setMessage(messageText: string): void;
63
63
  setRendered(props: {
64
- reactElement: React.
65
- /**
64
+ reactElement: React.ReactElement /**
66
65
  * #action
67
- */
68
- ReactElement;
66
+ */;
69
67
  features: Map<string, import("@jbrowse/core/util").Feature>;
70
68
  layout: any;
71
69
  maxHeightReached: boolean;
@@ -181,9 +179,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
181
179
  rendererTypeName: string;
182
180
  error: unknown;
183
181
  message: string | undefined;
184
- }, import("mobx-state-tree" /**
185
- * #action
186
- */)._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
182
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
187
183
  }> | null;
188
184
  readonly adapterConfig: any;
189
185
  readonly parentTrack: any;
@@ -100,7 +100,7 @@ function stateModelFactory(configSchema) {
100
100
  updateModificationColorMap(uniqueModifications) {
101
101
  uniqueModifications.forEach(value => {
102
102
  if (!self.modificationTagMap.has(value)) {
103
- self.modificationTagMap.set(value, util_2.modificationColors[value] || (0, util_2.randomColor)());
103
+ self.modificationTagMap.set(value, util_2.modificationColors[value] || (0, util_2.randomColor)(value));
104
104
  }
105
105
  });
106
106
  },
@@ -116,7 +116,7 @@ function stateModelFactory(pluginManager, configSchema) {
116
116
  updateModificationColorMap(uniqueModifications) {
117
117
  uniqueModifications.forEach(value => {
118
118
  if (!self.modificationTagMap.has(value)) {
119
- self.modificationTagMap.set(value, util_2.modificationColors[value] || (0, util_3.randomColor)());
119
+ self.modificationTagMap.set(value, util_2.modificationColors[value] || (0, util_3.randomColor)(value));
120
120
  }
121
121
  });
122
122
  },
@@ -314,11 +314,17 @@ function getModificationPositions(mm, fseq, fstrand) {
314
314
  }
315
315
  i++;
316
316
  } while (delta >= 0 && i < seq.length);
317
- const temp = i - 1;
318
- positions.push(fstrand === -1 ? seq.length - 1 - temp : temp);
319
- }
320
- if (fstrand === -1) {
321
- positions.sort((a, b) => a - b);
317
+ if (fstrand === -1) {
318
+ const pos = seq.length - i;
319
+ if (pos >= 0) {
320
+ // avoid negative-number-positions in array, seen in #4629 cause
321
+ // unknown, could warrant some further investigation
322
+ positions.unshift(pos);
323
+ }
324
+ }
325
+ else {
326
+ positions.push(i - 1);
327
+ }
322
328
  }
323
329
  result.push({
324
330
  type,
package/dist/util.d.ts CHANGED
@@ -23,5 +23,5 @@ type DisplayModel = IAnyStateTreeNode & {
23
23
  setError: (arg: unknown) => void;
24
24
  };
25
25
  export declare function createAutorun(self: DisplayModel, cb: () => Promise<void>, opts?: IAutorunOptions): void;
26
- export declare function randomColor(): string;
26
+ export declare function randomColor(str: string): string;
27
27
  export {};
package/dist/util.js CHANGED
@@ -113,6 +113,7 @@ exports.modificationColors = {
113
113
  g: 'rgb(255, 160, 86)',
114
114
  e: 'rgb(141, 221, 208)',
115
115
  b: 'rgb(202, 71, 47)',
116
+ a: 'hsl(136, 50%, 50%)',
116
117
  };
117
118
  function createAutorun(self, cb, opts) {
118
119
  (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
@@ -126,6 +127,10 @@ function createAutorun(self, cb, opts) {
126
127
  }
127
128
  }, opts));
128
129
  }
129
- function randomColor() {
130
- return `hsl(${Math.random() * 200}, 50%, 50%)`;
130
+ function randomColor(str) {
131
+ let sum = 0;
132
+ for (let i = 0; i < str.length; i++) {
133
+ sum += str.charCodeAt(i);
134
+ }
135
+ return `hsl(${sum * 10}, 20%, 50%)`;
131
136
  }
@@ -2,7 +2,7 @@ import React, { lazy } from 'react';
2
2
  import { Paper } from '@mui/material';
3
3
  import { observer } from 'mobx-react';
4
4
  import clone from 'clone';
5
- import { FeatureDetails } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
5
+ import FeatureDetails from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails';
6
6
  // locals
7
7
  import { getTag } from './util';
8
8
  import { tags } from './tagInfo';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Checkbox, FormControlLabel, FormGroup } from '@mui/material';
3
3
  import { makeStyles } from 'tss-react/mui';
4
- import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
4
+ import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
5
5
  import SimpleField from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/SimpleField';
6
6
  const useStyles = makeStyles()({
7
7
  compact: {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
2
+ import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
3
3
  import { getEnv, getSession } from '@jbrowse/core/util';
4
4
  import LaunchPairedEndBreakpointSplitViewPanel from './LaunchPairedEndBreakpointSplitViewPanel';
5
5
  export default function SuppAlignments(props) {
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
3
2
  import { getEnv, getSession } from '@jbrowse/core/util';
3
+ import BaseCard from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard';
4
4
  import SupplementaryAlignmentsLocStrings from './SupplementaryAlignmentsLocStrings';
5
5
  import LaunchBreakpointSplitViewPanel from './LaunchSupplementaryAlignmentBreakpointSplitViewPanel';
6
6
  export default function SupplementaryAlignments(props) {
@@ -61,11 +61,9 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
61
61
  setLoading(abortController: AbortController): void;
62
62
  setMessage(messageText: string): void;
63
63
  setRendered(props: {
64
- reactElement: React.
65
- /**
64
+ reactElement: React.ReactElement /**
66
65
  * #action
67
- */
68
- ReactElement;
66
+ */;
69
67
  features: Map<string, import("@jbrowse/core/util").Feature>;
70
68
  layout: any;
71
69
  maxHeightReached: boolean;
@@ -181,9 +179,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
181
179
  rendererTypeName: string;
182
180
  error: unknown;
183
181
  message: string | undefined;
184
- }, import("mobx-state-tree" /**
185
- * #action
186
- */)._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
182
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
187
183
  }> | null;
188
184
  readonly adapterConfig: any;
189
185
  readonly parentTrack: any;
@@ -72,7 +72,7 @@ function stateModelFactory(configSchema) {
72
72
  updateModificationColorMap(uniqueModifications) {
73
73
  uniqueModifications.forEach(value => {
74
74
  if (!self.modificationTagMap.has(value)) {
75
- self.modificationTagMap.set(value, modificationColors[value] || randomColor());
75
+ self.modificationTagMap.set(value, modificationColors[value] || randomColor(value));
76
76
  }
77
77
  });
78
78
  },
@@ -88,7 +88,7 @@ function stateModelFactory(pluginManager, configSchema) {
88
88
  updateModificationColorMap(uniqueModifications) {
89
89
  uniqueModifications.forEach(value => {
90
90
  if (!self.modificationTagMap.has(value)) {
91
- self.modificationTagMap.set(value, modificationColors[value] || randomColor());
91
+ self.modificationTagMap.set(value, modificationColors[value] || randomColor(value));
92
92
  }
93
93
  });
94
94
  },
@@ -295,11 +295,17 @@ export function getModificationPositions(mm, fseq, fstrand) {
295
295
  }
296
296
  i++;
297
297
  } while (delta >= 0 && i < seq.length);
298
- const temp = i - 1;
299
- positions.push(fstrand === -1 ? seq.length - 1 - temp : temp);
300
- }
301
- if (fstrand === -1) {
302
- positions.sort((a, b) => a - b);
298
+ if (fstrand === -1) {
299
+ const pos = seq.length - i;
300
+ if (pos >= 0) {
301
+ // avoid negative-number-positions in array, seen in #4629 cause
302
+ // unknown, could warrant some further investigation
303
+ positions.unshift(pos);
304
+ }
305
+ }
306
+ else {
307
+ positions.push(i - 1);
308
+ }
303
309
  }
304
310
  result.push({
305
311
  type,
package/esm/util.d.ts CHANGED
@@ -23,5 +23,5 @@ type DisplayModel = IAnyStateTreeNode & {
23
23
  setError: (arg: unknown) => void;
24
24
  };
25
25
  export declare function createAutorun(self: DisplayModel, cb: () => Promise<void>, opts?: IAutorunOptions): void;
26
- export declare function randomColor(): string;
26
+ export declare function randomColor(str: string): string;
27
27
  export {};
package/esm/util.js CHANGED
@@ -103,6 +103,7 @@ export const modificationColors = {
103
103
  g: 'rgb(255, 160, 86)',
104
104
  e: 'rgb(141, 221, 208)',
105
105
  b: 'rgb(202, 71, 47)',
106
+ a: 'hsl(136, 50%, 50%)',
106
107
  };
107
108
  export function createAutorun(self, cb, opts) {
108
109
  addDisposer(self, autorun(async () => {
@@ -116,6 +117,10 @@ export function createAutorun(self, cb, opts) {
116
117
  }
117
118
  }, opts));
118
119
  }
119
- export function randomColor() {
120
- return `hsl(${Math.random() * 200}, 50%, 50%)`;
120
+ export function randomColor(str) {
121
+ let sum = 0;
122
+ for (let i = 0; i < str.length; i++) {
123
+ sum += str.charCodeAt(i);
124
+ }
125
+ return `hsl(${sum * 10}, 20%, 50%)`;
121
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-alignments",
3
- "version": "2.16.0",
3
+ "version": "2.16.1",
4
4
  "description": "JBrowse 2 alignments adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -38,7 +38,7 @@
38
38
  "dependencies": {
39
39
  "@gmod/bam": "^2.0.0",
40
40
  "@gmod/cram": "^3.0.3",
41
- "@jbrowse/sv-core": "^2.16.0",
41
+ "@jbrowse/sv-core": "^2.16.1",
42
42
  "@mui/icons-material": "^6.0.0",
43
43
  "canvas2svg": "^1.0.16",
44
44
  "clone": "^2.1.2",
@@ -64,5 +64,5 @@
64
64
  "distModule": "esm/index.js",
65
65
  "srcModule": "src/index.ts",
66
66
  "module": "esm/index.js",
67
- "gitHead": "1e6d4fbc27ce684eed19e3c217f34bd2da24ab75"
67
+ "gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
68
68
  }