/// <summary> /// Sorts ascending by q value, nulls at the end /// </summary> /// <param name="match1">First peak bounds match</param> /// <param name="match2">Second peak bounds match</param> /// <returns></returns> public static int CompareQValue(PeakBoundsMatch match1, PeakBoundsMatch match2) { if (match1.QValue == null && match2.QValue == null) { return(0); } if (match1.QValue == null) { return(1); } if (match2.QValue == null) { return(-1); } return(Comparer <double> .Default.Compare(match1.QValue.Value, match2.QValue.Value)); }
/// <summary> /// Sorts descending by score, nulls at the end /// </summary> /// <param name="match1">First peak bounds match</param> /// <param name="match2">Second peak bounds match</param> /// <returns></returns> public static int CompareScore(PeakBoundsMatch match1, PeakBoundsMatch match2) { if (match1.Score == null && match2.Score == null) return 0; if (match1.Score == null) return 1; if (match2.Score == null) return -1; return Comparer<double>.Default.Compare(match2.Score.Value, match1.Score.Value); }