static/js/util.js
/**
 * Generate a string to summarize a feature frequency map.
 * @function summFeatures
 * @param {Array} arr - feature set column
 * @returns {string} features sorted by frequency in descending order, prefixed
 * by frequency in parentheses if frequency is not 1.
 * @example 'K00001(5), K00023(2), K01456, K00789'
 */
Generate a string to summarize a feature frequency map.
@function summFeatures
@param {Array} arr - feature set column
@returns {string} features sorted by frequency in descending order, prefixed
by frequency in parentheses if frequency is not 1.
Generate a string to summarize a feature frequency map . @function summFeatures @param { Array } arr - feature set column @returns { string } features sorted by frequency in descending order prefixed by frequency in parentheses if frequency is not 1 .
function summFeatures(arr) {
  return Object.entries(listFeas(arr))
    .sort(([, a],[, b]) => b - a)
    .map(x => x[1] === 1 ? x[0] : `${x[0]}(${x[1]})`)
    .join(', ');
}
function summFeatures ( arr ) { return Object . entries ( listFeas ( arr ) ) . sort ( ( [ , a ] , [ , b ] ) => b - a ) . map ( x => x [ 1 ] === 1 ? x [ 0 ] : ` ${ x [ 0 ] } ${ x [ 1 ] } ` ) . join ( ', ' ) ; }
Generate a string to summarize a feature frequency map.
Generate a string to summarize a feature frequency map .