mass-fragmentation
Advanced tools
Comparing version 1.8.0 to 1.9.0
{ | ||
"name": "mass-fragmentation", | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"description": "Code to fragment molecules", | ||
@@ -30,3 +30,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "3300321a615311f64760cb500afac49f1f0f7d23" | ||
"gitHead": "90cbc4b4397f04209190d40556c2d7e7752e6cbe" | ||
} |
@@ -11,4 +11,4 @@ import OCL from 'openchemlib'; | ||
const { trees, validNodes, masses } = reactionFragmentation(molecule); | ||
expect(validNodes).toHaveLength(616); | ||
expect(masses).toHaveLength(70); | ||
expect(validNodes).toHaveLength(549); | ||
expect(masses).toHaveLength(66); | ||
expect(trees).toMatchSnapshot(); | ||
@@ -24,3 +24,3 @@ }); | ||
}); | ||
expect(validNodes).toHaveLength(243); | ||
expect(validNodes).toHaveLength(249); | ||
expect(masses).toHaveLength(30); | ||
@@ -35,3 +35,3 @@ | ||
const { trees, validNodes, masses } = reactionFragmentation(molecule); | ||
expect(validNodes).toHaveLength(973); | ||
expect(validNodes).toHaveLength(997); | ||
expect(masses).toHaveLength(45); | ||
@@ -38,0 +38,0 @@ expect(trees).toMatchSnapshot(); |
@@ -6,3 +6,3 @@ import { getDatabase } from '../getDatabase.js'; | ||
const db = getDatabase(); | ||
expect(db).toHaveLength(255); | ||
expect(db).toHaveLength(187); | ||
}); | ||
@@ -12,3 +12,4 @@ it('kind:all and ionizationKind:esiPositive', () => { | ||
kind: ['ionization', 'resonance', 'reaction'], | ||
ionizationKind: ['esiPositive'], | ||
ionization: ['esi'], | ||
mode: ['positive'], | ||
}); | ||
@@ -20,3 +21,4 @@ expect(db).toHaveLength(184); | ||
kind: ['ionization', 'resonance', 'reaction'], | ||
ionizationKind: ['esiNegative'], | ||
ionization: ['esi'], | ||
mode: ['negative'], | ||
}); | ||
@@ -28,5 +30,5 @@ expect(db).toHaveLength(26); | ||
kind: ['ionization', 'resonance', 'reaction'], | ||
ionizationKind: ['ei'], | ||
ionization: ['ei'], | ||
}); | ||
expect(db).toHaveLength(45); | ||
expect(db).toHaveLength(46); | ||
}); | ||
@@ -36,3 +38,4 @@ it('kind:ionization and ionizationKind:all', () => { | ||
kind: ['ionization'], | ||
ionizationKind: ['esiPositive', 'esiNegative', 'ei'], | ||
ionization: ['esi', 'ei'], | ||
mode: ['positive', 'negative'], | ||
}); | ||
@@ -44,3 +47,4 @@ expect(db).toHaveLength(13); | ||
kind: ['ionization'], | ||
ionizationKind: ['esiPositive'], | ||
ionization: ['esi'], | ||
mode: ['positive'], | ||
}); | ||
@@ -52,3 +56,4 @@ expect(db).toHaveLength(12); | ||
kind: ['ionization'], | ||
ionizationKind: ['esiNegative'], | ||
ionization: ['esi'], | ||
mode: ['negative'], | ||
}); | ||
@@ -60,3 +65,3 @@ expect(db).toHaveLength(1); | ||
kind: ['ionization'], | ||
ionizationKind: ['ei'], | ||
ionization: ['ei'], | ||
}); | ||
@@ -68,3 +73,4 @@ expect(db).toHaveLength(0); | ||
kind: ['resonance'], | ||
ionizationKind: ['esiPositive', 'esiNegative', 'ei'], | ||
ionization: ['esi', 'ei'], | ||
mode: ['positive', 'negative'], | ||
}); | ||
@@ -76,3 +82,4 @@ expect(db).toHaveLength(3); | ||
kind: ['resonance'], | ||
ionizationKind: ['esiPositive'], | ||
ionization: ['esi'], | ||
mode: ['positive'], | ||
}); | ||
@@ -84,3 +91,4 @@ expect(db).toHaveLength(3); | ||
kind: ['resonance'], | ||
ionizationKind: ['esiNegative'], | ||
ionization: ['esi'], | ||
mode: ['negative'], | ||
}); | ||
@@ -92,3 +100,3 @@ expect(db).toHaveLength(0); | ||
kind: ['resonance'], | ||
ionizationKind: ['ei'], | ||
ionization: ['ei'], | ||
}); | ||
@@ -100,5 +108,6 @@ expect(db).toHaveLength(0); | ||
kind: ['reaction'], | ||
ionizationKind: ['esiPositive', 'esiNegative', 'ei'], | ||
ionization: ['esi'], | ||
mode: ['positive', 'negative'], | ||
}); | ||
expect(db).toHaveLength(239); | ||
expect(db).toHaveLength(171); | ||
}); | ||
@@ -108,3 +117,4 @@ it('kind:reaction and ionizationKind:esiPositive', () => { | ||
kind: ['reaction'], | ||
ionizationKind: ['esiPositive'], | ||
ionization: ['esi'], | ||
mode: ['positive'], | ||
}); | ||
@@ -116,3 +126,4 @@ expect(db).toHaveLength(169); | ||
kind: ['reaction'], | ||
ionizationKind: ['esiNegative'], | ||
ionization: ['esi'], | ||
mode: ['negative'], | ||
}); | ||
@@ -124,6 +135,6 @@ expect(db).toHaveLength(25); | ||
kind: ['reaction'], | ||
ionizationKind: ['ei'], | ||
ionization: ['ei'], | ||
}); | ||
expect(db).toHaveLength(45); | ||
expect(db).toHaveLength(46); | ||
}); | ||
}); |
@@ -8,3 +8,4 @@ import { parseDwar } from 'openchemlib-utils'; | ||
* @param {('ionization'|'resonance'|'reaction')[]} [options.kind=['ionization','resonance','reaction']] - The kind of database to be used | ||
* @param {('esiPositive'|'esiNegative'|'ei')[]} [options.ionizationKind=['esiPositive','esiNegative','ei']] - The ionization technique to be used | ||
* @param {('esi'|'ei')[]} [options.ionization=['esi','ei']] - The ionization technique to be used | ||
* @param {('positive'|'negative')[]} [options.mode=['positive','negative']] - The ionization mode to be used | ||
* @param {string} [options.dwar] - The dwar file to use. Default will use an included mass fragmentation database | ||
@@ -16,3 +17,4 @@ * @returns | ||
kind = ['ionization', 'resonance', 'reaction'], | ||
ionizationKind = ['esiPositive', 'esiNegative', 'ei'], | ||
ionization = ['esi', 'ei'], | ||
mode = ['positive', 'negative'], | ||
dwar, | ||
@@ -24,5 +26,6 @@ } = options; | ||
kind.some((k) => entry.kind.includes(k)) && | ||
ionizationKind.some((ik) => entry.ionization.includes(ik)), | ||
ionization.some((ik) => entry.ionization.split(',').includes(ik)) && | ||
mode.some((m) => entry.mode.split(',').includes(m)), | ||
); | ||
return database; | ||
} |
@@ -11,3 +11,4 @@ import { MF } from 'mf-parser'; | ||
* @param {Object} [options={}] | ||
* @param {('esiPositive'|'esiNegative'|'ei')[]} [options.ionizationKind=['esiPositive']] - The ionization technique to be used | ||
* @param {('esi'|'ei')[]} [options.ionization=['esi']] - The ionization technique to be used | ||
* @param {('positive'|'negative')[]} [options.mode=['positive']] - The ionization mode to be used | ||
* @param {number} [options.maxDepth=5] - The maximum depth of the overall fragmentation tree | ||
@@ -27,3 +28,4 @@ * @param {number} [options.limitReactions=200] - The maximum number of reactions to be applied to each branch | ||
const { | ||
ionizationKind = ['esiPositive'], | ||
ionization = ['esi'], | ||
mode = ['positive'], | ||
dwar, | ||
@@ -60,3 +62,4 @@ maxDepth = 5, | ||
kind: ['ionization'], | ||
ionizationKind, | ||
ionization, | ||
mode, | ||
dwar, | ||
@@ -69,3 +72,8 @@ }), | ||
); | ||
const reactionDb = getDatabase({ kind: ['reaction'], ionizationKind, dwar }); | ||
const reactionDb = getDatabase({ | ||
kind: ['reaction'], | ||
ionization, | ||
mode, | ||
dwar, | ||
}); | ||
@@ -72,0 +80,0 @@ for (let i = 1; i <= maxReactions; i++) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2432588
8189