static/js/calculate.js
/**
 * Export silhouette result as a TSV file.
 * @function exportSilh
 * @param {Object} mo - main object
 */
Export silhouette result as a TSV file.
@function exportSilh
@param {Object} mo - main object
Export silhouette result as a TSV file . @function exportSilh @param { Object } mo - main object
function exportSilh(mo) {
  const [ctgs, labels, bins, scores] = mo.cache.silhs;
  const data = mo.data,
        cols = mo.cols;
  let tsv = '';
  tsv += (cols.names[0] + '\tbin\tsilhouette\n');
  const ids = data[0];
  const n = scores.length;
  for (let i = 0; i < n; i++) {
    tsv += ([ids[ctgs[i]], bins[labels[i]], scores[i]].join('\t') + '\n');
  }
  const a = document.createElement('a');
  a.href = "data:text/tab-separated-values;charset=utf-8," +
    encodeURIComponent(tsv);
  a.download = 'silhouette.tsv';
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
}
function exportSilh ( mo ) { const [ ctgs , labels , bins , scores ] = mo . cache . silhs ; const data = mo . data , cols = mo . cols ; let tsv = '' ; tsv += ( cols . names [ 0 ] + '\tbin\tsilhouette\n' ) ; const ids = data [ 0 ] ; const n = scores . length ; for ( let i = 0 ; i < n ; i ++ ) { tsv += ( [ ids [ ctgs [ i ] ] , bins [ labels [ i ] ] , scores [ i ] ] . join ( '\t' ) + '\n' ) ; } const a = document . createElement ( 'a' ) ; a . href = "data:text/tab-separated-values;charset=utf-8," + encodeURIComponent ( tsv ) ; a . download = 'silhouette.tsv' ; document . body . appendChild ( a ) ; a . click ( ) ; document . body . removeChild ( a ) ; }
Export silhouette result as a TSV file.
Export silhouette result as a TSV file .