Comparing version 1.4.16 to 1.5.0
{ | ||
"name": "emdb", | ||
"version": "1.4.16", | ||
"version": "1.5.0", | ||
"description": "Database manager for exact mass query", | ||
@@ -26,5 +26,5 @@ "main": "src/index.js", | ||
"jszip": "^3.7.1", | ||
"mf-finder": "^1.1.19", | ||
"mf-from-google-sheet": "^1.1.23", | ||
"mf-generator": "^1.3.11", | ||
"mf-finder": "^1.2.0", | ||
"mf-from-google-sheet": "^1.1.24", | ||
"mf-generator": "^1.3.12", | ||
"mf-matcher": "^1.1.19", | ||
@@ -36,3 +36,3 @@ "mf-parser": "^1.4.0", | ||
"ml-regression-theil-sen": "^2.0.0", | ||
"ms-spectrum": "^1.4.5", | ||
"ms-spectrum": "^1.4.6", | ||
"nucleotide": "^1.2.14", | ||
@@ -42,3 +42,3 @@ "peaks-similarity": "^2.3.1", | ||
}, | ||
"gitHead": "0267ed7f19dd446fd89cb2b7402034e21727fafe" | ||
"gitHead": "0ccc601b2ba051652963fad05479902943d7feaf" | ||
} |
@@ -13,2 +13,18 @@ 'use strict'; | ||
test('fromMonoisotopicMass string', () => { | ||
let dbManager = new DBManager(); | ||
dbManager.fromMonoisotopicMass('120,60', { | ||
allowNeutral: true, | ||
}); | ||
expect(dbManager.databases.monoisotopic).toHaveLength(10); | ||
}); | ||
test('fromMonoisotopicMass array', () => { | ||
let dbManager = new DBManager(); | ||
dbManager.fromMonoisotopicMass([60, 120], { | ||
allowNeutral: true, | ||
}); | ||
expect(dbManager.databases.monoisotopic).toHaveLength(10); | ||
}); | ||
test('fromMonoisotopicMass with ionizations', () => { | ||
@@ -15,0 +31,0 @@ let dbManager = new DBManager(); |
@@ -7,3 +7,3 @@ 'use strict'; | ||
* Generates a database 'monoisotopic' from a monoisotopic mass and various options | ||
* @param {number} mass - Monoisotopic mass | ||
* @param {number|string|array} masses - Monoisotopic mass | ||
* @param {object} [options={}] | ||
@@ -15,5 +15,6 @@ * @param {number} [options.maxIterations=10000000] - Maximum number of iterations | ||
* @param {number} [options.precision=100] - Allowed mass range based on precision | ||
* @param {object} [options.filter={}] | ||
* @param {number} [options.filter.minCharge=-Infinity] - Minimal charge | ||
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.filter.unsaturation={}] | ||
* @param {object} [options.filter.unsaturation={}] | ||
* @param {number} [options.filter.unsaturation.min=-Infinity] - Minimal unsaturation | ||
@@ -27,4 +28,23 @@ * @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation | ||
module.exports = function fromMonoisotopicMass(mass, options = {}) { | ||
return findMFs(mass, options); | ||
module.exports = function fromMonoisotopicMass(masses, options = {}) { | ||
if (typeof masses === 'string') { | ||
masses = masses.split(/[ ,;\r\n\t]/).map(Number); | ||
} | ||
if (typeof masses === 'number') { | ||
masses = [masses]; | ||
} | ||
let results = masses.map((mass) => findMFs(mass, options)); | ||
return { | ||
mfs: results.map((entry) => entry.mfs).flat(), | ||
info: { | ||
numberMFEvaluated: results.reduce( | ||
(sum, current) => (sum += current.info.numberMFEvaluated), | ||
0, | ||
), | ||
numberResults: results.reduce( | ||
(sum, current) => (sum += current.info.numberResults), | ||
0, | ||
), | ||
}, | ||
}; | ||
}; |
1247229
2009
Updatedmf-finder@^1.2.0
Updatedmf-from-google-sheet@^1.1.24
Updatedmf-generator@^1.3.12
Updatedms-spectrum@^1.4.6