Comparing version 0.5.5 to 0.5.6
{ | ||
"name": "emdb", | ||
"version": "0.5.5", | ||
"version": "0.5.6", | ||
"description": "Database manager for exact mass query", | ||
@@ -24,8 +24,8 @@ "browser": { | ||
"dependencies": { | ||
"isotopic-distribution": "^0.5.2", | ||
"isotopic-distribution": "^0.5.6", | ||
"jszip": "^3.1.5", | ||
"mf-finder": "^0.5.2", | ||
"mf-from-google-sheet": "^0.5.5", | ||
"mf-generator": "^0.5.5", | ||
"mf-matcher": "^0.5.5", | ||
"mf-from-google-sheet": "^0.5.6", | ||
"mf-generator": "^0.5.6", | ||
"mf-matcher": "^0.5.6", | ||
"mf-utilities": "^0.5.2", | ||
@@ -32,0 +32,0 @@ "peaks-similarity": "^2.3.0", |
@@ -15,3 +15,3 @@ 'use strict'; | ||
}, | ||
mfFilter: { | ||
filter: { | ||
minMSEM: 100, | ||
@@ -18,0 +18,0 @@ maxMSEM: 300, |
@@ -6,3 +6,2 @@ 'use strict'; | ||
test('test loadCommercials', async () => { | ||
let data = await loadCommercials(); | ||
@@ -9,0 +8,0 @@ expect(data.length).toBeGreaterThan(10000); |
@@ -43,5 +43,7 @@ 'use strict'; | ||
precision: 1e4, | ||
onlyIntegerUnsaturation: true, | ||
minUnsaturation: 2, | ||
maxUnsaturation: 3, | ||
unsaturation: { | ||
onlyInteger: true, | ||
min: 2, | ||
max: 3, | ||
} | ||
} | ||
@@ -48,0 +50,0 @@ }); |
@@ -31,15 +31,16 @@ 'use strict'; | ||
* | ||
* @param {object} [options.mfFilter={}] Object defining options for molecular formula filter | ||
* @param {number} [options.mfFilter.minMass=0] - Minimal monoisotopic mass | ||
* @param {number} [options.mfFilter.maxMass=+Infinity] - Maximal monoisotopic mass | ||
* @param {number} [options.mfFilter.minEM=0] - Minimal neutral monoisotopic mass | ||
* @param {number} [options.mfFilter.maxEM=+Infinity] - Maximal neutral monoisotopic mass | ||
* @param {number} [options.mfFilter.minMSEM=0] - Minimal observed monoisotopic mass | ||
* @param {number} [options.mfFilter.maxMSEM=+Infinity] - Maximal observed monoisotopic mass | ||
* @param {number} [options.mfFilter.minCharge=-Infinity] - Minimal charge | ||
* @param {number} [options.mfFilter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.mfFilter.minUnsaturation=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.mfFilter.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.mfFilter.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [options.mfFilter.onlyNonIntegerUnsaturation=false] - Non | ||
* @param {object} [options.filter={}] Object defining options for molecular formula filter | ||
* @param {number} [options.filter.minMass=0] - Minimal monoisotopic mass | ||
* @param {number} [options.filter.maxMass=+Infinity] - Maximal monoisotopic mass | ||
* @param {number} [options.filter.minEM=0] - Minimal neutral monoisotopic mass | ||
* @param {number} [options.filter.maxEM=+Infinity] - Maximal neutral monoisotopic mass | ||
* @param {number} [options.filter.minMSEM=0] - Minimal observed monoisotopic mass | ||
* @param {number} [options.filter.maxMSEM=+Infinity] - Maximal observed monoisotopic mass | ||
* @param {number} [options.filter.minCharge=-Infinity] - Minimal charge | ||
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.filter.unsaturation={}}] | ||
* @param {number} [options.filter.unsaturation.min=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.filter.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.filter.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [options.filter.onlyNonIntegerUnsaturation=false] - Non | ||
*/ | ||
@@ -56,3 +57,3 @@ | ||
fragmentation = {}, | ||
mfFilter = {}, | ||
filter = {}, | ||
ionizations = '', | ||
@@ -92,3 +93,3 @@ } = options; | ||
ionizations, | ||
filter: mfFilter | ||
filter: filter | ||
}); | ||
@@ -95,0 +96,0 @@ |
@@ -6,4 +6,2 @@ 'use strict'; | ||
const loadCommercialsPromise = require('./loadCommercials'); | ||
const combineMFs = require('mf-generator'); | ||
const findMFs = require('mf-finder'); | ||
@@ -25,4 +23,6 @@ function DBManager() { | ||
const { | ||
databaseName = 'knapSack' | ||
databaseName = 'knapSack', | ||
forceReload = false | ||
} = options; | ||
if (this.databases[databaseName] && !forceReload) return; | ||
this.databases[databaseName] = await loadKnapSackPromise(); | ||
@@ -37,4 +37,6 @@ }; | ||
const { | ||
databaseName = 'commercials' | ||
databaseName = 'commercials', | ||
forceReload = false | ||
} = options; | ||
if (this.databases[databaseName] && !forceReload) return; | ||
this.databases[databaseName] = await loadCommercialsPromise(); | ||
@@ -54,4 +56,6 @@ }; | ||
const { | ||
databaseName = 'contaminants' | ||
databaseName = 'contaminants', | ||
forceReload = false, | ||
} = options; | ||
if (this.databases[databaseName] && !forceReload) return; | ||
this.databases[databaseName] = await loadGoogleSheetPromise(); | ||
@@ -68,37 +72,9 @@ }; | ||
const { | ||
databaseName = 'sheet' | ||
databaseName = 'sheet', | ||
forceReload = false, | ||
} = options; | ||
if (this.databases[databaseName] && !forceReload) return; | ||
this.databases[databaseName] = await loadGoogleSheetPromise(); | ||
}; | ||
/** | ||
* Generates a database 'generated' from an array of molecular formula | ||
* @param {*} options | ||
* @param {string} ['generated'] databaseName | ||
* @param {number} [options.limit=10000000] - Maximum number of results | ||
* @param {boolean} [canonizeMF=true] - Canonize molecular formula | ||
* @param {boolean} [uniqueMFs=true] - Force canonization and make MF unique | ||
* @param {number} [options.filter.minMass=0] - Minimal monoisotopic mass | ||
* @param {number} [options.filter.maxMass=+Infinity] - Maximal monoisotopic mass | ||
* @param {number} [options.filter.minEM=0] - Minimal neutral monoisotopic mass | ||
* @param {number} [options.filter.maxEM=+Infinity] - Maximal neutral monoisotopic mass | ||
* @param {number} [options.filter.minMSEM=0] - Minimal observed monoisotopic mass | ||
* @param {number} [options.filter.maxMSEM=+Infinity] - Maximal observed monoisotopic mass | ||
* @param {number} [options.filter.minCharge=-Infinity] - Minimal charge | ||
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.filter.minUnsaturation=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.filter.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.filter.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [options.filter.onlyNonIntegerUnsaturation=false] - Non integer unsaturation | ||
* @param {object} [options.filter.atoms] - object of atom:{min, max} | ||
*/ | ||
DBManager.prototype.fromArray = function fromArray(mfsArray, options = {}) { | ||
const { | ||
databaseName = 'generated' | ||
} = options; | ||
this.databases[databaseName] = combineMFs(mfsArray, options); | ||
}; | ||
DBManager.prototype.loadTest = function loadTest() { | ||
@@ -109,20 +85,2 @@ this.fromArray(['C1-100'], { databaseName: 'test', ionizations: '+' }); | ||
/** | ||
* Generates a database 'monoisotopic' from an array of molecular formula | ||
* @param {*} options | ||
* @param {number} [mass=0] - Target mass | ||
* @param {string} [options.databaseName='monoisotopic'] | ||
* @param {number} [options.precision=1000] - Minimal charge | ||
* @param {number} [options.minCharge=-Infinity] - Minimal charge | ||
* @param {number} [options.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.minUnsaturation=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [options.onlyNonIntegerUnsaturation=false] - Non integer unsaturation | ||
* @param {number} [options.maxIterations=1e8] - Max number of iterations | ||
* @param {boolean} [options.allowNeutral=false] - Allow neutral molecules | ||
* @param {string} [options.ionizations=''] - Comma separated list of ionizations | ||
* @param {string} [options.ranges=''] - Range to search the molecular formula like 'C0-10 H0-10' | ||
*/ | ||
DBManager.prototype.fromMonoisotopicMass = function fromMonoisotopicMass(mass, options = {}) { | ||
@@ -132,5 +90,12 @@ const { | ||
} = options; | ||
this.databases[databaseName] = findMFs(mass, options).mfs; | ||
this.databases[databaseName] = require('./fromMonoisotopicMass')(mass, options); | ||
}; | ||
DBManager.prototype.fromArray = function fromArray(sequence, options = {}) { | ||
const { | ||
databaseName = 'generated' | ||
} = options; | ||
this.databases[databaseName] = require('./fromArray')(sequence, options); | ||
}; | ||
DBManager.prototype.fromPeptidicSequence = function fromPeptidicSequence(sequence, options = {}) { | ||
@@ -137,0 +102,0 @@ const { |
@@ -6,2 +6,4 @@ 'use strict'; | ||
const loadingPromises = {}; | ||
module.exports = async function loadCommercials(options = {}) { | ||
@@ -12,3 +14,6 @@ const { | ||
const buffer = await fetch(url); | ||
if (!loadingPromises[url]) { | ||
loadingPromises[url] = fetch(url); | ||
} | ||
const buffer = await loadingPromises[url]; | ||
@@ -15,0 +20,0 @@ const jsZip = new JSZip(); |
@@ -6,2 +6,4 @@ 'use strict'; | ||
const loadingPromises = {}; | ||
module.exports = async function loadKnapSack(options = {}) { | ||
@@ -12,3 +14,6 @@ const { | ||
const buffer = await fetch(url); | ||
if (!loadingPromises[url]) { | ||
loadingPromises[url] = fetch(url); | ||
} | ||
const buffer = await loadingPromises[url]; | ||
@@ -15,0 +20,0 @@ const jsZip = new JSZip(); |
@@ -15,6 +15,7 @@ 'use strict'; | ||
* @param {number} [filter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [filter.minUnsaturation=-Infinity] - Minimal unsaturation | ||
* @param {number} [filter.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [filter.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [filter.onlyNonIntegerUnsaturation=false] - Non integer unsaturation | ||
* @param {object} [filter.unsaturation={}}] | ||
* @param {number} [filter.unsaturation.min=-Infinity] - Minimal unsaturation | ||
* @param {number} [filter.unsaturation.max=+Infinity] - Maximal unsaturation | ||
* @param {number} [filter.unsaturation.onlyIntege=false] - Integer unsaturation | ||
* @param {number} [filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation | ||
* @param {object} [filter.atoms] - object of atom:{min, max} | ||
@@ -21,0 +22,0 @@ |
@@ -18,6 +18,7 @@ 'use strict'; | ||
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.filter.minUnsaturation=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.filter.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.filter.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [options.filter.onlyNonIntegerUnsaturation=false] - Non integer unsaturation | ||
* @param {object} [options.filter.unsaturation={}}] | ||
* @param {number} [options.filter.unsaturation.min=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.filter.unsaturation.onlyIntege=false] - Integer unsaturation | ||
* @param {number} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation | ||
* @param {object} [options.filter.atoms] - object of atom:{min, max} | ||
@@ -24,0 +25,0 @@ |
@@ -18,6 +18,7 @@ 'use strict'; | ||
* @param {number} [options.filter.maxCharge=+Infinity] - Maximal charge | ||
* @param {number} [options.filter.minUnsaturation=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.filter.maxUnsaturation=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.filter.onlyIntegerUnsaturation=false] - Integer unsaturation | ||
* @param {number} [options.filter.onlyNonIntegerUnsaturation=false] - Non integer unsaturation | ||
* @param {object} [options.filter.unsaturation={}}] | ||
* @param {number} [options.filter.unsaturation.min=-Infinity] - Minimal unsaturation | ||
* @param {number} [options.filter.unsaturation.max=+Infinity] - Maximal unsaturation | ||
* @param {number} [options.filter.unsaturation.onlyIntege=false] - Integer unsaturation | ||
* @param {number} [options.filter.unsaturation.onlyNonInteger=false] - Non integer unsaturation | ||
* @param {object} [options.filter.atoms] - object of atom:{min, max} | ||
@@ -24,0 +25,0 @@ |
80411
32
838
Updatedisotopic-distribution@^0.5.6
Updatedmf-from-google-sheet@^0.5.6
Updatedmf-generator@^0.5.6
Updatedmf-matcher@^0.5.6