static/js/select.js
/**
 * Update one piece of information of selected contigs.
 * @function updateInfoRow
 * @param {Object} row - one row in the info table
 * @param {Object} mo - main object
 * @param {Array} [picked] - indices of selected contigs
 * @description An explicitly supplied `picked` can save compute. This design
 * may or may not be most optimal though.
 */
Update one piece of information of selected contigs.
Update one piece of information of selected contigs .
function updateInfoRow(row, mo, picked) {
  let n;
  if (picked == null) {
    picked = [];
    const pick = mo.picked;
    n = mo.cache.nctg;
    for (let i = 0; i < n; i++) {
      if (pick[i]) picked.push(i);
    }
  }
  const idx = parseInt(row.getAttribute('data-idx'));
  const ref = parseInt(row.getAttribute('data-ref'));
  const metric = row.getAttribute('data-met');
  const type = mo.cols.types[idx];
  if (type === 'des') return;
  n = picked.length;
  const arr = Array(n);
  const data = mo.data;
  const col = data[idx];
  if (type === 'fea' || !ref) {
    for (let i = 0; i < n; i++) {
      arr[i] = col[picked[i]];
    }
    const [text, comment] = summFieldInfo(arr, type, metric);
    row.cells[1].innerHTML = text;
    row.cells[1].title = comment;
  }
  else {
    const rarr = Array(n);
    const rcol = data[ref];
    let ctg;
    for (let i = 0; i < n; i++) {
      ctg = picked[i];
      arr[i] = col[ctg];
      rarr[i] = rcol[ctg];
    }
    const [text, comment] = summFieldInfo(arr, type, metric, 3, rarr);
    row.cells[1].innerHTML = text;
    row.cells[1].title = comment;
  }
}
function updateInfoRow ( row , mo , picked ) { let n ; if ( picked == null ) { picked = [ ] ; const pick = mo . picked ; n = mo . cache . nctg ; for ( let i = 0 ; i < n ; i ++ ) { if ( pick [ i ] ) picked . push ( i ) ; } } const idx = parseInt ( row . getAttribute ( 'data-idx' ) ) ; const ref = parseInt ( row . getAttribute ( 'data-ref' ) ) ; const metric = row . getAttribute ( 'data-met' ) ; const type = mo . cols . types [ idx ] ; if ( type === 'des' ) return ; n = picked . length ; const arr = Array ( n ) ; const data = mo . data ; const col = data [ idx ] ; if ( type === 'fea' || ! ref ) { for ( let i = 0 ; i < n ; i ++ ) { arr [ i ] = col [ picked [ i ] ] ; } const [ text , comment ] = summFieldInfo ( arr , type , metric ) ; row . cells [ 1 ] . innerHTML = text ; row . cells [ 1 ] . title = comment ; } else { const rarr = Array ( n ) ; const rcol = data [ ref ] ; let ctg ; for ( let i = 0 ; i < n ; i ++ ) { ctg = picked [ i ] ; arr [ i ] = col [ ctg ] ; rarr [ i ] = rcol [ ctg ] ; } const [ text , comment ] = summFieldInfo ( arr , type , metric , 3 , rarr ) ; row . cells [ 1 ] . innerHTML = text ; row . cells [ 1 ] . title = comment ; } }
Update one piece of information of selected contigs.
Update one piece of information of selected contigs .
// find selected contigs // locate data column // descriptive field can't be summarized // just data, no reference // feature set field doesn't need reference // data and reference