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

chromatography

Package Overview
Dependencies
Maintainers
5
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromatography - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

src/__tests__/filter/meanFilter.js

47

lib/index.js

@@ -986,2 +986,29 @@ 'use strict';

function percentageFilter(chromatogram, serieName, options = {}) {
const {
percentage = 0.1
} = options;
var serie = chromatogram.getSerie(serieName);
var filtered = [];
for (var i = 0; i < serie.data.length; i++) {
filtered.push(applyFilter$1(serie.data[i], percentage));
}
return serieFromArray(filtered);
}
function applyFilter$1(serie, percentage) {
var basePeak = max(serie[1]);
var filtered = [[], []];
for (var i = 0; i < serie[0].length; i++) {
if (serie[1][i] > percentage * basePeak) {
filtered[0].push(serie[0][i]);
filtered[1].push(serie[1][i]);
}
}
return filtered;
}
/**

@@ -1278,2 +1305,18 @@ * Create an object of Chromatogram

}
/**
* Filter the given serie2D based on the percentage of the highest value
* @param {string} serieName
* @param {object} [options]
* @param {string} [options.serieName = 'msPercentage'] - Name of the new serie
* @param {number} [options.percentage = 0.1] - The values under the median times this factor are removed
*/
percentageFilter(serieName, options = {}) {
var serie = percentageFilter(this, serieName, options);
if (options.serieName) {
this.series[options.serieName] = serie;
} else {
this.series.msPercentage = serie;
}
}
}

@@ -1590,3 +1633,2 @@

exports.vectorify = vectorify;
exports.cosine = cosine;
exports.massFilter = massFilter;

@@ -1600,2 +1642,5 @@ exports.spectraComparison = spectraComparison;

exports.getKovatsRescale = getKovatsRescale;
exports.cosine = cosine;
exports.meanFilter = meanFilter;
exports.percentageFilter = percentageFilter;
exports.fromJcamp = fromJcamp;

@@ -1602,0 +1647,0 @@ exports.fromJSON = fromJSON;

2

package.json
{
"name": "chromatography",
"version": "3.1.0",
"version": "3.2.0",
"description": "Tools for storing, search and analize GC/MS spectra",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -13,3 +13,4 @@ import {rescaleTime} from './rescaleTime';

import {applyLockMass} from './ms/applyLockMass';
import {meanFilter} from './ms/meanFilter';
import {meanFilter} from './filter/meanFilter';
import {percentageFilter} from './filter/percentageFilter';
import {toJSON} from './to/json';

@@ -282,2 +283,18 @@ import {getClosestData} from './util/getClosestData';

}
/**
* Filter the given serie2D based on the percentage of the highest value
* @param {string} serieName
* @param {object} [options]
* @param {string} [options.serieName = 'msPercentage'] - Name of the new serie
* @param {number} [options.percentage = 0.1] - The values under the median times this factor are removed
*/
percentageFilter(serieName, options = {}) {
var serie = percentageFilter(this, serieName, options);
if (options.serieName) {
this.series[options.serieName] = serie;
} else {
this.series.msPercentage = serie;
}
}
}

@@ -284,0 +301,0 @@

@@ -5,3 +5,2 @@ export {Chromatogram} from './Chromatogram';

export {vectorify} from './vectorify';
export {cosine} from './filter/cosine';
export {massFilter} from './massFilter';

@@ -16,2 +15,7 @@ export {spectraComparison} from './spectraComparison';

export {cosine} from './ms/cosine';
export {meanFilter} from './filter/meanFilter';
export {percentageFilter} from './filter/percentageFilter';
export {fromJcamp} from './from/jcamp';

@@ -18,0 +22,0 @@ export {fromJSON} from './from/json';

import {getPeaks} from './util/getPeaks';
import {massInPeaks} from './massInPeaks';
import {vectorify} from './vectorify';
import {cosine} from './filter/cosine';
import {cosine} from './ms/cosine';

@@ -6,0 +6,0 @@ /**

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