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

emdb

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emdb - npm Package Compare versions

Comparing version 0.6.4 to 0.7.0

18

package.json
{
"name": "emdb",
"version": "0.6.4",
"version": "0.7.0",
"description": "Database manager for exact mass query",

@@ -25,11 +25,11 @@ "browser": {

"dependencies": {
"isotopic-distribution": "^0.6.4",
"isotopic-distribution": "^0.7.0",
"jszip": "^3.1.5",
"mf-finder": "^0.6.4",
"mf-from-google-sheet": "^0.6.4",
"mf-generator": "^0.6.4",
"mf-matcher": "^0.6.4",
"mf-parser": "^0.6.4",
"mf-utilities": "^0.6.4",
"nucleotide": "^0.6.4",
"mf-finder": "^0.7.0",
"mf-from-google-sheet": "^0.7.0",
"mf-generator": "^0.7.0",
"mf-matcher": "^0.7.0",
"mf-parser": "^0.7.0",
"mf-utilities": "^0.7.0",
"nucleotide": "^0.7.0",
"peaks-similarity": "^2.3.0",

@@ -36,0 +36,0 @@ "peptide": "^1.6.1",

@@ -5,4 +5,2 @@ 'use strict';

jest.setTimeout(30000);
test('test DBManager contaminants and knapSack', async () => {

@@ -16,3 +14,3 @@ let dbManager = new DBManager();

expect(dbManager.get('contaminants').length).toBeGreaterThan(1000);
});
}, 30000);

@@ -22,5 +20,3 @@ test('test DBManager fromMonoisotopicMass', () => {

dbManager.fromMonoisotopicMass(300, {
ionizations: 'H+,Na+'
});
dbManager.fromMonoisotopicMass(300, { ionizations: 'H+,Na+' });

@@ -27,0 +23,0 @@ expect(dbManager.listDatabases()).toEqual(['monoisotopic']);

@@ -5,13 +5,13 @@ 'use strict';

test('test load google sheet', async () => {
let data = await loadGoogleSheet();
expect(data.length).toBeGreaterThan(1000);
let data = await loadGoogleSheet();
expect(data.length).toBeGreaterThan(1000);
let first = data[0];
expect(first.mf).toBe('CN');
expect(first.ionization).toEqual({ charge: -1, em: 0, mf: '(-)' });
expect(first.em).toBeGreaterThan(0);
expect(first.ms.charge).not.toBe(0);
expect(first.ms.em).toBeGreaterThan(0);
});
let first = data[0];
expect(first.mf).toBe('CN');
expect(first.ionization).toEqual({charge: -1, em: 0, mf: '(-)'});
expect(first.em).toBeGreaterThan(0);
expect(first.ms.charge).not.toBe(0);
expect(first.ms.em).toBeGreaterThan(0);
}, 10000);

@@ -17,44 +17,40 @@ 'use strict';

* @param {number} [options.allowNeutralMolecules=false] - Should we display uncharged molecules (non observable by mass)
* @param {number} [options.url='https://pubchem2.cheminfo.org/mfs/em'] - URL of the webservice
* @param {number} [options.url='https://pubchem.cheminfo.org/mfs/em'] - URL of the webservice
*/
module.exports = async function searchPubchem(mass, options = {}) {
const {
url = 'https://pubchem2.cheminfo.org/mfs/em',
precision = 1000,
allowNeutralMolecules = false
} = options;
const {
url = 'https://pubchem.cheminfo.org/mfs/em',
precision = 1000,
allowNeutralMolecules = false
} = options;
let promises = [];
let ionizations = preprocessIonizations(options.ionizations);
for (let ionization of ionizations) {
let realMass = mass * ionization.charge - ionization.em;
promises.push(fetch(`${url}?em=${realMass}&precision=${precision}`));
}
let promises = [];
let ionizations = preprocessIonizations(options.ionizations);
for (let ionization of ionizations) {
let realMass = mass * ionization.charge - ionization.em;
promises.push(fetch(`${url}?em=${realMass}&precision=${precision}`));
}
let results = await Promise.all(promises);
let results = await Promise.all(promises);
let mfs = [];
for (let i = 0; i < results.length; i++) {
for (let mf of results[i].result) {
try {
let mfInfo = new mfParser.MF(mf.mf).getInfo();
mfInfo.ionization = ionizations[i];
mfInfo.em = mfInfo.monoisotopicMass;
mfInfo.ms = getMsInfo(mfInfo, {
targetMass: mass,
allowNeutralMolecules
});
mfInfo.info = {
nbPubchemEntries: mf.total
};
mfs.push(mfInfo);
} catch (e) {
console.warn(`${e}`);
}
}
let mfs = [];
for (let i = 0; i < results.length; i++) {
for (let mf of results[i].result) {
try {
let mfInfo = new mfParser.MF(mf.mf).getInfo();
mfInfo.ionization = ionizations[i];
mfInfo.em = mfInfo.monoisotopicMass;
mfInfo.ms =
getMsInfo(mfInfo, {targetMass: mass, allowNeutralMolecules});
mfInfo.info = {nbPubchemEntries: mf.total};
mfs.push(mfInfo);
} catch (e) {
console.warn(`${e}`);
}
}
// because we can combine many ionizations we should resort the data
mfs.sort((a, b) => a.ms.ppm - b.ms.ppm);
return mfs;
}
// because we can combine many ionizations we should resort the data
mfs.sort((a, b) => a.ms.ppm - b.ms.ppm);
return mfs;
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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