@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.
- package/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +2 -3
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +4 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +21 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/model.js +39 -9
- package/BaseFeatureWidget/stateModelFactory.d.ts +1 -1
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +5 -0
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +10 -0
- package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +2 -1
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +10 -10
- package/package.json +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AssemblySelector.js +5 -2
- package/ui/FileSelector/UrlChooser.js +3 -1
- package/ui/SanitizedHTML.js +4 -1
- package/ui/theme.js +28 -48
- package/util/index.d.ts +13 -13
- package/util/index.js +74 -53
- package/util/simpleFeature.d.ts +0 -8
- package/util/stats.d.ts +1 -8
- package/util/stats.js +0 -35
package/ui/AssemblySelector.js
CHANGED
|
@@ -57,9 +57,12 @@ const AssemblySelector = (0, mobx_react_1.observer)(function ({ session, onChang
|
|
|
57
57
|
}
|
|
58
58
|
}, [selection, onChange, selected]);
|
|
59
59
|
const error = assemblyNames.length ? '' : 'No configured assemblies';
|
|
60
|
-
return (react_1.default.createElement(material_1.TextField, { select: true, label: "Assembly", variant: "outlined", helperText: error || helperText, value: selection || '',
|
|
60
|
+
return (react_1.default.createElement(material_1.TextField, { select: true, label: "Assembly", variant: "outlined", helperText: error || helperText, value: selection || '', onChange: event => {
|
|
61
61
|
setLastSelected(event.target.value);
|
|
62
|
-
}, error: !!error,
|
|
62
|
+
}, error: !!error, disabled: !!error, className: classes.importFormEntry, ...TextFieldProps, slotProps: {
|
|
63
|
+
input: InputProps,
|
|
64
|
+
htmlInput: { 'data-testid': 'assembly-selector' },
|
|
65
|
+
} }, assemblyNames.map(name => {
|
|
63
66
|
const assembly = assemblyManager.get(name);
|
|
64
67
|
const displayName = assembly ? (0, configuration_1.getConf)(assembly, 'displayName') : '';
|
|
65
68
|
return (react_1.default.createElement(material_1.MenuItem, { key: name, value: name }, displayName || name));
|
|
@@ -8,11 +8,13 @@ const material_1 = require("@mui/material");
|
|
|
8
8
|
const mobx_react_1 = require("mobx-react");
|
|
9
9
|
const types_1 = require("../../util/types");
|
|
10
10
|
const UrlChooser = (0, mobx_react_1.observer)(function ({ location, setLocation, label, }) {
|
|
11
|
-
return (react_1.default.createElement(material_1.TextField, { fullWidth: true, variant: "outlined",
|
|
11
|
+
return (react_1.default.createElement(material_1.TextField, { fullWidth: true, variant: "outlined", defaultValue: location && (0, types_1.isUriLocation)(location) ? location.uri : '', label: label || 'Enter URL', onChange: event => {
|
|
12
12
|
setLocation({
|
|
13
13
|
uri: event.target.value.trim(),
|
|
14
14
|
locationType: 'UriLocation',
|
|
15
15
|
});
|
|
16
|
+
}, slotProps: {
|
|
17
|
+
htmlInput: { 'data-testid': 'urlInput' },
|
|
16
18
|
} }));
|
|
17
19
|
});
|
|
18
20
|
exports.default = UrlChooser;
|
package/ui/SanitizedHTML.js
CHANGED
|
@@ -68,9 +68,12 @@ function SanitizedHTML({ html: pre, className, }) {
|
|
|
68
68
|
// see https://github.com/cure53/DOMPurify/issues/317
|
|
69
69
|
// only have to add this once, and can't do it globally because dompurify
|
|
70
70
|
// not yet initialized at global scope
|
|
71
|
-
dompurify_1.default.addHook('afterSanitizeAttributes',
|
|
71
|
+
dompurify_1.default.addHook('afterSanitizeAttributes', node => {
|
|
72
|
+
// @ts-expect-error
|
|
72
73
|
if (node.tagName === 'A') {
|
|
74
|
+
// @ts-expect-error
|
|
73
75
|
node.setAttribute('rel', 'noopener noreferrer');
|
|
76
|
+
// @ts-expect-error
|
|
74
77
|
node.setAttribute('target', '_blank');
|
|
75
78
|
}
|
|
76
79
|
});
|
package/ui/theme.js
CHANGED
|
@@ -14,6 +14,7 @@ const midnight = '#0D233F';
|
|
|
14
14
|
const grape = '#721E63';
|
|
15
15
|
const forest = refTheme.palette.augmentColor({ color: { main: '#135560' } });
|
|
16
16
|
const mandarin = refTheme.palette.augmentColor({ color: { main: '#FFB11D' } });
|
|
17
|
+
const lightgrey = refTheme.palette.augmentColor({ color: { main: '#aaa' } });
|
|
17
18
|
const bases = {
|
|
18
19
|
A: refTheme.palette.augmentColor({ color: colors_1.green }),
|
|
19
20
|
C: refTheme.palette.augmentColor({ color: colors_1.blue }),
|
|
@@ -372,58 +373,37 @@ function createJBrowseBaseTheme(theme) {
|
|
|
372
373
|
}
|
|
373
374
|
function createJBrowseTheme(configTheme = {}, themes = exports.defaultThemes, themeName = 'default') {
|
|
374
375
|
return (0, styles_1.createTheme)(createJBrowseBaseTheme(themeName === 'default'
|
|
375
|
-
? (0, deepmerge_1.default)(themes.default,
|
|
376
|
+
? (0, deepmerge_1.default)(themes.default, augmentThemeColors(configTheme), {
|
|
376
377
|
arrayMerge: overwriteArrayMerge,
|
|
377
378
|
})
|
|
378
|
-
:
|
|
379
|
+
: addMissingColors(themes[themeName])));
|
|
379
380
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
? theme.palette.quaternary
|
|
396
|
-
: { color: theme.palette.quaternary }),
|
|
397
|
-
},
|
|
398
|
-
});
|
|
381
|
+
// MUI by default allows strings like '#f00' for primary and secondary and
|
|
382
|
+
// augments them to have light and dark variants but not for anything else, so
|
|
383
|
+
// we augment them here
|
|
384
|
+
function augmentThemeColors(theme = {}) {
|
|
385
|
+
var _a;
|
|
386
|
+
for (const entry of ['tertiary', 'quaternary', 'highlight']) {
|
|
387
|
+
if ((_a = theme.palette) === null || _a === void 0 ? void 0 : _a[entry]) {
|
|
388
|
+
theme = (0, deepmerge_1.default)(theme, {
|
|
389
|
+
palette: {
|
|
390
|
+
[entry]: refTheme.palette.augmentColor('color' in theme.palette[entry]
|
|
391
|
+
? theme.palette[entry]
|
|
392
|
+
: { color: theme.palette[entry] }),
|
|
393
|
+
},
|
|
394
|
+
});
|
|
395
|
+
}
|
|
399
396
|
}
|
|
400
397
|
return theme;
|
|
401
398
|
}
|
|
402
|
-
//
|
|
403
|
-
function
|
|
404
|
-
var _a, _b;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
palette:
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
},
|
|
413
|
-
}),
|
|
414
|
-
},
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
if (!((_b = theme.palette) === null || _b === void 0 ? void 0 : _b.tertiary)) {
|
|
418
|
-
theme = (0, deepmerge_1.default)(theme, {
|
|
419
|
-
palette: {
|
|
420
|
-
tertiary: refTheme.palette.augmentColor({
|
|
421
|
-
color: {
|
|
422
|
-
main: '#aaa',
|
|
423
|
-
},
|
|
424
|
-
}),
|
|
425
|
-
},
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
return theme;
|
|
399
|
+
// adds missing colors to users theme
|
|
400
|
+
function addMissingColors(theme = {}) {
|
|
401
|
+
var _a, _b, _c;
|
|
402
|
+
return augmentThemeColors((0, deepmerge_1.default)(theme, {
|
|
403
|
+
palette: {
|
|
404
|
+
quaternary: ((_a = theme.palette) === null || _a === void 0 ? void 0 : _a.quaternary) || lightgrey,
|
|
405
|
+
tertiary: ((_b = theme.palette) === null || _b === void 0 ? void 0 : _b.tertiary) || lightgrey,
|
|
406
|
+
highlight: ((_c = theme.palette) === null || _c === void 0 ? void 0 : _c.highlight) || mandarin,
|
|
407
|
+
},
|
|
408
|
+
}));
|
|
429
409
|
}
|
package/util/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import { Feature } from './simpleFeature';
|
|
|
7
7
|
import { AssemblyManager, Region, TypeTestedByPredicate } from './types';
|
|
8
8
|
import type { Region as MUIRegion } from './types/mst';
|
|
9
9
|
import { BaseBlock } from './blockTypes';
|
|
10
|
+
import { GenericFilehandle } from 'generic-filehandle';
|
|
11
|
+
import { BaseOptions } from '../data_adapters/BaseAdapter';
|
|
10
12
|
export * from './types';
|
|
11
13
|
export * from './aborting';
|
|
12
14
|
export * from './when';
|
|
@@ -163,21 +165,17 @@ export declare function polarToCartesian(rho: number, theta: number): [number, n
|
|
|
163
165
|
* @returns [rho, theta]
|
|
164
166
|
*/
|
|
165
167
|
export declare function cartesianToPolar(x: number, y: number): [number, number];
|
|
166
|
-
|
|
168
|
+
interface MinimalRegion {
|
|
167
169
|
start: number;
|
|
168
170
|
end: number;
|
|
169
171
|
reversed?: boolean;
|
|
170
|
-
}
|
|
171
|
-
export declare function
|
|
172
|
-
|
|
173
|
-
end: number;
|
|
174
|
-
reversed?: boolean;
|
|
175
|
-
}, bpPerPx: number): [number, number];
|
|
172
|
+
}
|
|
173
|
+
export declare function featureSpanPx(feature: Feature, region: MinimalRegion, bpPerPx: number): readonly [number, number];
|
|
174
|
+
export declare function bpSpanPx(leftBp: number, rightBp: number, region: MinimalRegion, bpPerPx: number): readonly [number, number];
|
|
176
175
|
export declare function iterMap<T, U>(iter: Iterable<T>, func: (arg: T) => U, sizeHint?: number): U[];
|
|
177
176
|
/**
|
|
178
177
|
* Returns the index of the last element in the array where predicate is true,
|
|
179
|
-
* and -1 otherwise.
|
|
180
|
-
* Based on https://stackoverflow.com/a/53187807
|
|
178
|
+
* and -1 otherwise. Based on https://stackoverflow.com/a/53187807
|
|
181
179
|
*
|
|
182
180
|
* @param array - The source array to search in
|
|
183
181
|
*
|
|
@@ -231,9 +229,10 @@ export declare function stringify({ refName, coord, assemblyName, oob, }: {
|
|
|
231
229
|
oob?: boolean;
|
|
232
230
|
}, useAssemblyName?: boolean): string;
|
|
233
231
|
export declare const isElectron: boolean;
|
|
234
|
-
export declare
|
|
235
|
-
export declare function
|
|
236
|
-
export declare
|
|
232
|
+
export declare const complementTable: Record<string, string>;
|
|
233
|
+
export declare function revcom(str: string): string;
|
|
234
|
+
export declare function reverse(str: string): string;
|
|
235
|
+
export declare function complement(str: string): string;
|
|
237
236
|
export declare const rIC: (((callback: IdleRequestCallback, options?: IdleRequestOptions) => number) & typeof requestIdleCallback) | ((cb: () => void) => void);
|
|
238
237
|
export declare function measureText(str: unknown, fontSize?: number): number;
|
|
239
238
|
export type Frame = 1 | 2 | 3 | -1 | -2 | -3;
|
|
@@ -406,5 +405,6 @@ export declare function renderToStaticMarkup(node: React.ReactElement, createRoo
|
|
|
406
405
|
render: (node: React.ReactElement) => unknown;
|
|
407
406
|
}): string;
|
|
408
407
|
export declare function isGzip(buf: Buffer): boolean;
|
|
409
|
-
export
|
|
408
|
+
export declare function fetchAndMaybeUnzip(loc: GenericFilehandle, opts?: BaseOptions): Promise<Buffer>;
|
|
409
|
+
export { isFeature, default as SimpleFeature, type Feature, type SimpleFeatureSerialized, type SimpleFeatureSerializedNoId, } from './simpleFeature';
|
|
410
410
|
export { blobToDataURL } from './blobToDataURL';
|
package/util/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.blobToDataURL = exports.
|
|
20
|
+
exports.blobToDataURL = exports.SimpleFeature = exports.isFeature = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.rIC = exports.complementTable = exports.isElectron = void 0;
|
|
21
21
|
exports.useDebounce = useDebounce;
|
|
22
22
|
exports.useWidthSetter = useWidthSetter;
|
|
23
23
|
exports.useDebouncedCallback = useDebouncedCallback;
|
|
@@ -53,6 +53,7 @@ exports.shorten = shorten;
|
|
|
53
53
|
exports.stringify = stringify;
|
|
54
54
|
exports.revcom = revcom;
|
|
55
55
|
exports.reverse = reverse;
|
|
56
|
+
exports.complement = complement;
|
|
56
57
|
exports.measureText = measureText;
|
|
57
58
|
exports.getFrame = getFrame;
|
|
58
59
|
exports.generateCodonTable = generateCodonTable;
|
|
@@ -88,6 +89,7 @@ exports.getStrokeProps = getStrokeProps;
|
|
|
88
89
|
exports.getFillProps = getFillProps;
|
|
89
90
|
exports.renderToStaticMarkup = renderToStaticMarkup;
|
|
90
91
|
exports.isGzip = isGzip;
|
|
92
|
+
exports.fetchAndMaybeUnzip = fetchAndMaybeUnzip;
|
|
91
93
|
const react_1 = require("react");
|
|
92
94
|
const is_object_1 = __importDefault(require("is-object"));
|
|
93
95
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
@@ -100,6 +102,7 @@ const useMeasure_1 = __importDefault(require("@jbrowse/core/util/useMeasure"));
|
|
|
100
102
|
const colord_1 = require("./colord");
|
|
101
103
|
// eslint-disable-next-line react/no-deprecated
|
|
102
104
|
const react_dom_1 = require("react-dom");
|
|
105
|
+
const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
|
|
103
106
|
__exportStar(require("./types"), exports);
|
|
104
107
|
__exportStar(require("./aborting"), exports);
|
|
105
108
|
__exportStar(require("./when"), exports);
|
|
@@ -607,8 +610,7 @@ function iterMap(iter, func, sizeHint) {
|
|
|
607
610
|
}
|
|
608
611
|
/**
|
|
609
612
|
* Returns the index of the last element in the array where predicate is true,
|
|
610
|
-
* and -1 otherwise.
|
|
611
|
-
* Based on https://stackoverflow.com/a/53187807
|
|
613
|
+
* and -1 otherwise. Based on https://stackoverflow.com/a/53187807
|
|
612
614
|
*
|
|
613
615
|
* @param array - The source array to search in
|
|
614
616
|
*
|
|
@@ -766,55 +768,67 @@ function stringify({ refName, coord, assemblyName, oob, }, useAssemblyName) {
|
|
|
766
768
|
// const isElectron = process.versions.electron
|
|
767
769
|
// const i2 = process.versions.hasOwnProperty('electron')
|
|
768
770
|
exports.isElectron = /electron/i.test(typeof navigator !== 'undefined' ? navigator.userAgent : '');
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
771
|
+
// from bioperl: tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/
|
|
772
|
+
// generated with:
|
|
773
|
+
// perl -MJSON -E '@l = split "","acgtrymkswhbvdnxACGTRYMKSWHBVDNX"; print to_json({ map { my $in = $_; tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/; $in => $_ } @l})'
|
|
774
|
+
exports.complementTable = {
|
|
775
|
+
S: 'S',
|
|
776
|
+
w: 'w',
|
|
777
|
+
T: 'A',
|
|
778
|
+
r: 'y',
|
|
779
|
+
a: 't',
|
|
780
|
+
N: 'N',
|
|
781
|
+
K: 'M',
|
|
782
|
+
x: 'x',
|
|
783
|
+
d: 'h',
|
|
784
|
+
Y: 'R',
|
|
785
|
+
V: 'B',
|
|
786
|
+
y: 'r',
|
|
787
|
+
M: 'K',
|
|
788
|
+
h: 'd',
|
|
789
|
+
k: 'm',
|
|
790
|
+
C: 'G',
|
|
791
|
+
g: 'c',
|
|
792
|
+
t: 'a',
|
|
793
|
+
A: 'T',
|
|
794
|
+
n: 'n',
|
|
795
|
+
W: 'W',
|
|
796
|
+
X: 'X',
|
|
797
|
+
m: 'k',
|
|
798
|
+
v: 'b',
|
|
799
|
+
B: 'V',
|
|
800
|
+
s: 's',
|
|
801
|
+
H: 'D',
|
|
802
|
+
c: 'g',
|
|
803
|
+
D: 'H',
|
|
804
|
+
b: 'v',
|
|
805
|
+
R: 'Y',
|
|
806
|
+
G: 'C',
|
|
807
|
+
};
|
|
808
|
+
function revcom(str) {
|
|
809
|
+
var _a;
|
|
810
|
+
let revcomped = '';
|
|
811
|
+
for (let i = str.length - 1; i >= 0; i--) {
|
|
812
|
+
revcomped += (_a = exports.complementTable[str[i]]) !== null && _a !== void 0 ? _a : str[i];
|
|
813
|
+
}
|
|
814
|
+
return revcomped;
|
|
815
|
+
}
|
|
816
|
+
function reverse(str) {
|
|
817
|
+
let reversed = '';
|
|
818
|
+
for (let i = str.length - 1; i >= 0; i--) {
|
|
819
|
+
reversed += str[i];
|
|
820
|
+
}
|
|
821
|
+
return reversed;
|
|
822
|
+
}
|
|
823
|
+
function complement(str) {
|
|
824
|
+
var _a;
|
|
825
|
+
let comp = '';
|
|
826
|
+
// eslint-disable-next-line @typescript-eslint/prefer-for-of
|
|
827
|
+
for (let i = 0; i < str.length; i++) {
|
|
828
|
+
comp += (_a = exports.complementTable[str[i]]) !== null && _a !== void 0 ? _a : str[i];
|
|
829
|
+
}
|
|
830
|
+
return comp;
|
|
831
|
+
}
|
|
818
832
|
// requires immediate execution in jest environment, because (hypothesis) it
|
|
819
833
|
// otherwise listens for prerendered_canvas but reads empty pixels, and doesn't
|
|
820
834
|
// get the contents of the canvas
|
|
@@ -1213,8 +1227,15 @@ function renderToStaticMarkup(node, createRootFn) {
|
|
|
1213
1227
|
function isGzip(buf) {
|
|
1214
1228
|
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
1215
1229
|
}
|
|
1230
|
+
async function fetchAndMaybeUnzip(loc, opts) {
|
|
1231
|
+
const { statusCallback = () => { } } = opts || {};
|
|
1232
|
+
const buf = (await updateStatus('Downloading file', statusCallback, () => loc.readFile(opts)));
|
|
1233
|
+
return isGzip(buf)
|
|
1234
|
+
? await updateStatus('Unzipping', statusCallback, () => (0, bgzf_filehandle_1.unzip)(buf))
|
|
1235
|
+
: buf;
|
|
1236
|
+
}
|
|
1216
1237
|
var simpleFeature_1 = require("./simpleFeature");
|
|
1217
|
-
Object.defineProperty(exports, "SimpleFeature", { enumerable: true, get: function () { return __importDefault(simpleFeature_1).default; } });
|
|
1218
1238
|
Object.defineProperty(exports, "isFeature", { enumerable: true, get: function () { return simpleFeature_1.isFeature; } });
|
|
1239
|
+
Object.defineProperty(exports, "SimpleFeature", { enumerable: true, get: function () { return __importDefault(simpleFeature_1).default; } });
|
|
1219
1240
|
var blobToDataURL_1 = require("./blobToDataURL");
|
|
1220
1241
|
Object.defineProperty(exports, "blobToDataURL", { enumerable: true, get: function () { return blobToDataURL_1.blobToDataURL; } });
|
package/util/simpleFeature.d.ts
CHANGED
|
@@ -10,14 +10,6 @@ export interface Feature {
|
|
|
10
10
|
get(name: 'start' | 'end'): number;
|
|
11
11
|
get(name: 'subfeatures'): Feature[] | undefined;
|
|
12
12
|
get(name: string): any;
|
|
13
|
-
/**
|
|
14
|
-
* Set an item of data.
|
|
15
|
-
*/
|
|
16
|
-
set(name: string, val: any): void;
|
|
17
|
-
/**
|
|
18
|
-
* Get an array listing which data keys are present in this feature.
|
|
19
|
-
*/
|
|
20
|
-
tags(): string[];
|
|
21
13
|
/**
|
|
22
14
|
* Get the unique ID of this feature.
|
|
23
15
|
*/
|
package/util/stats.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface UnrectifiedQuantitativeStats {
|
|
|
10
10
|
basesCovered: number;
|
|
11
11
|
}
|
|
12
12
|
export interface QuantitativeStats extends UnrectifiedQuantitativeStats {
|
|
13
|
+
currStatsBpPerPx: number;
|
|
13
14
|
featureDensity: number;
|
|
14
15
|
scoreMean: number;
|
|
15
16
|
scoreStdDev: number;
|
|
@@ -32,14 +33,6 @@ export declare function calcStdFromSums(sum: number, sumSquares: number, n: numb
|
|
|
32
33
|
* scoreMean, scoreStdDev, and featureDensity added
|
|
33
34
|
*/
|
|
34
35
|
export declare function rectifyStats(s: UnrectifiedQuantitativeStats): QuantitativeStats;
|
|
35
|
-
/**
|
|
36
|
-
* calculates per-base scores for variable width features over a region
|
|
37
|
-
*
|
|
38
|
-
* @param region - object contains start, end
|
|
39
|
-
* @param features - list of features with start, end, score
|
|
40
|
-
* @returns array of numeric scores
|
|
41
|
-
*/
|
|
42
|
-
export declare function calcPerBaseStats(region: NoAssemblyRegion, features: Feature[]): number[];
|
|
43
36
|
/**
|
|
44
37
|
* transform a list of scores to summary statistics
|
|
45
38
|
*
|
package/util/stats.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calcStdFromSums = calcStdFromSums;
|
|
4
4
|
exports.rectifyStats = rectifyStats;
|
|
5
|
-
exports.calcPerBaseStats = calcPerBaseStats;
|
|
6
5
|
exports.scoresToStats = scoresToStats;
|
|
7
6
|
exports.blankStats = blankStats;
|
|
8
7
|
const rxjs_1 = require("rxjs");
|
|
@@ -48,40 +47,6 @@ function rectifyStats(s) {
|
|
|
48
47
|
featureDensity: (s.featureCount || 1) / s.basesCovered,
|
|
49
48
|
};
|
|
50
49
|
}
|
|
51
|
-
/**
|
|
52
|
-
* calculates per-base scores for variable width features over a region
|
|
53
|
-
*
|
|
54
|
-
* @param region - object contains start, end
|
|
55
|
-
* @param features - list of features with start, end, score
|
|
56
|
-
* @returns array of numeric scores
|
|
57
|
-
*/
|
|
58
|
-
function calcPerBaseStats(region, features) {
|
|
59
|
-
const { start, end } = region;
|
|
60
|
-
const scores = [];
|
|
61
|
-
const feats = features.sort((a, b) => a.get('start') - b.get('start'));
|
|
62
|
-
let pos = start;
|
|
63
|
-
let currentFeat = 0;
|
|
64
|
-
let i = 0;
|
|
65
|
-
while (pos < end) {
|
|
66
|
-
while (currentFeat < feats.length &&
|
|
67
|
-
pos >= feats[currentFeat].get('end')) {
|
|
68
|
-
currentFeat += 1;
|
|
69
|
-
}
|
|
70
|
-
const f = feats[currentFeat];
|
|
71
|
-
if (!f) {
|
|
72
|
-
scores[i] = 0;
|
|
73
|
-
}
|
|
74
|
-
else if (pos >= f.get('start') && pos < f.get('end')) {
|
|
75
|
-
scores[i] = f.get('score');
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
scores[i] = 0;
|
|
79
|
-
}
|
|
80
|
-
i += 1;
|
|
81
|
-
pos += 1;
|
|
82
|
-
}
|
|
83
|
-
return scores;
|
|
84
|
-
}
|
|
85
50
|
/**
|
|
86
51
|
* transform a list of scores to summary statistics
|
|
87
52
|
*
|