@jbrowse/core 2.16.1 → 2.17.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.
@@ -1,7 +1,5 @@
1
1
  import React from 'react';
2
2
  import { BaseCardProps, BaseProps } from '../types';
3
- import BaseCard from './BaseCard';
4
- import FeatureDetails from './FeatureDetails';
5
3
  export declare const BaseCoreDetails: (props: BaseProps) => React.JSX.Element;
6
4
  export declare const BaseAttributes: (props: BaseProps) => React.JSX.Element;
7
5
  export interface BaseInputProps extends BaseCardProps {
@@ -12,4 +10,5 @@ export interface BaseInputProps extends BaseCardProps {
12
10
  }
13
11
  declare const BaseFeatureDetail: ({ model }: BaseInputProps) => React.JSX.Element | null;
14
12
  export default BaseFeatureDetail;
15
- export { BaseCard, FeatureDetails };
13
+ export { default as BaseCard } from './BaseCard';
14
+ export { default as FeatureDetails } from './FeatureDetails';
@@ -13,10 +13,8 @@ const util_2 = require("../util");
13
13
  // locals
14
14
  const Attributes_1 = __importDefault(require("./Attributes"));
15
15
  const BaseCard_1 = __importDefault(require("./BaseCard"));
16
- exports.BaseCard = BaseCard_1.default;
17
16
  const CoreDetails_1 = __importDefault(require("./CoreDetails"));
18
17
  const FeatureDetails_1 = __importDefault(require("./FeatureDetails"));
19
- exports.FeatureDetails = FeatureDetails_1.default;
20
18
  const BaseCoreDetails = (props) => {
21
19
  const { title = 'Primary data' } = props;
22
20
  return (react_1.default.createElement(BaseCard_1.default, { ...props, title: title },
@@ -47,3 +45,7 @@ const BaseFeatureDetail = (0, mobx_react_1.observer)(function ({ model }) {
47
45
  }
48
46
  });
49
47
  exports.default = BaseFeatureDetail;
48
+ var BaseCard_2 = require("./BaseCard");
49
+ Object.defineProperty(exports, "BaseCard", { enumerable: true, get: function () { return __importDefault(BaseCard_2).default; } });
50
+ var FeatureDetails_2 = require("./FeatureDetails");
51
+ Object.defineProperty(exports, "FeatureDetails", { enumerable: true, get: function () { return __importDefault(FeatureDetails_2).default; } });
@@ -1,12 +1,33 @@
1
1
  import { Instance } from 'mobx-state-tree';
2
2
  import { SimpleFeatureSerialized } from '../../util';
3
3
  export declare function SequenceFeatureDetailsF(): import("mobx-state-tree").IModelType<{}, {
4
+ /**
5
+ * #volatile
6
+ */
4
7
  showCoordinatesSetting: string;
8
+ /**
9
+ * #volatile
10
+ */
5
11
  intronBp: number;
12
+ /**
13
+ * #volatile
14
+ */
6
15
  upDownBp: number;
16
+ /**
17
+ * #volatile
18
+ */
7
19
  upperCaseCDS: boolean;
20
+ /**
21
+ * #volatile
22
+ */
8
23
  charactersPerRow: number;
24
+ /**
25
+ * #volatile
26
+ */
9
27
  feature: SimpleFeatureSerialized | undefined;
28
+ /**
29
+ * #volatile
30
+ */
10
31
  mode: string;
11
32
  } & {
12
33
  /**
@@ -9,17 +9,47 @@ function localStorageGetNumber(key, defaultVal) {
9
9
  var _a;
10
10
  return +((_a = (0, util_1.localStorageGetItem)(key)) !== null && _a !== void 0 ? _a : defaultVal);
11
11
  }
12
+ function localStorageGetBoolean(key, defaultVal) {
13
+ return Boolean(JSON.parse((0, util_1.localStorageGetItem)(key) || JSON.stringify(defaultVal)));
14
+ }
15
+ function localStorageSetNumber(key, value) {
16
+ (0, util_1.localStorageSetItem)(key, JSON.stringify(value));
17
+ }
18
+ function localStorageSetBoolean(key, value) {
19
+ (0, util_1.localStorageSetItem)(key, JSON.stringify(value));
20
+ }
21
+ const p = 'sequenceFeatureDetails';
12
22
  function SequenceFeatureDetailsF() {
13
23
  return mobx_state_tree_1.types
14
24
  .model('SequenceFeatureDetails')
15
25
  .volatile(() => ({
16
- showCoordinatesSetting: (0, util_1.localStorageGetItem)('sequenceFeatureDetails-showCoordinatesSetting') ||
17
- 'none',
18
- intronBp: localStorageGetNumber('sequenceFeatureDetails-intronBp', 10),
19
- upDownBp: localStorageGetNumber('sequenceFeatureDetails-upDownBp', 100),
20
- upperCaseCDS: Boolean(JSON.parse((0, util_1.localStorageGetItem)('sequenceFeatureDetails-upperCaseCDS') || 'true')),
26
+ /**
27
+ * #volatile
28
+ */
29
+ showCoordinatesSetting: (0, util_1.localStorageGetItem)(`${p}-showCoordinatesSetting`) || 'none',
30
+ /**
31
+ * #volatile
32
+ */
33
+ intronBp: localStorageGetNumber(`${p}-intronBp`, 10),
34
+ /**
35
+ * #volatile
36
+ */
37
+ upDownBp: localStorageGetNumber(`${p}-upDownBp`, 100),
38
+ /**
39
+ * #volatile
40
+ */
41
+ upperCaseCDS: localStorageGetBoolean(`${p}-upperCaseCDS`, true),
42
+ /**
43
+ * #volatile
44
+ */
21
45
  charactersPerRow: 100,
46
+ /**
47
+ * #volatile
48
+ */
22
49
  feature: undefined,
50
+ /**
51
+ * #volatile
52
+ */
23
53
  mode: '',
24
54
  }))
25
55
  .actions(self => ({
@@ -100,10 +130,10 @@ function SequenceFeatureDetailsF() {
100
130
  .actions(self => ({
101
131
  afterAttach() {
102
132
  (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
103
- (0, util_1.localStorageSetItem)('sequenceFeatureDetails-upDownBp', JSON.stringify(self.upDownBp));
104
- (0, util_1.localStorageSetItem)('sequenceFeatureDetails-intronBp', JSON.stringify(self.intronBp));
105
- (0, util_1.localStorageSetItem)('sequenceFeatureDetails-upperCaseCDS', JSON.stringify(self.upperCaseCDS));
106
- (0, util_1.localStorageSetItem)('sequenceFeatureDetails-showCoordinatesSetting', self.showCoordinatesSetting);
133
+ localStorageSetNumber(`${p}-upDownBp`, self.upDownBp);
134
+ localStorageSetNumber(`${p}-intronBp`, self.intronBp);
135
+ localStorageSetBoolean(`${p}-upperCaseCDS`, self.upperCaseCDS);
136
+ (0, util_1.localStorageSetItem)(`${p}-showCoordinatesSetting`, self.showCoordinatesSetting);
107
137
  }));
108
138
  (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
109
139
  self.setMode(self.hasCDS ? 'cds' : self.hasExon ? 'cdna' : 'genomic');
@@ -179,8 +179,8 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
179
179
  trackId: string | undefined;
180
180
  trackType: string | undefined;
181
181
  maxDepth: number | undefined;
182
- formattedFields: any;
183
182
  sequenceFeatureDetails: import("mobx-state-tree").ModelSnapshotType<{}>;
183
+ formattedFields: any;
184
184
  finalizedFeatureData: any;
185
185
  }>;
186
186
  export type BaseFeatureWidgetStateModel = ReturnType<typeof stateModelFactory>;
@@ -125,4 +125,9 @@ export declare abstract class BaseFeatureDataAdapter extends BaseAdapter {
125
125
  * is)
126
126
  */
127
127
  getMultiRegionFeatureDensityStats(regions: Region[], opts?: BaseOptions): Promise<FeatureDensityStats>;
128
+ getSources(regions: Region[]): Promise<{
129
+ name: string;
130
+ color?: string;
131
+ [key: string]: unknown;
132
+ }[]>;
128
133
  }
@@ -170,5 +170,15 @@ class BaseFeatureDataAdapter extends BaseAdapter_1.BaseAdapter {
170
170
  }
171
171
  return this.getRegionFeatureDensityStats(regions[0], opts);
172
172
  }
173
+ async getSources(regions) {
174
+ const features = await (0, rxjs_1.firstValueFrom)(this.getFeaturesInMultipleRegions(regions).pipe((0, operators_1.toArray)()));
175
+ const sources = new Set();
176
+ for (const f of features) {
177
+ sources.add(f.get('source'));
178
+ }
179
+ return [...sources].map(source => ({
180
+ name: source,
181
+ }));
182
+ }
173
183
  }
174
184
  exports.BaseFeatureDataAdapter = BaseFeatureDataAdapter;
@@ -1,6 +1,7 @@
1
1
  import { SimpleFeature } from '../../util';
2
2
  import { BaseAdapter } from '../BaseAdapter';
3
+ import { BaseOptions } from '../BaseAdapter/BaseOptions';
3
4
  export default class CytobandAdapter extends BaseAdapter {
4
- getData(): Promise<SimpleFeature[]>;
5
+ getData(opts?: BaseOptions): Promise<SimpleFeature[]>;
5
6
  freeResources(): void;
6
7
  }
@@ -1,20 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
4
3
  // locals
5
4
  const util_1 = require("../../util");
6
5
  const io_1 = require("../../util/io");
7
6
  const BaseAdapter_1 = require("../BaseAdapter");
8
7
  class CytobandAdapter extends BaseAdapter_1.BaseAdapter {
9
- async getData() {
10
- const pm = this.pluginManager;
11
- const loc = this.getConf('cytobandLocation');
12
- if (loc.uri === '' || loc.uri === '/path/to/cytoband.txt.gz') {
8
+ async getData(opts) {
9
+ const conf = this.getConf('cytobandLocation');
10
+ if (conf.uri === '' || conf.uri === '/path/to/cytoband.txt.gz') {
13
11
  return [];
14
12
  }
15
- const buffer = await (0, io_1.openLocation)(loc, pm).readFile();
16
- const buf = (0, util_1.isGzip)(buffer) ? await (0, bgzf_filehandle_1.unzip)(buffer) : buffer;
17
- const text = new TextDecoder('utf8', { fatal: true }).decode(buf);
13
+ const pm = this.pluginManager;
14
+ const buf = await (0, util_1.fetchAndMaybeUnzip)((0, io_1.openLocation)(conf, pm), opts);
15
+ const decoder = new TextDecoder('utf8', { fatal: true });
16
+ const text = decoder.decode(buf);
18
17
  return text
19
18
  .split(/\n|\r\n|\r/)
20
19
  .filter(f => !!f.trim())
@@ -25,8 +24,9 @@ class CytobandAdapter extends BaseAdapter_1.BaseAdapter {
25
24
  refName: refName,
26
25
  start: +start,
27
26
  end: +end,
28
- name: name,
29
- type: type,
27
+ name,
28
+ type,
29
+ gieStain: type || name,
30
30
  });
31
31
  });
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "2.16.1",
3
+ "version": "2.17.0",
4
4
  "description": "JBrowse 2 core libraries used by plugins",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -44,7 +44,7 @@
44
44
  "copy-to-clipboard": "^3.3.1",
45
45
  "deepmerge": "^4.2.2",
46
46
  "detect-node": "^2.1.0",
47
- "dompurify": "^3.0.0",
47
+ "dompurify": "^3.2.0",
48
48
  "escape-html": "^1.0.3",
49
49
  "fast-deep-equal": "^3.1.3",
50
50
  "generic-filehandle": "^3.0.0",
@@ -72,5 +72,5 @@
72
72
  "access": "public",
73
73
  "directory": "dist"
74
74
  },
75
- "gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
75
+ "gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
76
76
  }