Skip to content

Commit 8b646d9

Browse files
committed
fix: update ml-spectra-processing and dependencies
1 parent 1c405b0 commit 8b646d9

26 files changed

+113
-107
lines changed

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,32 +55,32 @@
5555
"trailingComma": "all"
5656
},
5757
"devDependencies": {
58-
"@babel/plugin-transform-modules-commonjs": "^7.21.2",
59-
"@babel/preset-typescript": "^7.21.0",
60-
"@types/jest": "^29.5.0",
58+
"@babel/plugin-transform-modules-commonjs": "^7.23.3",
59+
"@babel/preset-typescript": "^7.23.3",
60+
"@types/jest": "^29.5.12",
6161
"chemcalc": "^3.4.1",
6262
"cheminfo-build": "^1.2.0",
63-
"eslint": "^8.36.0",
64-
"eslint-config-cheminfo-typescript": "^11.3.1",
65-
"eslint-plugin-jest": "^27.2.1",
63+
"eslint": "^8.57.0",
64+
"eslint-config-cheminfo-typescript": "^12.2.0",
65+
"eslint-plugin-jest": "^27.9.0",
6666
"esm": "^3.2.25",
67-
"jest": "^29.5.0",
67+
"jest": "^29.7.0",
6868
"jest-matcher-deep-close-to": "^3.0.2",
69-
"mf-global": "^2.1.2",
69+
"mf-global": "^3.0.16",
7070
"ml-stat": "^1.3.3",
71-
"nodemon": "^2.0.22",
72-
"prettier": "^2.8.7",
73-
"rimraf": "^4.4.1",
74-
"spectrum-generator": "^8.0.6",
75-
"typescript": "^5.0.2",
76-
"xy-parser": "^5.0.4"
71+
"nodemon": "^3.1.0",
72+
"prettier": "^3.2.5",
73+
"rimraf": "^5.0.5",
74+
"spectrum-generator": "^8.0.11",
75+
"typescript": "^5.4.2",
76+
"xy-parser": "^5.0.5"
7777
},
7878
"dependencies": {
79-
"@lukeed/uuid": "^2.0.0",
80-
"cheminfo-types": "^1.4.0",
79+
"@lukeed/uuid": "^2.0.1",
80+
"cheminfo-types": "^1.7.2",
8181
"ml-peak-shape-generator": "^4.1.2",
8282
"ml-savitzky-golay-generalized": "^4.0.1",
83-
"ml-spectra-fitting": "^4.2.1",
84-
"ml-spectra-processing": "^14.0.0"
83+
"ml-spectra-fitting": "^4.2.3",
84+
"ml-spectra-processing": "^14.2.0"
8585
}
8686
}

src/__tests__/ethylvinylether.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import { gsd } from '../gsd';
55
describe('Global spectra deconvolution NMR spectra', () => {
66
// Test case obtained from Pag 443, Chap 8.
77
it('Ethylvinylether should have 21 peaks', () => {
8-
let spectrum: number[][] = JSON.parse(
8+
const spectrum: number[][] = JSON.parse(
99
readFileSync(`${__dirname}/data/ethylvinylether.json`, 'utf-8'),
1010
);
11-
let result = gsd(
11+
const result = gsd(
1212
{ x: spectrum[0].reverse(), y: spectrum[1].reverse() },
1313
{
1414
minMaxRatio: 0.03,

src/__tests__/gaussian-noise.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,18 @@ describe('smooth:false option', () => {
2929
});
3030

3131
it('positive maxima peaks', () => {
32-
let peakList = gsd(data);
32+
const peakList = gsd(data);
3333
expect(peakList).toMatchCloseTo([
3434
{ x: -0.5, y: 1.131 },
3535
{ x: 0.5, y: 1.05 },
3636
]);
3737
});
3838

3939
it('negative maxima peaks', () => {
40-
let peakList = gsd({ x: data.x, y: data.y.map((value) => value - 2) }, {});
40+
const peakList = gsd(
41+
{ x: data.x, y: data.y.map((value) => value - 2) },
42+
{},
43+
);
4144
expect(peakList).toMatchCloseTo([
4245
{ x: -0.5, y: -0.868 },
4346
{ x: 0.5, y: -0.95 },
@@ -46,7 +49,7 @@ describe('smooth:false option', () => {
4649

4750
it('Negative peaks', () => {
4851
// we check negative peaks
49-
let peakList = gsd(
52+
const peakList = gsd(
5053
{ x: data.x, y: data.y.map((value) => -value) },
5154
{ maxCriteria: false },
5255
);
@@ -58,7 +61,7 @@ describe('smooth:false option', () => {
5861

5962
it('minima peaks', () => {
6063
// we check negative peaks
61-
let peakList = gsd(
64+
const peakList = gsd(
6265
{ x: data.x, y: data.y.map((value) => 1 - value) },
6366
{ maxCriteria: false },
6467
);

src/__tests__/gaussian-noiseParam.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@ describe('smooth:false option', () => {
2929
});
3030

3131
it('positive maxima peaks but noiseLevel over the peaks', () => {
32-
let peakList = gsd(data, { noiseLevel: 1.2 });
32+
const peakList = gsd(data, { noiseLevel: 1.2 });
3333
expect(peakList).toStrictEqual([]);
3434
});
3535

3636
it('positive maxima peaks', () => {
37-
let peakList = gsd(data, { noiseLevel: 0.5 });
37+
const peakList = gsd(data, { noiseLevel: 0.5 });
3838
expect(peakList).toMatchCloseTo([
3939
{ x: -0.5, y: 1.131 },
4040
{ x: 0.5, y: 1.05 },
4141
]);
4242
});
4343

4444
it('negative maxima peaks', () => {
45-
let peakList = gsd(
45+
const peakList = gsd(
4646
{ x: data.x, y: data.y.map((value) => value - 2) },
4747
{ noiseLevel: -1.5 },
4848
);
@@ -54,7 +54,7 @@ describe('smooth:false option', () => {
5454

5555
it('Negative peaks', () => {
5656
// we check negative peaks
57-
let peakList = gsd(
57+
const peakList = gsd(
5858
{ x: data.x, y: data.y.map((value) => -value) },
5959
{ maxCriteria: false, noiseLevel: -0.5 },
6060
);
@@ -66,7 +66,7 @@ describe('smooth:false option', () => {
6666

6767
it('Negative peaks with noiseLevel too low', () => {
6868
// we check negative peaks
69-
let peakList = gsd(
69+
const peakList = gsd(
7070
{ x: data.x, y: data.y.map((value) => -value) },
7171
{ maxCriteria: false, noiseLevel: -1.2 },
7272
);
@@ -75,7 +75,7 @@ describe('smooth:false option', () => {
7575

7676
it('minima peaks', () => {
7777
// we check negative peaks
78-
let peakList = gsd(
78+
const peakList = gsd(
7979
{ x: data.x, y: data.y.map((value) => 1 - value) },
8080
{ maxCriteria: false, noiseLevel: 0.5 },
8181
);

src/__tests__/gaussian-overlapping.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('gaussian overlapping', () => {
2727
},
2828
});
2929

30-
let peaks = gsd(data, {});
30+
const peaks = gsd(data, {});
3131
expect(peaks).toMatchCloseTo([
3232
{
3333
x: -0.1,
@@ -43,7 +43,7 @@ describe('gaussian overlapping', () => {
4343
},
4444
]);
4545

46-
let optimizedPeaks = optimizePeaks(data, peaks, { groupingFactor: 3 });
46+
const optimizedPeaks = optimizePeaks(data, peaks, { groupingFactor: 3 });
4747
expect(optimizedPeaks).toMatchCloseTo([
4848
{
4949
x: -0.1,

src/__tests__/gaussian-smooth.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('gaussian simulated peaks', () => {
2828
},
2929
});
3030

31-
let peakList = gsd(data, {
31+
const peakList = gsd(data, {
3232
smoothY: true,
3333
});
3434
expect(peakList).toBeDeepCloseTo([

src/__tests__/gaussian.test.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ describe('smooth:false option', () => {
2929
// we have here a low resolution spectrum so the impact is big
3030

3131
it('positive maxima peaks', () => {
32-
let peakList = gsd(data);
32+
const peakList = gsd(data);
3333

34-
let expected = [
34+
const expected = [
3535
{
3636
x: -0.5,
3737
y: 1,
@@ -59,9 +59,12 @@ describe('smooth:false option', () => {
5959
});
6060

6161
it('negative maxima peaks', () => {
62-
let peakList = gsd({ x: data.x, y: data.y.map((value) => value - 2) }, {});
62+
const peakList = gsd(
63+
{ x: data.x, y: data.y.map((value) => value - 2) },
64+
{},
65+
);
6366

64-
let expected = [
67+
const expected = [
6568
{
6669
x: -0.5,
6770
y: -1,
@@ -90,11 +93,11 @@ describe('smooth:false option', () => {
9093

9194
it('Negative peaks', () => {
9295
// we check negative peaks
93-
let peakList = gsd(
96+
const peakList = gsd(
9497
{ x: data.x, y: data.y.map((value) => -value) },
9598
{ maxCriteria: false },
9699
);
97-
let expected = [
100+
const expected = [
98101
{
99102
x: -0.5,
100103
y: -1,
@@ -124,11 +127,11 @@ describe('smooth:false option', () => {
124127

125128
it('minima peaks', () => {
126129
// we check negative peaks
127-
let peakList = gsd(
130+
const peakList = gsd(
128131
{ x: data.x, y: data.y.map((value) => 1 - value) },
129132
{ maxCriteria: false },
130133
);
131-
let expected = [
134+
const expected = [
132135
{
133136
x: -0.5,
134137
y: 0,
@@ -157,7 +160,7 @@ describe('smooth:false option', () => {
157160
});
158161

159162
it('negative peaks with maxCriteria true', () => {
160-
let peakList = gsd(
163+
const peakList = gsd(
161164
{ x: data.x, y: data.y.map((value) => -value) },
162165
{ maxCriteria: true },
163166
);

src/__tests__/power.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ describe('power', () => {
4848
// we have here a low resolution spectrum so the impact is big
4949

5050
it('default options', () => {
51-
let peakList = gsd(data);
52-
let expected = [
51+
const peakList = gsd(data);
52+
const expected = [
5353
{
5454
id: peakList[0].id,
5555
x: 5,
@@ -66,7 +66,7 @@ describe('power', () => {
6666
expect(peakList).toBeDeepCloseTo(expected);
6767
});
6868
it('custom options', () => {
69-
let peakList = gsd(data, {
69+
const peakList = gsd(data, {
7070
smoothY: false,
7171
sgOptions: { windowSize: 7, polynomial: 3 },
7272
});

src/__tests__/ubiquitin.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ expect.extend({ toBeDeepCloseTo, toMatchCloseTo });
1212

1313
describe('Global spectra deconvolution ubiquitin', () => {
1414
it('HR mass spectra', () => {
15-
let spectrum = parseXY(
15+
const spectrum = parseXY(
1616
readFileSync(`${__dirname}/data/ubiquitin.txt`, 'utf-8'),
1717
);
1818

19-
let peaks = gsd(spectrum, {
19+
const peaks = gsd(spectrum, {
2020
minMaxRatio: 0.0,
2121
smoothY: false,
2222
realTopDetection: true,

src/__tests__/zero.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@ import { gsd } from '../gsd';
22

33
describe('Simple test cases', () => {
44
it('length = 0', () => {
5-
let x = [];
6-
let y = [];
5+
const x = [];
6+
const y = [];
77
expect(() => {
88
gsd({ x, y });
99
}).toThrow('input must not be empty');
1010
});
1111

1212
it('length = 2', () => {
13-
let x = [1, 2];
14-
let y = [2, 3];
13+
const x = [1, 2];
14+
const y = [2, 3];
1515
expect(() => {
1616
gsd({ x, y });
1717
}).toThrow('Window size is higher than the data length 9>2');
1818
});
1919

2020
it('no peaks', () => {
21-
let x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
22-
let y = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];
23-
let peaks = gsd({ x, y });
21+
const x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
22+
const y = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0];
23+
const peaks = gsd({ x, y });
2424
expect(peaks[0].x).toBe(8);
2525
});
2626
});

0 commit comments

Comments
 (0)