static/js/miniplot.js
/**
 * Select a range of data in the mini plot.
 * @function miniPlotSelect
 * @param {Object} mo - main object
 * @description This operation is triggered when the user releases the mouse
 * button from the mini plot (either by clicking or by holding). The contigs
 * represented by the bars in the range of selection will be selected.
 */
Select a range of data in the mini plot.
@function miniPlotSelect
@param {Object} mo - main object
@description This operation is triggered when the user releases the mouse
button from the mini plot (either by clicking or by holding). The contigs
represented by the bars in the range of selection will be selected.
Select a range of data in the mini plot . @function miniPlotSelect @param { Object } mo - main object @description This operation is triggered when the user releases the mouse button from the mini plot ( either by clicking or by holding ) . The contigs represented by the bars in the range of selection will be selected .
function miniPlotSelect(mo) {
  const min = mo.mini.edges[mo.mini.bin0];
  const max = (mo.mini.bin1 === mo.mini.nbin - 1) ?
    NaN : mo.mini.edges[mo.mini.bin1 + 1];
  mo.mini.hist = null;
  mo.mini.edges = null;
  mo.mini.bin0 = null;
  mo.mini.bin1 = null;
  mo.mini.drag = null;
  const pick = mo.picked;
  let npick = mo.cache.npick;
  const col = mo.data[mo.mini.field];
  const n = mo.cache.nctg;
  let val;
  for (let i = 0; i < n; i++) {
    if (pick[i]) {
      val = col[i];
      if (val !== val || val < min || val >= max) {
        pick[i] = false;
        npick -= 1;
      }
    }
  }
  mo.cache.npick = npick;
  updateSelection(mo);
  mo.rena.focus();
}
function miniPlotSelect ( mo ) { const min = mo . mini . edges [ mo . mini . bin0 ] ; const max = ( mo . mini . bin1 === mo . mini . nbin - 1 ) ? NaN : mo . mini . edges [ mo . mini . bin1 + 1 ] ; mo . mini . hist = null ; mo . mini . edges = null ; mo . mini . bin0 = null ; mo . mini . bin1 = null ; mo . mini . drag = null ; const pick = mo . picked ; let npick = mo . cache . npick ; const col = mo . data [ mo . mini . field ] ; const n = mo . cache . nctg ; let val ; for ( let i = 0 ; i < n ; i ++ ) { if ( pick [ i ] ) { val = col [ i ] ; if ( val !== val || val < min || val >= max ) { pick [ i ] = false ; npick -= 1 ; } } } mo . cache . npick = npick ; updateSelection ( mo ) ; mo . rena . focus ( ) ; }
Select a range of data in the mini plot.
Select a range of data in the mini plot .
// determine range of selection // These are lower and upper bounds of the original data. The lower bound is // inclusive ("["). However the upper bound is tricky. In all but last bar, // it is exclusive (")"). But in the last bar, it is inclusive ("]"). // To tackle this, the code removes the upper bound of the last bar. // reset histogram status // find within selected contigs which ones are within the range // lower bound: inclusive; upper bound: exclusive