Exemplo n.º 1
0
        /// <summary>
        ///     Remove all SpectrumIdentificationItems that have a specEValue greater than the best specEValue in the list.
        /// </summary>
        public void RemoveMatchesNotBestSpecEValue()
        {
            ReRankBySpecEValue();
            var best = SpectrumIdentificationItems.First().GetSpecEValue();

            SpectrumIdentificationItems.RemoveAll(item => item.GetSpecEValue() > best);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Object hash code
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = PeptideEvidence != null?PeptideEvidence.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^
                           (SpectrumIdentificationItems != null ? SpectrumIdentificationItems.GetHashCode() : 0);
                return(hashCode);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        ///     Changes the rank so that items are ranked by specEValue, ascending
        ///     Also re-writes the ids
        /// </summary>
        public void ReRankBySpecEValue()
        {
            var siiIdBase = Id.ToUpper().Replace("SIR", "SII") + "_";

            SpectrumIdentificationItems.Sort((a, b) => a.GetSpecEValue().CompareTo(b.GetSpecEValue()));
            for (var i = 0; i < SpectrumIdentificationItems.Count; i++)
            {
                var rank = i + 1;
                SpectrumIdentificationItems[i].Rank = rank;
                SpectrumIdentificationItems[i].Id   = siiIdBase + rank;
            }
            Sort();
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Object hash code
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = Name != null?Name.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (SpectrumID != null ? SpectrumID.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (SpectrumIdentificationItems != null ? SpectrumIdentificationItems.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (SpectraData != null ? SpectraData.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CVParams != null ? CVParams.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (UserParams != null ? UserParams.GetHashCode() : 0);
                return(hashCode);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 ///     The lowest specEvalue in the SpectrumIdentificationItems
 /// </summary>
 /// <returns></returns>
 public double BestSpecEVal()
 {
     Sort();
     return(SpectrumIdentificationItems.First().GetSpecEValue());
 }
Exemplo n.º 6
0
 /// <summary>
 ///     Sort the SpectrumIdentificationItems by rank, ascending
 /// </summary>
 public void Sort()
 {
     SpectrumIdentificationItems.Sort((a, b) => a.Rank.CompareTo(b.Rank));
 }