Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ms-spectrum

Package Overview
Dependencies
Maintainers
2
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ms-spectrum - npm Package Compare versions

Comparing version 1.5.3 to 1.6.0

src/__tests__/getFragmentPeaks.test.js

11

package.json
{
"name": "ms-spectrum",
"version": "1.5.3",
"version": "1.6.0",
"description": "A mass spectrum",

@@ -21,9 +21,10 @@ "main": "src/index.js",

"dependencies": {
"emdb": "^1.7.2",
"emdb": "^1.7.3",
"mf-parser": "^1.4.4",
"ml-array-max": "^1.2.4",
"ml-array-min": "^1.2.3",
"ml-array-normed": "^1.3.7",
"ml-gsd": "^9.1.0",
"ml-gsd": "^10.0.0",
"ml-regression-power": "^2.0.0",
"ml-spectra-processing": "^8.3.1",
"ml-spectra-processing": "^10.0.0",
"peaks-similarity": "^2.3.1",

@@ -35,3 +36,3 @@ "xy-parser": "^4.0.1"

},
"gitHead": "0cceb8fe88adb924d371419bf3738b0e2d0a438c"
"gitHead": "250bcb61ebf068680786fa1dd9247ebcca0c33cf"
}
'use strict';
const gsd = require('ml-gsd').gsd;
const { xFindClosestIndex } = require('ml-spectra-processing');
const { xyEnsureGrowingX } = require('ml-spectra-processing');

@@ -23,3 +23,3 @@ const appendPeaksCharge = require('./appendPeaksCharge');

const { charge: chargeOptions = {} } = options;
if (!spectrum.peaks) {
if (!spectrum.peaks || spectrum.peaks.length === 0) {
spectrum.peaks = [];

@@ -30,7 +30,7 @@ const keys = Object.keys(spectrum.data).filter(

if (spectrum.isContinuous()) {
const gsdPeaks = gsd(spectrum.data, {
noiseLevel: 0,
// some experimental data are really problematic and we need to add this line
const data = xyEnsureGrowingX(spectrum.data);
const gsdPeaks = gsd(data, {
minMaxRatio: 0.00025, // Threshold to determine if a given peak should be considered as a noise
realTopDetection: true,
maxCriteria: true, // inverted:false
smoothY: false,

@@ -41,5 +41,4 @@ sgOptions: { windowSize: 7, polynomial: 3 },

const peak = { x: gsdPeak.x, y: gsdPeak.y, width: gsdPeak.width };
const index = xFindClosestIndex(spectrum.data.x, gsdPeak.x);
for (let key of keys) {
peak[key] = spectrum.data[key][index];
peak[key] = spectrum.data[key][gsdPeak.index];
}

@@ -46,0 +45,0 @@ spectrum.peaks.push(peak);

@@ -8,2 +8,3 @@ 'use strict';

const getBestPeaks = require('./getBestPeaks');
const getFragmentPeaks = require('./getFragmentPeaks');
const getMassRemainder = require('./getMassRemainder');

@@ -33,2 +34,3 @@ const getPeakChargeBySimilarity = require('./getPeakChargeBySimilarity');

this.cache = {};
this.peaks = [];
}

@@ -119,2 +121,19 @@

/**
* Returns also peaks possible for a specific molecular formula
* @example
* const spectrum = new Spectrum({x:[], y:[]})
* await spectrum.getFragmentPeaks();
* @param {string} mf
* @param {object} options
* @returns
*/
Spectrum.prototype.getFragmentPeaks = function getFragmentPeaksFct(
mf,
options,
) {
peakPicking(this);
return getFragmentPeaks(this.peaks, mf, options);
};
Spectrum.prototype.isContinuous = function isContinuousFct() {

@@ -121,0 +140,0 @@ return isContinuous(this);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc