peaks-similarity
Version:
Peaks similarity - calculate the similarity between 2 ordered arrays of peaks
43 lines • 1.53 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.commonExtractAndNormalize = void 0;
const extract_1 = require("./extract");
const getCommonArray_1 = require("./getCommonArray");
const normalize_1 = require("./normalize");
const index_1 = require("./index");
// this method will systematically take care of both array
function commonExtractAndNormalize(array1, array2, width, from, to, common) {
if (!Array.isArray(array1) || !Array.isArray(array2)) {
return {
info: undefined,
data: undefined,
};
}
const extract1 = (0, extract_1.extract)(array1, from, to);
const extract2 = (0, extract_1.extract)(array2, from, to);
let common1, common2, info1, info2;
if (common & index_1.COMMON_SECOND) {
common1 = (0, getCommonArray_1.getCommonArray)(extract1, extract2, width);
info1 = (0, normalize_1.normalize)(common1);
}
else {
common1 = extract1;
info1 = (0, normalize_1.normalize)(common1);
}
if (common & index_1.COMMON_FIRST) {
common2 = (0, getCommonArray_1.getCommonArray)(extract2, extract1, width);
info2 = (0, normalize_1.normalize)(common2);
}
else {
common2 = extract2;
info2 = (0, normalize_1.normalize)(common2);
}
return {
info1,
info2,
data1: common1,
data2: common2,
};
}
exports.commonExtractAndNormalize = commonExtractAndNormalize;
//# sourceMappingURL=commonExtractAndNormalize.js.map