From 6fc57eb7817ccf9b1391032b367057c23e2af48c Mon Sep 17 00:00:00 2001 From: Luc Patiny Date: Wed, 5 Sep 2018 16:06:30 +0200 Subject: [PATCH] ad ionizations in calculateForMF serie name --- src/Chromatogram.js | 5 ++++- src/ms/__tests__/calculateForMF.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Chromatogram.js b/src/Chromatogram.js index 87389d5..64a381f 100644 --- a/src/Chromatogram.js +++ b/src/Chromatogram.js @@ -246,7 +246,10 @@ export class Chromatogram { * @param {number} [options.ionizations='H+'] - List of allowed ionisation */ calculateForMF(targetMF, options = {}) { - const { serieName = `ms${targetMF}-${options.error || 0.5}` } = options; + const { + serieName = `ms${targetMF}-${options.ionizations || + 'H+'}-${options.error || 0.5}` + } = options; let result = calculateForMF(this, targetMF, options); this.addSerie(serieName, result, options); } diff --git a/src/ms/__tests__/calculateForMF.js b/src/ms/__tests__/calculateForMF.js index 4ad123c..fc1bf55 100644 --- a/src/ms/__tests__/calculateForMF.js +++ b/src/ms/__tests__/calculateForMF.js @@ -3,9 +3,9 @@ import { simple } from '../../__tests__/examples'; test('calculateForMF: simple case', () => { simple.calculateForMF('C10.C16H7', { ionizations: 'H+,Na+,K+' }); - expect(simple.getSerie('msC10.C16H7-0.5').data).toEqual([20, 0]); + expect(simple.getSerie('msC10.C16H7-H+,Na+,K+-0.5').data).toEqual([20, 0]); simple.calculateForMF('C16H7', { error: 1, ionizations: 'H+,Na+,K+' }); - expect(simple.getSerie('msC16H7-1').data).toEqual([20, 21]); + expect(simple.getSerie('msC16H7-H+,Na+,K+-1').data).toEqual([20, 21]); }); test('Errors', () => {