Skip to content

Commit 926ca69

Browse files
authored
fix: remove shape from gsd peaks (#111)
1 parent b23d382 commit 926ca69

File tree

8 files changed

+2
-76
lines changed

8 files changed

+2
-76
lines changed

package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
"src",
1111
"lib-esm"
1212
],
13-
"env": {
14-
"jest": true
15-
},
1613
"scripts": {
1714
"build": "npm run tsc-esm && cheminfo-build --entry lib-esm/index.js --root GSD",
1815
"check-types": "tsc --noEmit",
@@ -43,7 +40,7 @@
4340
"author": "Andres Castillo",
4441
"contributors": [
4542
"Miguel Asencio <[email protected]> (https://github.com/maasencioh)",
46-
"Alejandro Bolaños <[email protected]> (https://github.com/jobo322)"
43+
"J. Alejandro Bolaños A. <[email protected]> (https://github.com/jobo322)"
4744
],
4845
"license": "MIT",
4946
"bugs": {

src/__tests__/gaussian-overlapping.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,11 @@ describe('gaussian overlapping', () => {
4949
x: -0.1,
5050
y: 1,
5151
width: 0.1,
52-
shape: { kind: 'gaussian', fwhm: 0.11774128880591818 },
5352
},
5453
{
5554
x: 0.1,
5655
y: 1,
5756
width: 0.1,
58-
shape: { kind: 'gaussian', fwhm: 0.11774128880591818 },
5957
},
6058
]);
6159
});

src/__tests__/gaussian-smooth.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ describe('gaussian simulated peaks', () => {
3939
ddY: -259.83290100626783,
4040
width: 0.08,
4141
index: 25,
42-
shape: {
43-
fwhm: 0.09419280180123805,
44-
kind: 'gaussian',
45-
},
4642
inflectionPoints: {
4743
from: { x: -0.54, index: 23 },
4844
to: { x: -0.46, index: 27 },
@@ -55,10 +51,6 @@ describe('gaussian simulated peaks', () => {
5551
ddY: -259.83290100626783,
5652
width: 0.08,
5753
index: 75,
58-
shape: {
59-
fwhm: 0.09419280180123805,
60-
kind: 'gaussian',
61-
},
6254
inflectionPoints: {
6355
from: { x: 0.46, index: 73 },
6456
to: { x: 0.54, index: 77 },

src/__tests__/gaussian.test.ts

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ describe('smooth:false option', () => {
3838
ddY: -259.83290100626783,
3939
width: 0.08,
4040
index: 25,
41-
shape: {
42-
fwhm: 0.09419280180123805,
43-
kind: 'gaussian',
44-
},
4541
inflectionPoints: {
4642
from: { index: 23, x: -0.54 },
4743
to: { index: 27, x: -0.46 },
@@ -53,10 +49,6 @@ describe('smooth:false option', () => {
5349
ddY: -259.83290100626783,
5450
width: 0.08,
5551
index: 75,
56-
shape: {
57-
fwhm: 0.09419280180123805,
58-
kind: 'gaussian',
59-
},
6052
inflectionPoints: {
6153
from: { index: 73, x: 0.46 },
6254
to: { index: 77, x: 0.54 },
@@ -76,10 +68,6 @@ describe('smooth:false option', () => {
7668
ddY: -259.83290100626783,
7769
width: 0.08,
7870
index: 25,
79-
shape: {
80-
fwhm: 0.09419280180123805,
81-
kind: 'gaussian',
82-
},
8371
inflectionPoints: {
8472
from: { index: 23, x: -0.54 },
8573
to: { index: 27, x: -0.46 },
@@ -91,10 +79,6 @@ describe('smooth:false option', () => {
9179
ddY: -259.83290100626783,
9280
width: 0.08,
9381
index: 75,
94-
shape: {
95-
fwhm: 0.09419280180123805,
96-
kind: 'gaussian',
97-
},
9882
inflectionPoints: {
9983
from: { index: 73, x: 0.46 },
10084
to: { index: 77, x: 0.54 },
@@ -117,10 +101,6 @@ describe('smooth:false option', () => {
117101
ddY: 259.83290100626783,
118102
width: 0.08,
119103
index: 25,
120-
shape: {
121-
fwhm: 0.09419280180123805,
122-
kind: 'gaussian',
123-
},
124104
inflectionPoints: {
125105
from: { index: 23, x: -0.54 },
126106
to: { index: 27, x: -0.46 },
@@ -132,10 +112,6 @@ describe('smooth:false option', () => {
132112
ddY: 259.83290100626783,
133113
width: 0.08,
134114
index: 75,
135-
shape: {
136-
fwhm: 0.09419280180123805,
137-
kind: 'gaussian',
138-
},
139115
inflectionPoints: {
140116
from: { index: 73, x: 0.46 },
141117
to: { index: 77, x: 0.54 },
@@ -159,10 +135,6 @@ describe('smooth:false option', () => {
159135
ddY: 259.83290100626783,
160136
width: 0.08,
161137
index: 25,
162-
shape: {
163-
fwhm: 0.09419280180123805,
164-
kind: 'gaussian',
165-
},
166138
inflectionPoints: {
167139
from: { index: 23, x: -0.54 },
168140
to: { index: 27, x: -0.46 },
@@ -174,10 +146,6 @@ describe('smooth:false option', () => {
174146
ddY: 259.83290100626783,
175147
width: 0.08,
176148
index: 75,
177-
shape: {
178-
fwhm: 0.09419280180123805,
179-
kind: 'gaussian',
180-
},
181149
inflectionPoints: {
182150
from: { index: 73, x: 0.46 },
183151
to: { index: 77, x: 0.54 },

src/__tests__/power.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ describe('power', () => {
5757
width: 0.3,
5858
index: 100,
5959
ddY: -33832.03463203485,
60-
shape: {
61-
fwhm: 0.35322300675464324,
62-
kind: 'gaussian',
63-
},
6460
inflectionPoints: {
6561
from: { x: 4.85, index: 97 },
6662
to: { x: 5.15, index: 103 },
@@ -84,10 +80,6 @@ describe('power', () => {
8480
width: 0.05,
8581
index: 89,
8682
ddY: 800,
87-
shape: {
88-
fwhm: 0.05887050112577352,
89-
kind: 'gaussian',
90-
},
9183
inflectionPoints: {
9284
from: { x: 4.4, index: 88 },
9385
to: { x: 4.45, index: 89 },
@@ -100,10 +92,6 @@ describe('power', () => {
10092
width: 0.2,
10193
index: 100,
10294
ddY: -44914.28571428623,
103-
shape: {
104-
fwhm: 0.2354820045030941,
105-
kind: 'gaussian',
106-
},
10795
inflectionPoints: {
10896
from: { x: 4.9, index: 98 },
10997
to: { x: 5.1, index: 102 },
@@ -116,10 +104,6 @@ describe('power', () => {
116104
width: 0.05,
117105
index: 111,
118106
ddY: 800,
119-
shape: {
120-
fwhm: 0.05887050112577352,
121-
kind: 'gaussian',
122-
},
123107
inflectionPoints: {
124108
from: { x: 5.55, index: 111 },
125109
to: { x: 5.6, index: 112 },

src/__tests__/ubiquitin.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ describe('Global spectra deconvolution ubiquitin', () => {
3030
ddY: -15468134.039875854,
3131
width: 0.002420000000000755,
3232
index: 11,
33-
shape: {
34-
fwhm: 0.0028493322544883375,
35-
kind: 'gaussian',
36-
},
3733
inflectionPoints: {
3834
from: { x: 200.054133, index: 9 },
3935
to: { x: 200.056553, index: 13 },

src/gsd.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { v4 as generateID } from '@lukeed/uuid';
22
import type { DataXY } from 'cheminfo-types';
3-
import { Shape1D } from 'ml-peak-shape-generator';
43
import { sgg, SGGOptions } from 'ml-savitzky-golay-generalized';
54
import {
65
xIsEquallySpaced,
@@ -14,7 +13,6 @@ import { GSDPeak } from './GSDPeak';
1413
import { MakeMandatory } from './utils/MakeMandatory';
1514
import { MakeOptional } from './utils/MakeOptional';
1615
import { optimizeTop } from './utils/optimizeTop';
17-
import { setShape } from './utils/setShape';
1816

1917
export interface GSDOptions {
2018
/**
@@ -49,11 +47,6 @@ export interface GSDOptions {
4947
* @default false
5048
*/
5149
realTopDetection?: boolean;
52-
/**
53-
* Shape used to add FWHM property in the peaks
54-
* @default {kind:'gaussian'}
55-
*/
56-
shape?: Shape1D;
5750
}
5851
export type GSDPeakID = MakeMandatory<GSDPeak, 'id'>;
5952
export type GSDPeakIDOptionalShape = MakeOptional<GSDPeak, 'shape'>;
@@ -71,7 +64,6 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
7164
windowSize: 9,
7265
polynomial: 3,
7366
},
74-
shape,
7567
noiseLevel,
7668
smoothY = false,
7769
maxCriteria = true,
@@ -279,5 +271,5 @@ export function gsd(data: DataXY, options: GSDOptions = {}): GSDPeakID[] {
279271
return a.x - b.x;
280272
});
281273

282-
return setShape(peaks, { shape }) as GSDPeakID[];
274+
return peaks as GSDPeakID[];
283275
}

src/utils/setShape.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export function setShape<T extends { width: number }>(
2222
output = parse(stringify(peaks)) as T[],
2323
} = options;
2424
let shapeInstance = getShape1D(shape);
25-
2625
return output.map((peak) => ({
2726
...peak,
2827
shape: { fwhm: shapeInstance.widthToFWHM(peak.width), ...shape },

0 commit comments

Comments
 (0)