From 2abc033fec2774759b5b85ac2ce7f177cf5ff05e Mon Sep 17 00:00:00 2001 From: Miguel Angel Asencio Hurtado Date: Mon, 27 Nov 2017 08:41:52 -0500 Subject: [PATCH] fix(calculateBpc): allows empty mass values --- src/ms/calculateBpc.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ms/calculateBpc.js b/src/ms/calculateBpc.js index bde176a..deab862 100644 --- a/src/ms/calculateBpc.js +++ b/src/ms/calculateBpc.js @@ -13,7 +13,11 @@ export function calculateBpc(chrom) { var massSpectra = ms.data; var bpc = []; for (var massSpectrum of massSpectra) { - bpc.push(max(massSpectrum[1])); + if (massSpectrum[1].length > 0) { + bpc.push(max(massSpectrum[1])); + } else { + bpc.push(0); + } } return bpc;