lib/bionode-seq.js
function sortReadingFrames(a, b) {
    var aSort = a.length
    var bSort = b.length
    if (bSort - aSort === 0) {
      var aStartCodon = a.slice(0, 3).toUpperCase().replace('T', 'U')
      var bStartCodon = b.slice(0, 3).toUpperCase().replace('T', 'U')
      if (aStartCodon === 'AUG') { aSort++ }
      if (bStartCodon === 'AUG') { bSort++ }
    }
    return bSort - aSort
  }
function sortReadingFrames(a, b) {
    var aSort = a.length
    var bSort = b.length
    if (bSort - aSort === 0) {
      var aStartCodon = a.slice(0, 3).toUpperCase().replace('T', 'U')
      var bStartCodon = b.slice(0, 3).toUpperCase().replace('T', 'U')
      if (aStartCodon === 'AUG') { aSort++ }
      if (bStartCodon === 'AUG') { bSort++ }
    }
    return bSort - aSort
  }
function sortReadingFrames ( a , b ) { var aSort = a . length var bSort = b . length if ( bSort - aSort === 0 ) { var aStartCodon = a . slice ( 0 , 3 ) . toUpperCase ( ) . replace ( 'T' , 'U' ) var bStartCodon = b . slice ( 0 , 3 ) . toUpperCase ( ) . replace ( 'T' , 'U' ) if ( aStartCodon === 'AUG' ) { aSort ++ } if ( bStartCodon === 'AUG' ) { bSort ++ } } return bSort - aSort }
Helper that sorts by length, giving priority to ones that start with ATG/AUG
Helper that sorts by length giving priority to ones that start with ATG / AUG