ms-spectrum
Advanced tools
Comparing version 3.6.1 to 3.6.2
{ | ||
"name": "ms-spectrum", | ||
"version": "3.6.1", | ||
"version": "3.6.2", | ||
"description": "A mass spectrum", | ||
"main": "lib/index.js", | ||
"main": "lib/src/index.js", | ||
"module": "src/index.js", | ||
@@ -24,6 +24,6 @@ "files": [ | ||
"cheminfo-types": "^1.7.3", | ||
"emdb": "^3.3.1", | ||
"emdb": "^3.3.2", | ||
"is-any-array": "^2.0.1", | ||
"mf-parser": "^3.2.0", | ||
"mf-utilities": "^3.2.0", | ||
"mf-parser": "^3.2.1", | ||
"mf-utilities": "^3.2.1", | ||
"ml-gsd": "^12.1.6", | ||
@@ -39,3 +39,3 @@ "ml-regression-power": "^3.0.0", | ||
}, | ||
"gitHead": "ea33c20348f0cf73b46b5083b7cdb963c2be1b4f" | ||
"gitHead": "838f98a30846d4b1721b8ed7aa94a55e854d7521" | ||
} |
@@ -85,3 +85,3 @@ import { xyObjectMaxXPoint, xyObjectMinXPoint } from 'ml-spectra-processing'; | ||
} | ||
let newPeak = JSON.parse(JSON.stringify(item.peak)); | ||
let newPeak = structuredClone(item.peak); | ||
newPeak.close = close; | ||
@@ -88,0 +88,0 @@ toReturn.push(newPeak); |
@@ -31,9 +31,8 @@ import { EMDB } from 'emdb'; | ||
for (let peak of peaks) { | ||
peak.mfs = ( | ||
await emdb.fromMonoisotopicMass(peak.x, { | ||
precision, | ||
ranges, | ||
ionizations, | ||
}) | ||
).mfs; | ||
const { mfs } = await emdb.fromMonoisotopicMass(peak.x, { | ||
precision, | ||
ranges, | ||
ionizations, | ||
}); | ||
peak.mfs = mfs; | ||
} | ||
@@ -40,0 +39,0 @@ peaks = peaks.filter((peak) => peak.mfs.length > 0); |
@@ -24,4 +24,4 @@ import { Comparator } from 'peaks-similarity'; | ||
if (!spectrum || !spectrum.data.x.length > 0) { | ||
throw Error( | ||
if (!spectrum || spectrum.data.x.length === 0) { | ||
throw new Error( | ||
'You need to add an experimental spectrum first using setMassSpectrum', | ||
@@ -36,3 +36,3 @@ ); | ||
similarity = JSON.parse(JSON.stringify(similarity)); | ||
similarity = structuredClone(similarity); | ||
similarity.common = 'second'; | ||
@@ -49,3 +49,3 @@ | ||
if (!checkTopBottom.bottom || !checkTopBottom.top) { | ||
throw Error( | ||
throw new Error( | ||
'widthFunction should return an object with bottom and top properties', | ||
@@ -52,0 +52,0 @@ ); |
@@ -43,6 +43,8 @@ import { | ||
if (sumValue) { | ||
peaks = JSON.parse(JSON.stringify(peaks)); | ||
peaks = structuredClone(peaks); | ||
const currentSum = xyObjectSumY(peaks); | ||
const ratio = sumValue / currentSum; | ||
peaks.forEach((peak) => (peak.y *= ratio)); | ||
for (const peak of peaks) { | ||
peak.y *= ratio; | ||
} | ||
} | ||
@@ -49,0 +51,0 @@ |
@@ -15,3 +15,3 @@ import { PowerRegression } from 'ml-regression-power'; | ||
if (isNaN(regression.A) || isNaN(regression.B)) { | ||
if (Number.isNaN(regression.A) || Number.isNaN(regression.B)) { | ||
throw new Error('peaksWidth: can not calculate regression'); | ||
@@ -18,0 +18,0 @@ } |
@@ -21,2 +21,4 @@ import { isAnyArray } from 'is-any-array'; | ||
const defaultData = { x: [], y: [] }; | ||
/** | ||
@@ -32,3 +34,3 @@ * Class dealing with mass spectra and peak picking | ||
*/ | ||
constructor(data = { x: [], y: [] }, options = {}) { | ||
constructor(data = defaultData, options = {}) { | ||
if ( | ||
@@ -56,6 +58,6 @@ typeof data !== 'object' || | ||
this.info = { | ||
minX: NaN, | ||
maxX: NaN, | ||
minY: NaN, | ||
maxY: NaN, | ||
minX: Number.NaN, | ||
maxX: Number.NaN, | ||
minY: Number.NaN, | ||
maxY: Number.NaN, | ||
}; | ||
@@ -62,0 +64,0 @@ } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
157206
45
2530
4
Updatedemdb@^3.3.2
Updatedmf-parser@^3.2.1
Updatedmf-utilities@^3.2.1