@jbrowse/plugin-wiggle 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.
- package/dist/BigWigAdapter/BigWigAdapter.js +2 -1
- package/dist/BigWigAdapter/configSchema.d.ts +8 -0
- package/dist/BigWigAdapter/configSchema.js +8 -0
- package/dist/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +52 -44
- package/esm/BigWigAdapter/BigWigAdapter.js +2 -1
- package/esm/BigWigAdapter/configSchema.d.ts +8 -0
- package/esm/BigWigAdapter/configSchema.js +8 -0
- package/esm/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +52 -44
- package/package.json +2 -2
|
@@ -44,10 +44,11 @@ class BigWigAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
44
44
|
return (0, rxjs_1.ObservableCreate)(async (observer) => {
|
|
45
45
|
statusCallback('Downloading bigwig data');
|
|
46
46
|
const source = this.getConf('source');
|
|
47
|
+
const resolutionMultiplier = this.getConf('resolutionMultiplier');
|
|
47
48
|
const { bigwig } = await this.setup(opts);
|
|
48
49
|
const feats = await bigwig.getFeatures(refName, start, end, {
|
|
49
50
|
...opts,
|
|
50
|
-
basesPerSpan: bpPerPx / resolution,
|
|
51
|
+
basesPerSpan: (bpPerPx / resolution) * resolutionMultiplier,
|
|
51
52
|
});
|
|
52
53
|
for (const data of feats) {
|
|
53
54
|
if (source) {
|
|
@@ -17,5 +17,13 @@ declare const BigWigAdapter: import("@jbrowse/core/configuration/configurationSc
|
|
|
17
17
|
defaultValue: string;
|
|
18
18
|
description: string;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* #slot
|
|
22
|
+
*/
|
|
23
|
+
resolutionMultiplier: {
|
|
24
|
+
type: string;
|
|
25
|
+
defaultValue: number;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
20
28
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
21
29
|
export default BigWigAdapter;
|
|
@@ -24,5 +24,13 @@ const BigWigAdapter = (0, configuration_1.ConfigurationSchema)('BigWigAdapter',
|
|
|
24
24
|
defaultValue: '',
|
|
25
25
|
description: 'Used for multiwiggle',
|
|
26
26
|
},
|
|
27
|
+
/**
|
|
28
|
+
* #slot
|
|
29
|
+
*/
|
|
30
|
+
resolutionMultiplier: {
|
|
31
|
+
type: 'number',
|
|
32
|
+
defaultValue: 1,
|
|
33
|
+
description: 'Initial resolution multiplier',
|
|
34
|
+
},
|
|
27
35
|
}, { explicitlyTyped: true });
|
|
28
36
|
exports.default = BigWigAdapter;
|
|
@@ -30,9 +30,6 @@ const mui_1 = require("tss-react/mui");
|
|
|
30
30
|
const util_1 = require("@jbrowse/core/util");
|
|
31
31
|
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
32
32
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
33
|
-
textbox: {
|
|
34
|
-
width: '100%',
|
|
35
|
-
},
|
|
36
33
|
paper: {
|
|
37
34
|
margin: theme.spacing(),
|
|
38
35
|
padding: theme.spacing(),
|
|
@@ -43,6 +40,16 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
43
40
|
display: 'block',
|
|
44
41
|
},
|
|
45
42
|
}));
|
|
43
|
+
// on electron, use path to LocalFileLocation, on web, use the BlobLocation
|
|
44
|
+
function makeFileLocation(file) {
|
|
45
|
+
const { webUtils } = window.require('electron');
|
|
46
|
+
return util_1.isElectron
|
|
47
|
+
? {
|
|
48
|
+
localPath: webUtils.getPathForFile(file),
|
|
49
|
+
locationType: 'LocalPathLocation',
|
|
50
|
+
}
|
|
51
|
+
: (0, tracks_1.storeBlobLocation)({ blob: file });
|
|
52
|
+
}
|
|
46
53
|
function MultiWiggleWidget({ model }) {
|
|
47
54
|
const { classes } = useStyles();
|
|
48
55
|
const [val, setVal] = (0, react_1.useState)('');
|
|
@@ -51,64 +58,65 @@ function MultiWiggleWidget({ model }) {
|
|
|
51
58
|
react_1.default.createElement("ul", null,
|
|
52
59
|
react_1.default.createElement("li", null, "Enter list of URLs for bigwig files in the textbox"),
|
|
53
60
|
react_1.default.createElement("li", null, "Or, use the button below the text box to select files from your computer")),
|
|
54
|
-
react_1.default.createElement(material_1.TextField, { multiline: true, rows: 10, value: val, onChange: event => {
|
|
61
|
+
react_1.default.createElement(material_1.TextField, { multiline: true, fullWidth: true, rows: 10, value: val, placeholder: "Paste list of URLs here, or use file selector below", variant: "outlined", onChange: event => {
|
|
55
62
|
setVal(event.target.value);
|
|
56
|
-
}
|
|
63
|
+
} }),
|
|
57
64
|
react_1.default.createElement(material_1.Button, { variant: "outlined", component: "label" },
|
|
58
65
|
"Choose Files from your computer",
|
|
59
66
|
react_1.default.createElement("input", { type: "file", hidden: true, multiple: true, onChange: ({ target }) => {
|
|
60
67
|
const res = [...(target.files || [])].map(file => ({
|
|
61
68
|
type: 'BigWigAdapter',
|
|
62
|
-
bigWigLocation:
|
|
63
|
-
? {
|
|
64
|
-
localPath: file.path,
|
|
65
|
-
locationType: 'LocalPathLocation',
|
|
66
|
-
}
|
|
67
|
-
: (0, tracks_1.storeBlobLocation)({ blob: file }),
|
|
69
|
+
bigWigLocation: makeFileLocation(file),
|
|
68
70
|
source: file.name,
|
|
69
71
|
}));
|
|
70
72
|
setVal(JSON.stringify(res, null, 2));
|
|
71
73
|
} })),
|
|
72
|
-
react_1.default.createElement(material_1.TextField, { value: trackName, onChange: event => {
|
|
74
|
+
react_1.default.createElement(material_1.TextField, { value: trackName, helperText: "Track name", onChange: event => {
|
|
73
75
|
setTrackName(event.target.value);
|
|
74
|
-
}
|
|
76
|
+
} }),
|
|
75
77
|
react_1.default.createElement(material_1.Button, { variant: "contained", className: classes.submit, onClick: () => {
|
|
76
78
|
var _a;
|
|
77
79
|
const session = (0, util_1.getSession)(model);
|
|
78
|
-
const trackId = [
|
|
79
|
-
`${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
|
|
80
|
-
session.adminMode ? '' : '-sessionTrack',
|
|
81
|
-
].join('');
|
|
82
|
-
// allow list of bigwigs in JSON format or line-by-line
|
|
83
|
-
let bigWigs;
|
|
84
80
|
try {
|
|
85
|
-
|
|
81
|
+
const trackId = [
|
|
82
|
+
`${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
|
|
83
|
+
session.adminMode ? '' : '-sessionTrack',
|
|
84
|
+
].join('');
|
|
85
|
+
// allow list of bigwigs in JSON format or line-by-line
|
|
86
|
+
let bigWigs;
|
|
87
|
+
try {
|
|
88
|
+
bigWigs = JSON.parse(val);
|
|
89
|
+
}
|
|
90
|
+
catch (e) {
|
|
91
|
+
bigWigs = val
|
|
92
|
+
.split(/\n|\r\n|\r/)
|
|
93
|
+
.map(f => f.trim())
|
|
94
|
+
.filter(f => !!f);
|
|
95
|
+
}
|
|
96
|
+
const obj = typeof bigWigs[0] === 'string'
|
|
97
|
+
? { bigWigs }
|
|
98
|
+
: { subadapters: bigWigs };
|
|
99
|
+
if ((0, util_1.isSessionWithAddTracks)(session)) {
|
|
100
|
+
session.addTrackConf({
|
|
101
|
+
trackId,
|
|
102
|
+
type: 'MultiQuantitativeTrack',
|
|
103
|
+
name: trackName,
|
|
104
|
+
assemblyNames: [model.assembly],
|
|
105
|
+
adapter: {
|
|
106
|
+
type: 'MultiWiggleAdapter',
|
|
107
|
+
...obj,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
(_a = model.view) === null || _a === void 0 ? void 0 : _a.showTrack(trackId);
|
|
111
|
+
}
|
|
112
|
+
model.clearData();
|
|
113
|
+
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
114
|
+
session.hideWidget(model);
|
|
115
|
+
}
|
|
86
116
|
}
|
|
87
117
|
catch (e) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.map(f => f.trim())
|
|
91
|
-
.filter(f => !!f);
|
|
92
|
-
}
|
|
93
|
-
const obj = typeof bigWigs[0] === 'string'
|
|
94
|
-
? { bigWigs }
|
|
95
|
-
: { subadapters: bigWigs };
|
|
96
|
-
if ((0, util_1.isSessionWithAddTracks)(session)) {
|
|
97
|
-
session.addTrackConf({
|
|
98
|
-
trackId,
|
|
99
|
-
type: 'MultiQuantitativeTrack',
|
|
100
|
-
name: trackName,
|
|
101
|
-
assemblyNames: [model.assembly],
|
|
102
|
-
adapter: {
|
|
103
|
-
type: 'MultiWiggleAdapter',
|
|
104
|
-
...obj,
|
|
105
|
-
},
|
|
106
|
-
});
|
|
107
|
-
(_a = model.view) === null || _a === void 0 ? void 0 : _a.showTrack(trackId);
|
|
108
|
-
}
|
|
109
|
-
model.clearData();
|
|
110
|
-
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
111
|
-
session.hideWidget(model);
|
|
118
|
+
console.error(e);
|
|
119
|
+
session.notifyError(`${e}`, e);
|
|
112
120
|
}
|
|
113
121
|
} }, "Submit"),
|
|
114
122
|
react_1.default.createElement("p", null, "Additional notes: "),
|
|
@@ -42,10 +42,11 @@ class BigWigAdapter extends BaseFeatureDataAdapter {
|
|
|
42
42
|
return ObservableCreate(async (observer) => {
|
|
43
43
|
statusCallback('Downloading bigwig data');
|
|
44
44
|
const source = this.getConf('source');
|
|
45
|
+
const resolutionMultiplier = this.getConf('resolutionMultiplier');
|
|
45
46
|
const { bigwig } = await this.setup(opts);
|
|
46
47
|
const feats = await bigwig.getFeatures(refName, start, end, {
|
|
47
48
|
...opts,
|
|
48
|
-
basesPerSpan: bpPerPx / resolution,
|
|
49
|
+
basesPerSpan: (bpPerPx / resolution) * resolutionMultiplier,
|
|
49
50
|
});
|
|
50
51
|
for (const data of feats) {
|
|
51
52
|
if (source) {
|
|
@@ -17,5 +17,13 @@ declare const BigWigAdapter: import("@jbrowse/core/configuration/configurationSc
|
|
|
17
17
|
defaultValue: string;
|
|
18
18
|
description: string;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* #slot
|
|
22
|
+
*/
|
|
23
|
+
resolutionMultiplier: {
|
|
24
|
+
type: string;
|
|
25
|
+
defaultValue: number;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
20
28
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
21
29
|
export default BigWigAdapter;
|
|
@@ -22,5 +22,13 @@ const BigWigAdapter = ConfigurationSchema('BigWigAdapter', {
|
|
|
22
22
|
defaultValue: '',
|
|
23
23
|
description: 'Used for multiwiggle',
|
|
24
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* #slot
|
|
27
|
+
*/
|
|
28
|
+
resolutionMultiplier: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
defaultValue: 1,
|
|
31
|
+
description: 'Initial resolution multiplier',
|
|
32
|
+
},
|
|
25
33
|
}, { explicitlyTyped: true });
|
|
26
34
|
export default BigWigAdapter;
|
|
@@ -4,9 +4,6 @@ import { makeStyles } from 'tss-react/mui';
|
|
|
4
4
|
import { getSession, isElectron, isSessionModelWithWidgets, isSessionWithAddTracks, } from '@jbrowse/core/util';
|
|
5
5
|
import { storeBlobLocation } from '@jbrowse/core/util/tracks';
|
|
6
6
|
const useStyles = makeStyles()(theme => ({
|
|
7
|
-
textbox: {
|
|
8
|
-
width: '100%',
|
|
9
|
-
},
|
|
10
7
|
paper: {
|
|
11
8
|
margin: theme.spacing(),
|
|
12
9
|
padding: theme.spacing(),
|
|
@@ -17,6 +14,16 @@ const useStyles = makeStyles()(theme => ({
|
|
|
17
14
|
display: 'block',
|
|
18
15
|
},
|
|
19
16
|
}));
|
|
17
|
+
// on electron, use path to LocalFileLocation, on web, use the BlobLocation
|
|
18
|
+
function makeFileLocation(file) {
|
|
19
|
+
const { webUtils } = window.require('electron');
|
|
20
|
+
return isElectron
|
|
21
|
+
? {
|
|
22
|
+
localPath: webUtils.getPathForFile(file),
|
|
23
|
+
locationType: 'LocalPathLocation',
|
|
24
|
+
}
|
|
25
|
+
: storeBlobLocation({ blob: file });
|
|
26
|
+
}
|
|
20
27
|
export default function MultiWiggleWidget({ model }) {
|
|
21
28
|
const { classes } = useStyles();
|
|
22
29
|
const [val, setVal] = useState('');
|
|
@@ -25,64 +32,65 @@ export default function MultiWiggleWidget({ model }) {
|
|
|
25
32
|
React.createElement("ul", null,
|
|
26
33
|
React.createElement("li", null, "Enter list of URLs for bigwig files in the textbox"),
|
|
27
34
|
React.createElement("li", null, "Or, use the button below the text box to select files from your computer")),
|
|
28
|
-
React.createElement(TextField, { multiline: true, rows: 10, value: val, onChange: event => {
|
|
35
|
+
React.createElement(TextField, { multiline: true, fullWidth: true, rows: 10, value: val, placeholder: "Paste list of URLs here, or use file selector below", variant: "outlined", onChange: event => {
|
|
29
36
|
setVal(event.target.value);
|
|
30
|
-
}
|
|
37
|
+
} }),
|
|
31
38
|
React.createElement(Button, { variant: "outlined", component: "label" },
|
|
32
39
|
"Choose Files from your computer",
|
|
33
40
|
React.createElement("input", { type: "file", hidden: true, multiple: true, onChange: ({ target }) => {
|
|
34
41
|
const res = [...(target.files || [])].map(file => ({
|
|
35
42
|
type: 'BigWigAdapter',
|
|
36
|
-
bigWigLocation:
|
|
37
|
-
? {
|
|
38
|
-
localPath: file.path,
|
|
39
|
-
locationType: 'LocalPathLocation',
|
|
40
|
-
}
|
|
41
|
-
: storeBlobLocation({ blob: file }),
|
|
43
|
+
bigWigLocation: makeFileLocation(file),
|
|
42
44
|
source: file.name,
|
|
43
45
|
}));
|
|
44
46
|
setVal(JSON.stringify(res, null, 2));
|
|
45
47
|
} })),
|
|
46
|
-
React.createElement(TextField, { value: trackName, onChange: event => {
|
|
48
|
+
React.createElement(TextField, { value: trackName, helperText: "Track name", onChange: event => {
|
|
47
49
|
setTrackName(event.target.value);
|
|
48
|
-
}
|
|
50
|
+
} }),
|
|
49
51
|
React.createElement(Button, { variant: "contained", className: classes.submit, onClick: () => {
|
|
50
52
|
var _a;
|
|
51
53
|
const session = getSession(model);
|
|
52
|
-
const trackId = [
|
|
53
|
-
`${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
|
|
54
|
-
session.adminMode ? '' : '-sessionTrack',
|
|
55
|
-
].join('');
|
|
56
|
-
// allow list of bigwigs in JSON format or line-by-line
|
|
57
|
-
let bigWigs;
|
|
58
54
|
try {
|
|
59
|
-
|
|
55
|
+
const trackId = [
|
|
56
|
+
`${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
|
|
57
|
+
session.adminMode ? '' : '-sessionTrack',
|
|
58
|
+
].join('');
|
|
59
|
+
// allow list of bigwigs in JSON format or line-by-line
|
|
60
|
+
let bigWigs;
|
|
61
|
+
try {
|
|
62
|
+
bigWigs = JSON.parse(val);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
bigWigs = val
|
|
66
|
+
.split(/\n|\r\n|\r/)
|
|
67
|
+
.map(f => f.trim())
|
|
68
|
+
.filter(f => !!f);
|
|
69
|
+
}
|
|
70
|
+
const obj = typeof bigWigs[0] === 'string'
|
|
71
|
+
? { bigWigs }
|
|
72
|
+
: { subadapters: bigWigs };
|
|
73
|
+
if (isSessionWithAddTracks(session)) {
|
|
74
|
+
session.addTrackConf({
|
|
75
|
+
trackId,
|
|
76
|
+
type: 'MultiQuantitativeTrack',
|
|
77
|
+
name: trackName,
|
|
78
|
+
assemblyNames: [model.assembly],
|
|
79
|
+
adapter: {
|
|
80
|
+
type: 'MultiWiggleAdapter',
|
|
81
|
+
...obj,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
(_a = model.view) === null || _a === void 0 ? void 0 : _a.showTrack(trackId);
|
|
85
|
+
}
|
|
86
|
+
model.clearData();
|
|
87
|
+
if (isSessionModelWithWidgets(session)) {
|
|
88
|
+
session.hideWidget(model);
|
|
89
|
+
}
|
|
60
90
|
}
|
|
61
91
|
catch (e) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
.map(f => f.trim())
|
|
65
|
-
.filter(f => !!f);
|
|
66
|
-
}
|
|
67
|
-
const obj = typeof bigWigs[0] === 'string'
|
|
68
|
-
? { bigWigs }
|
|
69
|
-
: { subadapters: bigWigs };
|
|
70
|
-
if (isSessionWithAddTracks(session)) {
|
|
71
|
-
session.addTrackConf({
|
|
72
|
-
trackId,
|
|
73
|
-
type: 'MultiQuantitativeTrack',
|
|
74
|
-
name: trackName,
|
|
75
|
-
assemblyNames: [model.assembly],
|
|
76
|
-
adapter: {
|
|
77
|
-
type: 'MultiWiggleAdapter',
|
|
78
|
-
...obj,
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
(_a = model.view) === null || _a === void 0 ? void 0 : _a.showTrack(trackId);
|
|
82
|
-
}
|
|
83
|
-
model.clearData();
|
|
84
|
-
if (isSessionModelWithWidgets(session)) {
|
|
85
|
-
session.hideWidget(model);
|
|
92
|
+
console.error(e);
|
|
93
|
+
session.notifyError(`${e}`, e);
|
|
86
94
|
}
|
|
87
95
|
} }, "Submit"),
|
|
88
96
|
React.createElement("p", null, "Additional notes: "),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-wiggle",
|
|
3
|
-
"version": "2.16.
|
|
3
|
+
"version": "2.16.1",
|
|
4
4
|
"description": "JBrowse 2 wiggle adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"distModule": "esm/index.js",
|
|
66
66
|
"srcModule": "src/index.ts",
|
|
67
67
|
"module": "esm/index.js",
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "c6a658d2344989895543f0456b1cf7dd3b937769"
|
|
69
69
|
}
|