Skip to content

Commit

Permalink
ad ionizations in calculateForMF serie name
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Sep 5, 2018
1 parent e87f765 commit 6fc57eb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/Chromatogram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/ms/__tests__/calculateForMF.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 6fc57eb

Please sign in to comment.