Skip to content

Commit a89e945

Browse files
authored
fix: cleanup package and remove uuid generator package (#129)
1 parent b4b8f7f commit a89e945

File tree

8 files changed

+35
-53
lines changed

8 files changed

+35
-53
lines changed

.github/workflows/lactame.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ on:
55
types: [published]
66

77
env:
8-
NODE_VERSION: 20.x
8+
NODE_VERSION: 22.x
99

1010
jobs:
1111
deploy:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v3
14+
- uses: actions/checkout@v4
1515
- name: Get package name
1616
run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
17-
- uses: actions/setup-node@v2
17+
- uses: actions/setup-node@v4
1818
with:
1919
node-version: ${{ env.NODE_VERSION }}
2020
- name: Install dependencies

.github/workflows/typedoc.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ on:
66
types: [published]
77

88
env:
9-
NODE_VERSION: 20.x
9+
NODE_VERSION: 22.x
1010
ENTRY_FILE: 'src/index.ts'
1111

1212
jobs:
1313
deploy:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
- uses: actions/setup-node@v3
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-node@v4
1818
with:
1919
node-version: ${{ env.NODE_VERSION }}
2020
- name: Install dependencies

README.md

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
# global-spectral-deconvolution and peak optimizer
1+
# ml-gsd
22

3-
[![NPM version][npm-image]][npm-url]
4-
[![build status][ci-image]][ci-url]
5-
[![Test coverage][codecov-image]][codecov-url]
6-
[![npm download][download-image]][download-url]
3+
[![NPM version](https://img.shields.io/npm/v/ml-gsd.svg)](https://www.npmjs.com/package/ml-gsd)
4+
[![npm download](https://img.shields.io/npm/dm/ml-gsd.svg)](https://www.npmjs.com/package/ml-gsd)
5+
[![test coverage](https://img.shields.io/codecov/c/github/mljs/global-spectral-deconvolution.svg)](https://codecov.io/gh/mljs/global-spectral-deconvolution)
6+
[![license](https://img.shields.io/npm/l/ml-gsd.svg)](https://github.com/mljs/global-spectral-deconvolution/blob/main/LICENSE)
77

8-
## Global Spectra Deconvolution
8+
Global spectral deconvolution and peak optimizer.
9+
10+
## [API documentation](http://mljs.github.io/global-spectral-deconvolution/)
911

1012
`gsd`is using an algorithm that is searching for inflection points to determine the position and width of peaks. The width is defined as the distance between the 2 inflection points. Depending the shape of the peak this width may differ from 'fwhm' (Full Width Half Maximum).
1113

@@ -29,7 +31,7 @@ The result of GSD is an array of GSDPeak:
2931
- from: { x, index }
3032
- to: { x, index }
3133

32-
## Parameters
34+
### Parameters
3335

3436
#### minMaxRatio=0.00025 (0-1)
3537

@@ -51,14 +53,14 @@ Use a quadratic optimizations with the peak and its 3 closest neighbors to deter
5153

5254
Savitzky-Golay parameters. windowSize should be odd; polynomial is the degree of the polynomial to use in the approximations. It should be bigger than 2.
5355

54-
## Post methods
56+
### Post methods
5557

56-
### GSD.broadenPeaks(peakList, {factor=2, overlap=false})
58+
#### GSD.broadenPeaks(peakList, {factor=2, overlap=false})
5759

5860
We enlarge the peaks and add the properties from and to.
5961
By default we enlarge of a factor 2 and we don't allow overlap.
6062

61-
### GSD.optimizePeaks(data, peakList, options)
63+
#### GSD.optimizePeaks(data, peakList, options)
6264

6365
Optimize the position (x), max intensity (y), full width at half maximum (fwhm) and the ratio of gaussian contribution (mu) if it's required. It currently supports three kind of shapes: gaussian, lorentzian and pseudovoigt
6466

@@ -107,19 +109,6 @@ console.log(optimized);
107109
*/
108110
```
109111

110-
i
111-
112-
## [API documentation](http://mljs.github.io/global-spectral-deconvolution/)
113-
114112
## License
115113

116114
[MIT](./LICENSE)
117-
118-
[npm-image]: https://img.shields.io/npm/v/ml-gsd.svg
119-
[npm-url]: https://npmjs.org/package/ml-gsd
120-
[codecov-image]: https://img.shields.io/codecov/c/github/mljs/global-spectral-deconvolution.svg
121-
[codecov-url]: https://codecov.io/gh/mljs/global-spectral-deconvolution
122-
[ci-image]: https://github.com/mljs/global-spectral-deconvolution/workflows/Node.js%20CI/badge.svg?branch=main
123-
[ci-url]: https://github.com/mljs/global-spectral-deconvolution/actions?query=workflow%3A%22Node.js+CI%22
124-
[download-image]: https://img.shields.io/npm/dm/ml-gsd.svg
125-
[download-url]: https://npmjs.org/package/ml-gsd
File renamed without changes.

package.json

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ml-gsd",
33
"version": "13.0.0",
4-
"description": "Global Spectra Deconvolution",
4+
"description": "Global Spectral Deconvolution",
55
"type": "module",
66
"exports": "./lib/index.js",
77
"files": [
@@ -52,28 +52,27 @@
5252
},
5353
"devDependencies": {
5454
"@types/node": "^24.0.1",
55-
"@vitest/coverage-v8": "^1.6.0",
55+
"@vitest/coverage-v8": "^3.2.3",
5656
"@zakodium/tsconfig": "^1.0.1",
57-
"cheminfo-build": "^1.2.0",
57+
"cheminfo-build": "^1.2.1",
5858
"eslint": "^9.28.0",
5959
"eslint-config-cheminfo-typescript": "^18.0.1",
6060
"esm": "^3.2.25",
6161
"jest-matcher-deep-close-to": "^3.0.2",
62-
"mf-global": "^3.0.20",
62+
"mf-global": "^3.1.25",
6363
"ml-stat": "^1.3.3",
64-
"prettier": "^3.2.5",
65-
"rimraf": "^5.0.6",
66-
"spectrum-generator": "^8.0.11",
64+
"prettier": "^3.5.3",
65+
"rimraf": "^6.0.1",
66+
"spectrum-generator": "^8.1.0",
6767
"typescript": "^5.8.3",
68-
"vitest": "^1.6.0",
68+
"vitest": "^3.2.3",
6969
"xy-parser": "^5.0.5"
7070
},
7171
"dependencies": {
72-
"@lukeed/uuid": "^2.0.1",
73-
"cheminfo-types": "^1.7.3",
72+
"cheminfo-types": "^1.8.1",
7473
"ml-peak-shape-generator": "^4.1.4",
7574
"ml-savitzky-golay-generalized": "^4.2.0",
7675
"ml-spectra-fitting": "^5.0.1",
77-
"ml-spectra-processing": "^14.5.3"
76+
"ml-spectra-processing": "^14.12.0"
7877
}
7978
}

src/gsd.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { v4 as generateID } from '@lukeed/uuid';
21
import type { DataXY } from 'cheminfo-types';
3-
import { sgg } from 'ml-savitzky-golay-generalized';
42
import type { SGGOptions } from 'ml-savitzky-golay-generalized';
3+
import { sgg } from 'ml-savitzky-golay-generalized';
54
import {
65
xIsEquallySpaced,
76
xIsMonotonic,
8-
xNoiseStandardDeviation,
97
xMinMaxValues,
8+
xNoiseStandardDeviation,
109
} from 'ml-spectra-processing';
1110

1211
import type { GSDPeak } from './GSDPeak.ts';
@@ -213,7 +212,7 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
213212
if (yData[minddYIndex] > yThreshold) {
214213
const width = Math.abs(intervalR[possible].x - intervalL[possible].x);
215214
peaks.push({
216-
id: generateID(),
215+
id: crypto.randomUUID(),
217216
x: deltaX,
218217
y: yData[minddYIndex],
219218
width,

src/post/joinBroadPeaks.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { v4 as generateID } from '@lukeed/uuid';
21
import type { Shape1D } from 'ml-peak-shape-generator';
32
import type { OptimizationOptions } from 'ml-spectra-fitting';
43

@@ -7,8 +6,8 @@ import type { GSDPeakOptimized } from '../GSDPeakOptimized.ts';
76
import { addMissingIDs } from '../utils/addMissingIDs.ts';
87
import { addMissingShape } from '../utils/addMissingShape.ts';
98

10-
import { optimizePeaksWithLogs } from './optimizePeaksWithLogs.ts';
119
import type { GSDPeakOptimizedID } from './optimizePeaksWithLogs.ts';
10+
import { optimizePeaksWithLogs } from './optimizePeaksWithLogs.ts';
1211

1312
export interface JoinBroadPeaksOptions {
1413
/**
@@ -99,7 +98,7 @@ export function joinBroadPeaks(
9998
candidates,
10099
[
101100
{
102-
id: generateID(),
101+
id: crypto.randomUUID(),
103102
x: broadLines[maxI].x,
104103
y: max,
105104
width: initialWidth,

src/utils/addMissingIDs.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import { v4 as generateID } from '@lukeed/uuid';
2-
3-
const { parse, stringify } = JSON;
4-
51
export function addMissingIDs<T extends { id?: string }>(
62
peaks: T[],
73
options: { output?: T[] } = {},
84
) {
9-
const { output = parse(stringify(peaks)) as T[] } = options;
5+
const { output = structuredClone(peaks) } = options;
106
for (const peak of output) {
117
if (!('id' in peak)) {
12-
peak.id = generateID();
8+
peak.id = crypto.randomUUID();
139
}
1410
}
1511

0 commit comments

Comments
 (0)