@jbrowse/plugin-gccontent 2.7.0 → 2.7.2
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.
- package/dist/GCContentAdapter/GCContentAdapter.d.ts +0 -2
- package/dist/GCContentAdapter/GCContentAdapter.js +6 -6
- package/dist/GCContentAdapter/configSchema.d.ts +14 -0
- package/dist/GCContentAdapter/configSchema.js +14 -0
- package/dist/LinearGCContentDisplay/components/EditGCContentParams.d.ts +13 -0
- package/dist/LinearGCContentDisplay/components/EditGCContentParams.js +49 -0
- package/dist/LinearGCContentDisplay/config.d.ts +11 -1
- package/dist/LinearGCContentDisplay/config.js +11 -1
- package/dist/LinearGCContentDisplay/stateModel.d.ts +22 -1
- package/dist/LinearGCContentDisplay/stateModel.js +67 -1
- package/esm/GCContentAdapter/GCContentAdapter.d.ts +0 -2
- package/esm/GCContentAdapter/GCContentAdapter.js +6 -6
- package/esm/GCContentAdapter/configSchema.d.ts +14 -0
- package/esm/GCContentAdapter/configSchema.js +14 -0
- package/esm/LinearGCContentDisplay/components/EditGCContentParams.d.ts +13 -0
- package/esm/LinearGCContentDisplay/components/EditGCContentParams.js +24 -0
- package/esm/LinearGCContentDisplay/config.d.ts +11 -1
- package/esm/LinearGCContentDisplay/config.js +11 -1
- package/esm/LinearGCContentDisplay/stateModel.d.ts +22 -1
- package/esm/LinearGCContentDisplay/stateModel.js +44 -1
- package/package.json +2 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
3
|
export default class extends BaseFeatureDataAdapter {
|
|
4
|
-
private windowSize;
|
|
5
|
-
private windowDelta;
|
|
6
4
|
private gcMode;
|
|
7
5
|
static capabilities: string[];
|
|
8
6
|
configure(): Promise<BaseFeatureDataAdapter>;
|
|
@@ -8,8 +8,6 @@ const operators_1 = require("rxjs/operators");
|
|
|
8
8
|
class default_1 extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
9
9
|
constructor() {
|
|
10
10
|
super(...arguments);
|
|
11
|
-
this.windowSize = 1000;
|
|
12
|
-
this.windowDelta = 1000;
|
|
13
11
|
this.gcMode = 'content';
|
|
14
12
|
}
|
|
15
13
|
async configure() {
|
|
@@ -28,8 +26,10 @@ class default_1 extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
28
26
|
return (0, rxjs_2.ObservableCreate)(async (observer) => {
|
|
29
27
|
var _a;
|
|
30
28
|
const sequenceAdapter = await this.configure();
|
|
31
|
-
const
|
|
32
|
-
const
|
|
29
|
+
const windowSize = this.getConf('windowSize');
|
|
30
|
+
const windowDelta = this.getConf('windowDelta');
|
|
31
|
+
const hw = windowSize === 1 ? 1 : windowSize / 2; // Half the window size
|
|
32
|
+
const f = windowSize === 1;
|
|
33
33
|
let { start: queryStart, end: queryEnd } = query;
|
|
34
34
|
queryStart = Math.max(0, queryStart - hw);
|
|
35
35
|
queryEnd += hw;
|
|
@@ -44,7 +44,7 @@ class default_1 extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
44
44
|
}, opts);
|
|
45
45
|
const feats = await (0, rxjs_1.firstValueFrom)(ret.pipe((0, operators_1.toArray)()));
|
|
46
46
|
const residues = ((_a = feats[0]) === null || _a === void 0 ? void 0 : _a.get('seq')) || '';
|
|
47
|
-
for (let i = hw; i < residues.length - hw; i +=
|
|
47
|
+
for (let i = hw; i < residues.length - hw; i += windowDelta) {
|
|
48
48
|
const r = f ? residues[i] : residues.slice(i - hw, i + hw);
|
|
49
49
|
let nc = 0;
|
|
50
50
|
let ng = 0;
|
|
@@ -71,7 +71,7 @@ class default_1 extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
71
71
|
observer.next(new util_1.SimpleFeature({
|
|
72
72
|
uniqueId: `${this.id}_${pos + i}`,
|
|
73
73
|
start: pos + i,
|
|
74
|
-
end: pos + i +
|
|
74
|
+
end: pos + i + windowDelta,
|
|
75
75
|
score,
|
|
76
76
|
}));
|
|
77
77
|
}
|
|
@@ -7,5 +7,19 @@ declare const GCContentAdapterF: (_pluginManager: PluginManager) => import("@jbr
|
|
|
7
7
|
type: string;
|
|
8
8
|
defaultValue: null;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* #slot
|
|
12
|
+
*/
|
|
13
|
+
windowSize: {
|
|
14
|
+
type: string;
|
|
15
|
+
defaultValue: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* #slot
|
|
19
|
+
*/
|
|
20
|
+
windowDelta: {
|
|
21
|
+
type: string;
|
|
22
|
+
defaultValue: number;
|
|
23
|
+
};
|
|
10
24
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
11
25
|
export default GCContentAdapterF;
|
|
@@ -15,6 +15,20 @@ const GCContentAdapterF = (_pluginManager) => {
|
|
|
15
15
|
type: 'frozen',
|
|
16
16
|
defaultValue: null,
|
|
17
17
|
},
|
|
18
|
+
/**
|
|
19
|
+
* #slot
|
|
20
|
+
*/
|
|
21
|
+
windowSize: {
|
|
22
|
+
type: 'number',
|
|
23
|
+
defaultValue: 100,
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* #slot
|
|
27
|
+
*/
|
|
28
|
+
windowDelta: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
defaultValue: 100,
|
|
31
|
+
},
|
|
18
32
|
}, { explicitlyTyped: true });
|
|
19
33
|
};
|
|
20
34
|
exports.default = GCContentAdapterF;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const EditGCContentParamsDialog: ({ model, handleClose, }: {
|
|
3
|
+
model: {
|
|
4
|
+
windowSizeSetting: number;
|
|
5
|
+
windowDeltaSetting: number;
|
|
6
|
+
setGCContentParams: (a: {
|
|
7
|
+
windowSize: number;
|
|
8
|
+
windowDelta: number;
|
|
9
|
+
}) => void;
|
|
10
|
+
};
|
|
11
|
+
handleClose: () => void;
|
|
12
|
+
}) => React.JSX.Element;
|
|
13
|
+
export default EditGCContentParamsDialog;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
27
|
+
const mobx_react_1 = require("mobx-react");
|
|
28
|
+
const material_1 = require("@mui/material");
|
|
29
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
30
|
+
const EditGCContentParamsDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
|
|
31
|
+
const [windowSize, setWindowSize] = (0, react_1.useState)(`${model.windowSizeSetting}`);
|
|
32
|
+
const [windowDelta, setWindowDelta] = (0, react_1.useState)(`${model.windowDeltaSetting}`);
|
|
33
|
+
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: handleClose, title: "Edit GC content params" },
|
|
34
|
+
react_1.default.createElement(material_1.DialogContent, null,
|
|
35
|
+
react_1.default.createElement(material_1.Typography, null, "GC content is calculated in a particular sliding window of size N, and then the sliding window moves (steps) some number of bases M forward. Note that small step sizes can result in high CPU over large areas, and it is not recommended to make the step size larger than the window size as then the sliding window will miss contents."),
|
|
36
|
+
windowDelta > windowSize ? (react_1.default.createElement(ui_1.ErrorMessage, { error: "It is not recommended to make the step size larger than the window size" })) : null,
|
|
37
|
+
react_1.default.createElement(material_1.TextField, { label: "Size of sliding window (bp)", value: `${windowSize}`, onChange: event => setWindowSize(event.target.value) }),
|
|
38
|
+
react_1.default.createElement(material_1.TextField, { label: "Step size of sliding window (bp)", value: `${windowDelta}`, onChange: event => setWindowDelta(event.target.value) }),
|
|
39
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
40
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => {
|
|
41
|
+
model.setGCContentParams({
|
|
42
|
+
windowSize: +windowSize,
|
|
43
|
+
windowDelta: +windowDelta,
|
|
44
|
+
});
|
|
45
|
+
handleClose();
|
|
46
|
+
} }, "Submit"),
|
|
47
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
|
|
48
|
+
});
|
|
49
|
+
exports.default = EditGCContentParamsDialog;
|
|
@@ -2,5 +2,15 @@ import PluginManager from '@jbrowse/core/PluginManager';
|
|
|
2
2
|
/**
|
|
3
3
|
* #config LinearGCContentDisplay
|
|
4
4
|
* #category display
|
|
5
|
+
* extends LinearWiggleDisplay
|
|
5
6
|
*/
|
|
6
|
-
export default function WiggleConfigFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
7
|
+
export default function WiggleConfigFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
8
|
+
windowSize: {
|
|
9
|
+
type: string;
|
|
10
|
+
defaultValue: number;
|
|
11
|
+
};
|
|
12
|
+
windowDelta: {
|
|
13
|
+
type: string;
|
|
14
|
+
defaultValue: number;
|
|
15
|
+
};
|
|
16
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration").AnyConfigurationSchemaType, undefined>>;
|
|
@@ -4,9 +4,19 @@ const configuration_1 = require("@jbrowse/core/configuration");
|
|
|
4
4
|
/**
|
|
5
5
|
* #config LinearGCContentDisplay
|
|
6
6
|
* #category display
|
|
7
|
+
* extends LinearWiggleDisplay
|
|
7
8
|
*/
|
|
8
9
|
function WiggleConfigFactory(pluginManager) {
|
|
9
|
-
return (0, configuration_1.ConfigurationSchema)('LinearGCContentDisplay', {
|
|
10
|
+
return (0, configuration_1.ConfigurationSchema)('LinearGCContentDisplay', {
|
|
11
|
+
windowSize: {
|
|
12
|
+
type: 'number',
|
|
13
|
+
defaultValue: 100,
|
|
14
|
+
},
|
|
15
|
+
windowDelta: {
|
|
16
|
+
type: 'number',
|
|
17
|
+
defaultValue: 100,
|
|
18
|
+
},
|
|
19
|
+
}, {
|
|
10
20
|
/**
|
|
11
21
|
* #baseConfiguration
|
|
12
22
|
*/
|
|
@@ -102,7 +102,11 @@ export default function stateModelFactory(pluginManager: PluginManager, configSc
|
|
|
102
102
|
max: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
103
103
|
min: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
104
104
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
105
|
-
configuration: AnyConfigurationSchemaType;
|
|
105
|
+
configuration: AnyConfigurationSchemaType; /**
|
|
106
|
+
* #method
|
|
107
|
+
* retrieves the sequence adapter from parent track, and puts it as a
|
|
108
|
+
* subadapter on a GCContentAdapter
|
|
109
|
+
*/
|
|
106
110
|
} & {
|
|
107
111
|
type: import("mobx-state-tree").ISimpleType<"LinearWiggleDisplay">;
|
|
108
112
|
} & {
|
|
@@ -110,6 +114,14 @@ export default function stateModelFactory(pluginManager: PluginManager, configSc
|
|
|
110
114
|
* #property
|
|
111
115
|
*/
|
|
112
116
|
type: import("mobx-state-tree").ISimpleType<"LinearGCContentDisplay">;
|
|
117
|
+
/**
|
|
118
|
+
* #property
|
|
119
|
+
*/
|
|
120
|
+
windowSize: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
121
|
+
/**
|
|
122
|
+
* #property
|
|
123
|
+
*/
|
|
124
|
+
windowDelta: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
113
125
|
}, {
|
|
114
126
|
rendererTypeName: string;
|
|
115
127
|
error: unknown;
|
|
@@ -383,6 +395,15 @@ export default function stateModelFactory(pluginManager: PluginManager, configSc
|
|
|
383
395
|
afterAttach(): void;
|
|
384
396
|
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
|
|
385
397
|
} & {
|
|
398
|
+
setGCContentParams({ windowSize, windowDelta, }: {
|
|
399
|
+
windowSize: number;
|
|
400
|
+
windowDelta: number;
|
|
401
|
+
}): void;
|
|
402
|
+
} & {
|
|
403
|
+
readonly windowSizeSetting: any;
|
|
404
|
+
readonly windowDeltaSetting: any;
|
|
405
|
+
} & {
|
|
406
|
+
trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
386
407
|
/**
|
|
387
408
|
* #method
|
|
388
409
|
* retrieves the sequence adapter from parent track, and puts it as a
|
|
@@ -1,8 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
27
|
+
const util_1 = require("@jbrowse/core/util");
|
|
4
28
|
const plugin_wiggle_1 = require("@jbrowse/plugin-wiggle");
|
|
5
29
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
30
|
+
const react_1 = require("react");
|
|
31
|
+
const EditGCContentParamsDlg = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/EditGCContentParams'))));
|
|
6
32
|
/**
|
|
7
33
|
* #stateModel LinearGCContentDisplay
|
|
8
34
|
* #category display
|
|
@@ -15,10 +41,48 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
15
41
|
* #property
|
|
16
42
|
*/
|
|
17
43
|
type: mobx_state_tree_1.types.literal('LinearGCContentDisplay'),
|
|
44
|
+
/**
|
|
45
|
+
* #property
|
|
46
|
+
*/
|
|
47
|
+
windowSize: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
48
|
+
/**
|
|
49
|
+
* #property
|
|
50
|
+
*/
|
|
51
|
+
windowDelta: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
|
|
52
|
+
}))
|
|
53
|
+
.actions(self => ({
|
|
54
|
+
setGCContentParams({ windowSize, windowDelta, }) {
|
|
55
|
+
self.windowSize = windowSize;
|
|
56
|
+
self.windowDelta = windowDelta;
|
|
57
|
+
},
|
|
58
|
+
}))
|
|
59
|
+
.views(self => ({
|
|
60
|
+
get windowSizeSetting() {
|
|
61
|
+
var _a;
|
|
62
|
+
return (_a = self.windowSize) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'windowSize');
|
|
63
|
+
},
|
|
64
|
+
get windowDeltaSetting() {
|
|
65
|
+
var _a;
|
|
66
|
+
return (_a = self.windowDelta) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'windowDelta');
|
|
67
|
+
},
|
|
18
68
|
}))
|
|
19
69
|
.views(self => {
|
|
20
|
-
const { renderProps: superRenderProps } = self;
|
|
70
|
+
const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, } = self;
|
|
21
71
|
return {
|
|
72
|
+
trackMenuItems() {
|
|
73
|
+
return [
|
|
74
|
+
...superTrackMenuItems(),
|
|
75
|
+
{
|
|
76
|
+
label: 'Change GC parameters',
|
|
77
|
+
onClick: () => {
|
|
78
|
+
(0, util_1.getSession)(self).queueDialog(handleClose => [
|
|
79
|
+
EditGCContentParamsDlg,
|
|
80
|
+
{ model: self, handleClose },
|
|
81
|
+
]);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
},
|
|
22
86
|
/**
|
|
23
87
|
* #method
|
|
24
88
|
* retrieves the sequence adapter from parent track, and puts it as a
|
|
@@ -31,6 +95,8 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
31
95
|
adapterConfig: {
|
|
32
96
|
type: 'GCContentAdapter',
|
|
33
97
|
sequenceAdapter,
|
|
98
|
+
windowSize: self.windowSizeSetting,
|
|
99
|
+
windowDelta: self.windowDeltaSetting,
|
|
34
100
|
},
|
|
35
101
|
};
|
|
36
102
|
},
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
2
|
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
3
|
export default class extends BaseFeatureDataAdapter {
|
|
4
|
-
private windowSize;
|
|
5
|
-
private windowDelta;
|
|
6
4
|
private gcMode;
|
|
7
5
|
static capabilities: string[];
|
|
8
6
|
configure(): Promise<BaseFeatureDataAdapter>;
|
|
@@ -6,8 +6,6 @@ import { toArray } from 'rxjs/operators';
|
|
|
6
6
|
class default_1 extends BaseFeatureDataAdapter {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(...arguments);
|
|
9
|
-
this.windowSize = 1000;
|
|
10
|
-
this.windowDelta = 1000;
|
|
11
9
|
this.gcMode = 'content';
|
|
12
10
|
}
|
|
13
11
|
async configure() {
|
|
@@ -26,8 +24,10 @@ class default_1 extends BaseFeatureDataAdapter {
|
|
|
26
24
|
return ObservableCreate(async (observer) => {
|
|
27
25
|
var _a;
|
|
28
26
|
const sequenceAdapter = await this.configure();
|
|
29
|
-
const
|
|
30
|
-
const
|
|
27
|
+
const windowSize = this.getConf('windowSize');
|
|
28
|
+
const windowDelta = this.getConf('windowDelta');
|
|
29
|
+
const hw = windowSize === 1 ? 1 : windowSize / 2; // Half the window size
|
|
30
|
+
const f = windowSize === 1;
|
|
31
31
|
let { start: queryStart, end: queryEnd } = query;
|
|
32
32
|
queryStart = Math.max(0, queryStart - hw);
|
|
33
33
|
queryEnd += hw;
|
|
@@ -42,7 +42,7 @@ class default_1 extends BaseFeatureDataAdapter {
|
|
|
42
42
|
}, opts);
|
|
43
43
|
const feats = await firstValueFrom(ret.pipe(toArray()));
|
|
44
44
|
const residues = ((_a = feats[0]) === null || _a === void 0 ? void 0 : _a.get('seq')) || '';
|
|
45
|
-
for (let i = hw; i < residues.length - hw; i +=
|
|
45
|
+
for (let i = hw; i < residues.length - hw; i += windowDelta) {
|
|
46
46
|
const r = f ? residues[i] : residues.slice(i - hw, i + hw);
|
|
47
47
|
let nc = 0;
|
|
48
48
|
let ng = 0;
|
|
@@ -69,7 +69,7 @@ class default_1 extends BaseFeatureDataAdapter {
|
|
|
69
69
|
observer.next(new SimpleFeature({
|
|
70
70
|
uniqueId: `${this.id}_${pos + i}`,
|
|
71
71
|
start: pos + i,
|
|
72
|
-
end: pos + i +
|
|
72
|
+
end: pos + i + windowDelta,
|
|
73
73
|
score,
|
|
74
74
|
}));
|
|
75
75
|
}
|
|
@@ -7,5 +7,19 @@ declare const GCContentAdapterF: (_pluginManager: PluginManager) => import("@jbr
|
|
|
7
7
|
type: string;
|
|
8
8
|
defaultValue: null;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* #slot
|
|
12
|
+
*/
|
|
13
|
+
windowSize: {
|
|
14
|
+
type: string;
|
|
15
|
+
defaultValue: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* #slot
|
|
19
|
+
*/
|
|
20
|
+
windowDelta: {
|
|
21
|
+
type: string;
|
|
22
|
+
defaultValue: number;
|
|
23
|
+
};
|
|
10
24
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
11
25
|
export default GCContentAdapterF;
|
|
@@ -13,6 +13,20 @@ const GCContentAdapterF = (_pluginManager) => {
|
|
|
13
13
|
type: 'frozen',
|
|
14
14
|
defaultValue: null,
|
|
15
15
|
},
|
|
16
|
+
/**
|
|
17
|
+
* #slot
|
|
18
|
+
*/
|
|
19
|
+
windowSize: {
|
|
20
|
+
type: 'number',
|
|
21
|
+
defaultValue: 100,
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* #slot
|
|
25
|
+
*/
|
|
26
|
+
windowDelta: {
|
|
27
|
+
type: 'number',
|
|
28
|
+
defaultValue: 100,
|
|
29
|
+
},
|
|
16
30
|
}, { explicitlyTyped: true });
|
|
17
31
|
};
|
|
18
32
|
export default GCContentAdapterF;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const EditGCContentParamsDialog: ({ model, handleClose, }: {
|
|
3
|
+
model: {
|
|
4
|
+
windowSizeSetting: number;
|
|
5
|
+
windowDeltaSetting: number;
|
|
6
|
+
setGCContentParams: (a: {
|
|
7
|
+
windowSize: number;
|
|
8
|
+
windowDelta: number;
|
|
9
|
+
}) => void;
|
|
10
|
+
};
|
|
11
|
+
handleClose: () => void;
|
|
12
|
+
}) => React.JSX.Element;
|
|
13
|
+
export default EditGCContentParamsDialog;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { observer } from 'mobx-react';
|
|
3
|
+
import { Button, DialogActions, DialogContent, TextField, Typography, } from '@mui/material';
|
|
4
|
+
import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
|
|
5
|
+
const EditGCContentParamsDialog = observer(function ({ model, handleClose, }) {
|
|
6
|
+
const [windowSize, setWindowSize] = useState(`${model.windowSizeSetting}`);
|
|
7
|
+
const [windowDelta, setWindowDelta] = useState(`${model.windowDeltaSetting}`);
|
|
8
|
+
return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Edit GC content params" },
|
|
9
|
+
React.createElement(DialogContent, null,
|
|
10
|
+
React.createElement(Typography, null, "GC content is calculated in a particular sliding window of size N, and then the sliding window moves (steps) some number of bases M forward. Note that small step sizes can result in high CPU over large areas, and it is not recommended to make the step size larger than the window size as then the sliding window will miss contents."),
|
|
11
|
+
windowDelta > windowSize ? (React.createElement(ErrorMessage, { error: "It is not recommended to make the step size larger than the window size" })) : null,
|
|
12
|
+
React.createElement(TextField, { label: "Size of sliding window (bp)", value: `${windowSize}`, onChange: event => setWindowSize(event.target.value) }),
|
|
13
|
+
React.createElement(TextField, { label: "Step size of sliding window (bp)", value: `${windowDelta}`, onChange: event => setWindowDelta(event.target.value) }),
|
|
14
|
+
React.createElement(DialogActions, null,
|
|
15
|
+
React.createElement(Button, { variant: "contained", onClick: () => {
|
|
16
|
+
model.setGCContentParams({
|
|
17
|
+
windowSize: +windowSize,
|
|
18
|
+
windowDelta: +windowDelta,
|
|
19
|
+
});
|
|
20
|
+
handleClose();
|
|
21
|
+
} }, "Submit"),
|
|
22
|
+
React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
|
|
23
|
+
});
|
|
24
|
+
export default EditGCContentParamsDialog;
|
|
@@ -2,5 +2,15 @@ import PluginManager from '@jbrowse/core/PluginManager';
|
|
|
2
2
|
/**
|
|
3
3
|
* #config LinearGCContentDisplay
|
|
4
4
|
* #category display
|
|
5
|
+
* extends LinearWiggleDisplay
|
|
5
6
|
*/
|
|
6
|
-
export default function WiggleConfigFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
7
|
+
export default function WiggleConfigFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
8
|
+
windowSize: {
|
|
9
|
+
type: string;
|
|
10
|
+
defaultValue: number;
|
|
11
|
+
};
|
|
12
|
+
windowDelta: {
|
|
13
|
+
type: string;
|
|
14
|
+
defaultValue: number;
|
|
15
|
+
};
|
|
16
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration").AnyConfigurationSchemaType, undefined>>;
|
|
@@ -2,9 +2,19 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
|
2
2
|
/**
|
|
3
3
|
* #config LinearGCContentDisplay
|
|
4
4
|
* #category display
|
|
5
|
+
* extends LinearWiggleDisplay
|
|
5
6
|
*/
|
|
6
7
|
export default function WiggleConfigFactory(pluginManager) {
|
|
7
|
-
return ConfigurationSchema('LinearGCContentDisplay', {
|
|
8
|
+
return ConfigurationSchema('LinearGCContentDisplay', {
|
|
9
|
+
windowSize: {
|
|
10
|
+
type: 'number',
|
|
11
|
+
defaultValue: 100,
|
|
12
|
+
},
|
|
13
|
+
windowDelta: {
|
|
14
|
+
type: 'number',
|
|
15
|
+
defaultValue: 100,
|
|
16
|
+
},
|
|
17
|
+
}, {
|
|
8
18
|
/**
|
|
9
19
|
* #baseConfiguration
|
|
10
20
|
*/
|
|
@@ -102,7 +102,11 @@ export default function stateModelFactory(pluginManager: PluginManager, configSc
|
|
|
102
102
|
max: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
103
103
|
min: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
104
104
|
}, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
105
|
-
configuration: AnyConfigurationSchemaType;
|
|
105
|
+
configuration: AnyConfigurationSchemaType; /**
|
|
106
|
+
* #method
|
|
107
|
+
* retrieves the sequence adapter from parent track, and puts it as a
|
|
108
|
+
* subadapter on a GCContentAdapter
|
|
109
|
+
*/
|
|
106
110
|
} & {
|
|
107
111
|
type: import("mobx-state-tree").ISimpleType<"LinearWiggleDisplay">;
|
|
108
112
|
} & {
|
|
@@ -110,6 +114,14 @@ export default function stateModelFactory(pluginManager: PluginManager, configSc
|
|
|
110
114
|
* #property
|
|
111
115
|
*/
|
|
112
116
|
type: import("mobx-state-tree").ISimpleType<"LinearGCContentDisplay">;
|
|
117
|
+
/**
|
|
118
|
+
* #property
|
|
119
|
+
*/
|
|
120
|
+
windowSize: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
121
|
+
/**
|
|
122
|
+
* #property
|
|
123
|
+
*/
|
|
124
|
+
windowDelta: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
|
|
113
125
|
}, {
|
|
114
126
|
rendererTypeName: string;
|
|
115
127
|
error: unknown;
|
|
@@ -383,6 +395,15 @@ export default function stateModelFactory(pluginManager: PluginManager, configSc
|
|
|
383
395
|
afterAttach(): void;
|
|
384
396
|
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
|
|
385
397
|
} & {
|
|
398
|
+
setGCContentParams({ windowSize, windowDelta, }: {
|
|
399
|
+
windowSize: number;
|
|
400
|
+
windowDelta: number;
|
|
401
|
+
}): void;
|
|
402
|
+
} & {
|
|
403
|
+
readonly windowSizeSetting: any;
|
|
404
|
+
readonly windowDeltaSetting: any;
|
|
405
|
+
} & {
|
|
406
|
+
trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
386
407
|
/**
|
|
387
408
|
* #method
|
|
388
409
|
* retrieves the sequence adapter from parent track, and puts it as a
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { getConf, } from '@jbrowse/core/configuration';
|
|
2
|
+
import { getSession } from '@jbrowse/core/util';
|
|
2
3
|
import { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle';
|
|
3
4
|
import { types } from 'mobx-state-tree';
|
|
5
|
+
import { lazy } from 'react';
|
|
6
|
+
const EditGCContentParamsDlg = lazy(() => import('./components/EditGCContentParams'));
|
|
4
7
|
/**
|
|
5
8
|
* #stateModel LinearGCContentDisplay
|
|
6
9
|
* #category display
|
|
@@ -13,10 +16,48 @@ export default function stateModelFactory(pluginManager, configSchema) {
|
|
|
13
16
|
* #property
|
|
14
17
|
*/
|
|
15
18
|
type: types.literal('LinearGCContentDisplay'),
|
|
19
|
+
/**
|
|
20
|
+
* #property
|
|
21
|
+
*/
|
|
22
|
+
windowSize: types.maybe(types.number),
|
|
23
|
+
/**
|
|
24
|
+
* #property
|
|
25
|
+
*/
|
|
26
|
+
windowDelta: types.maybe(types.number),
|
|
27
|
+
}))
|
|
28
|
+
.actions(self => ({
|
|
29
|
+
setGCContentParams({ windowSize, windowDelta, }) {
|
|
30
|
+
self.windowSize = windowSize;
|
|
31
|
+
self.windowDelta = windowDelta;
|
|
32
|
+
},
|
|
33
|
+
}))
|
|
34
|
+
.views(self => ({
|
|
35
|
+
get windowSizeSetting() {
|
|
36
|
+
var _a;
|
|
37
|
+
return (_a = self.windowSize) !== null && _a !== void 0 ? _a : getConf(self, 'windowSize');
|
|
38
|
+
},
|
|
39
|
+
get windowDeltaSetting() {
|
|
40
|
+
var _a;
|
|
41
|
+
return (_a = self.windowDelta) !== null && _a !== void 0 ? _a : getConf(self, 'windowDelta');
|
|
42
|
+
},
|
|
16
43
|
}))
|
|
17
44
|
.views(self => {
|
|
18
|
-
const { renderProps: superRenderProps } = self;
|
|
45
|
+
const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, } = self;
|
|
19
46
|
return {
|
|
47
|
+
trackMenuItems() {
|
|
48
|
+
return [
|
|
49
|
+
...superTrackMenuItems(),
|
|
50
|
+
{
|
|
51
|
+
label: 'Change GC parameters',
|
|
52
|
+
onClick: () => {
|
|
53
|
+
getSession(self).queueDialog(handleClose => [
|
|
54
|
+
EditGCContentParamsDlg,
|
|
55
|
+
{ model: self, handleClose },
|
|
56
|
+
]);
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
},
|
|
20
61
|
/**
|
|
21
62
|
* #method
|
|
22
63
|
* retrieves the sequence adapter from parent track, and puts it as a
|
|
@@ -29,6 +70,8 @@ export default function stateModelFactory(pluginManager, configSchema) {
|
|
|
29
70
|
adapterConfig: {
|
|
30
71
|
type: 'GCContentAdapter',
|
|
31
72
|
sequenceAdapter,
|
|
73
|
+
windowSize: self.windowSizeSetting,
|
|
74
|
+
windowDelta: self.windowDeltaSetting,
|
|
32
75
|
},
|
|
33
76
|
};
|
|
34
77
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-gccontent",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "JBrowse 2 gccontent concepts",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"distModule": "esm/index.js",
|
|
54
54
|
"srcModule": "src/index.ts",
|
|
55
55
|
"module": "esm/index.js",
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "9052b295f2d322e729254457ed9fe2231fb22cce"
|
|
57
57
|
}
|