static/js/select.js
/**
 * Update info table of selected contigs.
 * @function updateInfoTable
 * @param {Object} mo - main object
 * @description It re-fills the info table with information of selected
 * contigs. It does not re-define rows and metrics.
 */
Update info table of selected contigs.
@function updateInfoTable
@param {Object} mo - main object
@description It re-fills the info table with information of selected
contigs. It does not re-define rows and metrics.
Update info table of selected contigs . @function updateInfoTable @param { Object } mo - main object @description It re - fills the info table with information of selected contigs . It does not re - define rows and metrics .
function updateInfoTable(mo) {
  const table = byId('info-table');
  const npick = mo.cache.npick;
  const data = mo.data,
        pick = mo.picked;
  const types = mo.cols.types;
  const label = `Selected: ${npick}`;
  byId('info-menu-wrap').classList.toggle('hidden', !npick);
  if (npick === 0) {
    byId('info-head-btn').innerHTML = label;
    table.classList.add('hidden');
  }
  else if (npick === 1) {
    const i = pick.indexOf(true);
    byId('info-head-btn').innerHTML = label + ` (ID: ${data[0][i]})`;
    let idx;
    for (let row of table.rows) {
      idx = parseInt(row.getAttribute('data-idx'));
      row.cells[1].innerHTML = value2Str(data[idx][i], types[idx]);
      row.cells[1].title = '';
    }
    table.classList.remove('hidden');
  }
  else {
    byId('info-head-btn').innerHTML = label;
    const n = mo.cache.nctg;
    const picked = [];
    for (let i = 0; i < n; i++) {
      if (pick[i]) picked.push(i);
    }
    for (let row of table.rows) {
      updateInfoRow(row, mo, picked);
    }
    table.classList.remove('hidden');
  }
}
function updateInfoTable ( mo ) { const table = byId ( 'info-table' ) ; const npick = mo . cache . npick ; const data = mo . data , pick = mo . picked ; const types = mo . cols . types ; const label = ` ${ npick } ` ; byId ( 'info-menu-wrap' ) . classList . toggle ( 'hidden' , ! npick ) ; if ( npick === 0 ) { byId ( 'info-head-btn' ) . innerHTML = label ; table . classList . add ( 'hidden' ) ; } else if ( npick === 1 ) { const i = pick . indexOf ( true ) ; byId ( 'info-head-btn' ) . innerHTML = label + ` ${ data [ 0 ] [ i ] } ` ; let idx ; for ( let row of table . rows ) { idx = parseInt ( row . getAttribute ( 'data-idx' ) ) ; row . cells [ 1 ] . innerHTML = value2Str ( data [ idx ] [ i ] , types [ idx ] ) ; row . cells [ 1 ] . title = '' ; } table . classList . remove ( 'hidden' ) ; } else { byId ( 'info-head-btn' ) . innerHTML = label ; const n = mo . cache . nctg ; const picked = [ ] ; for ( let i = 0 ; i < n ; i ++ ) { if ( pick [ i ] ) picked . push ( i ) ; } for ( let row of table . rows ) { updateInfoRow ( row , mo , picked ) ; } table . classList . remove ( 'hidden' ) ; } }
Update info table of selected contigs.
Update info table of selected contigs .
// display count in info panel head // show/hide panel head menu // no contig is selected // single contig // find that contig // append contig Id to panel head // display contig information // multiple contigs