EMDB

A class that deals with database of monoisotopic mass and molecular formula

new EMDB()
Instance Members
setExperimentalSpectrum(data, options)
loadKnapSack(options)
loadCommercials(options)
loadContaminants(options)
loadGoogleSheet(options)
appendFragmentsInfo(databaseName, options)

appendFragmentsInfo

appendFragmentsInfo(experimentalSpectrum: object, database: object, options: object)
Parameters
experimentalSpectrum (object)
database (object)
options (object = {})
Name Description
options.onStep function? Callback to do after each step
options.ionizations string (default '') string containing a comma separated list of modifications
options.precision number (default 100) Allowed mass range based on precision

fromArray

Generates a database 'generated' from an array of molecular formula

fromArray(mfsArray: array, options: object)
Parameters
mfsArray (array) Array of string or Array of array containing the parts to combine
options (object = {})
Name Description
options.estimate boolean (default false) estimate the number of MF without filters
options.databaseName string (default 'generated')
options.onStep function? Callback to do after each step
options.limit number (default 10000000) Maximum number of results
options.canonizeMF boolean (default true) Canonize molecular formula
options.uniqueMFs boolean (default true) Force canonization and make MF unique
options.ionizations string (default '') Comma separated list of ionizations (to charge the molecule)
options.filter object (default {})
options.filter.minMass number (default 0) Minimal monoisotopic mass
options.filter.maxMass number (default +Infinity) Maximal monoisotopic mass
options.filter.minEM number (default 0) Minimal neutral monoisotopic mass
options.filter.maxEM number (default +Infinity) Maximal neutral monoisotopic mass
options.filter.minMSEM number (default 0) Minimal observed monoisotopic mass
options.filter.maxMSEM number (default +Infinity) Maximal observed monoisotopic mass
options.filter.minCharge number (default -Infinity) Minimal charge
options.filter.maxCharge number (default +Infinity) Maximal charge
options.filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
options.filter.unsaturation object (default {})
options.filter.unsaturation.min number (default -Infinity) Minimal unsaturation
options.filter.unsaturation.max number (default +Infinity) Maximal unsaturation
options.filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
options.filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
options.filter.atoms object? object of atom:{min, max}
options.filter.callback function? a function to filter the MF
options.filterFct string? A string representing a function
Example
const {EMDB} = require('emdb');
let emdb = new EMDB();
let array = ['C1-10', 'H1-10'];
emdb.fromArray(array); // create a database 'generated' combining all possibilies
console.log(emdb.get('generated').length); // 100
const {EMDB} = require('emdb');
let emdb = new EMDB();
let array = ['C1-10 H1-10'];
emdb.fromArray(array); // create a database 'generated' combining all possibilies
console.log(emdb.get('generated').length); // 100
const {EMDB} = require('emdb');
let emdb = new EMDB();
// in case of an array of array, one of the group is allwed
let array = [['C1-10','H1-10'],'Cl0-1 Br0-1'];
emdb.fromArray(array); // create a database 'generated' combining all possibilies
console.log(emdb.get('generated').length); // 80
<script src="https://www.lactame.com/lib/mass-tools/HEAD/mass-tools.js" />
<script>
  let emdb = new MassTools.EMDB();
  let array = ['C1-10', 'H1-10'];
  emdb.fromArray(array); // create a database 'generated' combining all possibilities
  console.log(emdb.get('generated').length); // 100
</script>

// from the browser

fromMolecules

  • Generates a database 'monoisotopic' from a monoisotopic mass and various options
fromMolecules(entries: any, ocl: any, options: object): Promise
Parameters
entries (any)
ocl (any)
options (object = {})
Name Description
options.onStep function? Callback to do after each step
options.allowNeutral boolean (default true)
options.ionizations string (default '') string containing a comma separated list of modifications
options.precision number (default 100) Allowed mass range based on precision
options.groupResults boolean (default false) Should we group the results if they have the same monoisotopic mass and experimental mass
options.fragmentation object (default {})
options.fragmentation.acyclic object (default false)
options.fragmentation.cyclic object (default false)
options.fragmentation.full object (default true)
Returns
Promise:

groupFragmentationResults

We could group the results and replace the property 'fragment' by 'fragments'

groupFragmentationResults(results: any)
Parameters
results (any)

getMolecule

getMolecule(entry: object, ocl: any)
Parameters
entry (object)
ocl (any)

fromMonoisotopicMass

Generates a database 'monoisotopic' from a monoisotopic mass and various options

fromMonoisotopicMass(masses: (number | string | array), options: object): Promise
Parameters
masses ((number | string | array)) Monoisotopic mass
options (object = {})
Name Description
options.maxIterations number (default 10000000) Maximum number of iterations
options.onStep function? Callback to do after each step
options.allowNeutral boolean (default true)
options.uniqueMFs boolean (default true)
options.limit number (default 1000) Maximum number of results
options.ionizations string (default '') string containing a comma separated list of modifications
options.ranges string (default 'C0-100 H0-100 O0-100 N0-100') range of mfs to search
options.precision number (default 100) Allowed mass range based on precision
options.filter object (default {})
options.filter.minCharge number (default -Infinity) Minimal charge
options.filter.maxCharge number (default +Infinity) Maximal charge
options.filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
options.filter.unsaturation object (default {})
options.filter.unsaturation.min number (default -Infinity) Minimal unsaturation
options.filter.unsaturation.max number (default +Infinity) Maximal unsaturation
options.filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
options.filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
options.filter.atoms object? object of atom:{min, max}
options.filter.callback function? a function to filter the MF
Returns
Promise:

fromNucleicSequence

Add a database starting from a peptidic sequence

fromNucleicSequence(sequencesString: string?, options: object): Promise
Parameters
sequencesString (string?) Sequence as a string of 1 letter or 3 letters code. Could also be a correct molecular formula respecting uppercase, lowercase
options (object = {})
Name Description
options.estimate boolean (default false) estimate the number of MF without filters
options.onStep function? Callback to do after each step
options.limit number (default 100000)
options.ionizations string (default '')
options.info object (default {})
options.info.kind string? rna, ds-dna or dna. Default if contains U: rna, otherwise ds-dna
options.info.fivePrime string (default monophosphate) alcohol, monophosphate, diphosphate, triphosphate
options.info.circular string (default false)
options.mfsArray array (default [])
options.fragmentation object (default {}) Object defining options for fragmentation
options.fragmentation.a boolean (default false) If true allow fragments of type 'a'
options.fragmentation.ab boolean (default false) If true allow fragments of type 'a' minus base
options.fragmentation.b boolean (default false) If true allow fragments of type 'b'
options.fragmentation.c boolean (default false) If true allow fragments of type 'c'
options.fragmentation.d boolean (default false) If true allow fragments of type 'd'
options.fragmentation.dh2o boolean (default false) If true allow fragments of type 'd' with water loss
options.fragmentation.w boolean (default false) If true allow fragments of type 'w'
options.fragmentation.x boolean (default false) If true allow fragments of type 'x'
options.fragmentation.y boolean (default false) If true allow fragments of type 'y'
options.fragmentation.z boolean (default false) If true allow fragments of type 'z'
options.baseLoss boolean (default false) If true allow base loss at all the positions
options.filter object (default {}) Object defining options for molecular formula filter
options.filter.minMass number (default 0) Minimal monoisotopic mass
options.filter.maxMass number (default +Infinity) Maximal monoisotopic mass
options.filter.minEM number (default 0) Minimal neutral monoisotopic mass
options.filter.maxEM number (default +Infinity) Maximal neutral monoisotopic mass
options.filter.minMSEM number (default 0) Minimal observed monoisotopic mass
options.filter.maxMSEM number (default +Infinity) Maximal observed monoisotopic mass
options.filter.minCharge number (default -Infinity) Minimal charge
options.filter.maxCharge number (default +Infinity) Maximal charge
options.filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
options.filter.unsaturation object (default {})
options.filter.unsaturation.min number (default -Infinity) Minimal unsaturation
options.filter.unsaturation.max number (default +Infinity) Maximal unsaturation
options.filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
options.filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
Returns
Promise:

fromPeptidicSequence

Add a database starting from a peptidic sequence

fromPeptidicSequence(sequences: string?, options: object): Promise
Parameters
sequences (string?) Sequence as a string of 1 letter or 3 letters code. Could also be a correct molecular formula respecting uppercase, lowercase. It can be comma separated if you have many peptide sequences
options (object = {})
Name Description
options.estimate boolean (default false) estimate the number of MF without filters
options.ionizations string (default '')
options.onStep function? Callback to do after each step
options.mfsArray array (default [])
options.protonation boolean (default false)
options.protonationPH number (default 7)
options.allowNeutralLoss boolean (default false)
options.limit number (default 100000)
options.digestion object (default {}) Object defining options for digestion
options.digestion.minMissed number (default 0) Minimal number of allowed missed cleavage
options.digestion.maxMissed number (default 0) Maximal number of allowed missed cleavage
options.digestion.minResidue number (default 0) Minimal number of residues
options.digestion.maxResidue number (default +Infinity) Maximal number of residues
options.digestion.enzyme string? Mandatory field containing the name of the enzyme among: chymotrypsin, trypsin, glucph4, glucph8, thermolysin, cyanogenbromide
options.fragmentation object (default {}) Object defining options for fragmentation
options.fragmentation.a boolean (default false) If true allow fragments of type 'a'
options.fragmentation.b boolean (default false) If true allow fragments of type 'b'
options.fragmentation.c boolean (default false) If true allow fragments of type 'c'
options.fragmentation.x boolean (default false) If true allow fragments of type 'x'
options.fragmentation.y boolean (default false) If true allow fragments of type 'y'
options.fragmentation.z boolean (default false) If true allow fragments of type 'z'
options.fragmentation.ya boolean (default false) If true allow fragments of type 'ya'
options.fragmentation.yb boolean (default false) If true allow fragments of type 'yb'
options.fragmentation.yc boolean (default false) If true allow fragments of type 'yc'
options.fragmentation.zc boolean (default false) If true allow fragments of type 'zc'
options.fragmentation.minInternal number (default 0) Minimal internal fragment length
options.fragmentation.maxInternal number (default +Infinity) Maximal internal fragment length
options.filter object (default {}) Object defining options for molecular formula filter
options.filter.precision number (default 1000) The precision on the experimental mass
options.filter.targetMass number? Target mass, allows to calculate error and filter results
options.filter.targetMasses Array<number>? Target masses: SORTED array of numbers
options.filter.targetIntensities Array<number>? Target intensities: SORTED array of numbers
options.filter.minEM number (default 0) Minimal neutral monoisotopic mass
options.filter.maxEM number (default +Infinity) Maximal neutral monoisotopic mass
options.filter.minMSEM number (default 0) Minimal observed monoisotopic mass
options.filter.maxMSEM number (default +Infinity) Maximal observed monoisotopic mass
options.filter.minCharge number (default -Infinity) Minimal charge
options.filter.maxCharge number (default +Infinity) Maximal charge
options.filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
options.filter.unsaturation object (default {})
options.filter.unsaturation.min number (default -Infinity) Minimal unsaturation
options.filter.unsaturation.max number (default +Infinity) Maximal unsaturation
options.filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
options.filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
options.filter.callback function? a function to filter the MF
Returns
Promise:

fromRange

Generates a database 'generated' from an array of molecular formula

fromRange(rangesString: string, options: object): Promise
Parameters
rangesString (string) a string representing the range to search
options (object = {})
Name Description
options.estimate boolean (default false) estimate the number of MF without filters
options.onStep function? Callback to do after each step
options.databaseName string (default 'generated')
options.limit number (default 100000) Maximum number of results
options.canonizeMF boolean (default true) Canonize molecular formula
options.uniqueMFs boolean (default true) Force canonization and make MF unique
options.ionizations string (default '') Comma separated list of ionizations (to charge the molecule)
options.filter object (default {})
options.filter.minMass number (default 0) Minimal monoisotopic mass
options.filter.maxMass number (default +Infinity) Maximal monoisotopic mass
options.filter.minEM number (default 0) Minimal neutral monoisotopic mass
options.filter.maxEM number (default +Infinity) Maximal neutral monoisotopic mass
options.filter.minMSEM number (default 0) Minimal observed monoisotopic mass
options.filter.maxMSEM number (default +Infinity) Maximal observed monoisotopic mass
options.filter.minCharge number (default -Infinity) Minimal charge
options.filter.maxCharge number (default +Infinity) Maximal charge
options.filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
options.filter.unsaturation object (default {})
options.filter.unsaturation.min number (default -Infinity) Minimal unsaturation
options.filter.unsaturation.max number (default +Infinity) Maximal unsaturation
options.filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
options.filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
options.filter.callback function? a function to filter the MF
options.filter.atoms object? object of atom:{min, max}
Returns
Promise: list of possible molecular formula
Example
const {EMDB} = require('emdb');
let emdb = new EMDB();
// semi-columns separated for combination, comma for 'or'
emdb.fromRange('C1-10, H1-10; Cl0-1 Br0-1'); // create a database 'generated' combining all possibilies
console.log(emdb.get('generated').length); // 80

Searching by various criteria. This mass will not take into account the mass of the mass of the electron

search(emdb: any, filter: object, options: object)
Parameters
emdb (any)
filter (object = {})
Name Description
filter.minMW number (default 0) Minimal molecular weight
filter.maxMW number (default +Infinity) Maximal molecular weight
filter.minEM number (default 0) Minimal monoisotopic mass
filter.maxEM number (default +Infinity) Maximal monoisotopic mass
filter.minCharge number (default -Infinity) Minimal charge
filter.maxCharge number (default +Infinity) Maximal charge
filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
filter.unsaturation object (default {})
filter.unsaturation.min number (default -Infinity) Minimal unsaturation
filter.unsaturation.max number (default +Infinity) Maximal unsaturation
filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
filter.atoms object? object of atom:{min, max}
options (object = {})
Name Description
options.databases array? an array containing the name of the databases so search, by default all
options.flatten boolean (default false) should we return the array as a flat result

searchMSEM

Search for an experimental monoisotopic mass

searchMSEM(emdb: any, msem: number, options: object)
Parameters
emdb (any)
msem (number) The observed monoisotopic mass
options (object = {})
Name Description
options.databases array? an array containing the name of the databases so search, by default all
options.flatten boolean (default false) should we return the array as a flat result
options.ionizations string? list the allowed ionizations possibilities

searchSimilarity

Search for an experimental monoisotopic mass and calculate the similarity

searchSimilarity(emdb: any, options: object): Promise
Parameters
emdb (any)
options (object = {})
Name Description
options.databases array? an array containing the name of the databases so search, by default all
options.flatten boolean? should we return the array as a flat result
options.onStep function? Callback to do after each step
options.ionizations string (default '') Comma separated list of ionizations (to charge the molecule)
options.minSimilarity object (default 0.5) min similarity value
options.filter object (default {})
options.filter.forceIonization boolean (default false) If true ignore existing ionizations
options.filter.msem number? Observed monoisotopic mass in mass spectrometer
options.filter.precision number (default 1000) The precision on the experimental mass
options.filter.minCharge number (default -Infinity) Minimal charge
options.filter.maxCharge number (default +Infinity) Maximal charge
options.filter.absoluteCharge boolean (default false) If true, the charge is absolute (so between 0 and +Infinity by default)
options.filter.unsaturation object (default {})
options.filter.unsaturation.min number (default -Infinity) Minimal unsaturation
options.filter.unsaturation.max number (default +Infinity) Maximal unsaturation
options.filter.unsaturation.onlyInteger boolean (default false) Integer unsaturation
options.filter.unsaturation.onlyNonInteger boolean (default false) Non integer unsaturation
options.filter.atoms object? object of atom:{min, max}
options.filter.callback object? a function to filter the MF
options.similarity object (default {})
options.similarity.widthBottom number?
options.similarity.widthTop number?
options.similarity.widthFunction object? function called with mass that should return an object width containing top and bottom
options.similarity.zone object (default {})
options.similarity.zone.low number (default -0.5) window shift based on observed monoisotopic mass
options.similarity.zone.high number (default 2.5) to value for the comparison window
options.similarity.zone.auto boolean (default false) if true, low / high is determined based on the isotopic distribution and the threshold
options.similarity.common string?
options.similarity.threshold number (default 0.001) when calculating similarity we only use the isotopic distribution with peaks over this relative threshold
options.similarity.limit number? We may define the maximum number of peaks to keep
Returns
Promise:

massShifts

Calculates a function that allows post-calibration on mass spectra based on the error in assignment

massShifts(similarities: any, options: object)
Parameters
similarities (any)
options (object = {})