///
/// Guesses the unit of measurement of divergence, based on the greatest value of divergence on the tree
///
Guesses the unit of measurement of divergence, based on the greatest value of divergence on the tree
Guesses the unit of measurement of divergence based on the greatest value of divergence on the tree
pub fn guess_from_max_divergence(max_divergence: f64) -> DivergenceUnits {
    // FIXME: This should be fixed upstream in augur & auspice, but it is hard to do without breaking Auspice JSON v2 format.
    // Taken from: https://github.com/nextstrain/auspice/blob/6a2d0f276fccf05bfc7084608bb0010a79086c83/src/components/tree/phyloTree/renderers.js#L376
    // A quote from there:
    //  > Prior to Jan 2020, the divergence measure was always "subs per site per year"
    //  > however certain datasets changed this to "subs per year" across entire sequence.
    //  > This distinction is not set in the JSON, so in order to correctly display the rate
    //  > we will "guess" this here. A future augur update will export this in a JSON key,
    //  > removing the need to guess
    //
    // HACK: Arbitrary threshold to make a guess
    const HACK_MAX_DIVERGENCE_THRESHOLD: f64 = 5.0;
    if max_divergence <= HACK_MAX_DIVERGENCE_THRESHOLD {
      DivergenceUnits::NumSubstitutionsPerYearPerSite
    } else {
      DivergenceUnits::NumSubstitutionsPerYear
    }
  }
pub fn guess_from_max_divergence ( max_divergence : f64 ) -> DivergenceUnits { // FIXME: This should be fixed upstream in augur & auspice, but it is hard to do without breaking Auspice JSON v2 format. // Taken from: https://github.com/nextstrain/auspice/blob/6a2d0f276fccf05bfc7084608bb0010a79086c83/src/components/tree/phyloTree/renderers.js#L376 // A quote from there: //  > Prior to Jan 2020, the divergence measure was always "subs per site per year" //  > however certain datasets changed this to "subs per year" across entire sequence. //  > This distinction is not set in the JSON, so in order to correctly display the rate //  > we will "guess" this here. A future augur update will export this in a JSON key, //  > removing the need to guess // // HACK: Arbitrary threshold to make a guess const HACK_MAX_DIVERGENCE_THRESHOLD : f64 = 5.0 ; if max_divergence <= HACK_MAX_DIVERGENCE_THRESHOLD { DivergenceUnits :: NumSubstitutionsPerYearPerSite } else { DivergenceUnits :: NumSubstitutionsPerYear } }
Guesses the unit of measurement of divergence, based on the greatest value of divergence on the tree
Guesses the unit of measurement of divergence based on the greatest value of divergence on the tree
max_divergence
f64