コード例 #1
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            var other = obj as OptimizationKey;

            if (other == null)
            {
                throw new ArgumentException(Resources.OptimizationKey_CompareTo_Cannot_compare_OptimizationKey_to_an_object_of_a_different_type);
            }
            else if (!Equals(OptType, other.OptType))
            {
                return(OptType.CompareTo(other.OptType));
            }
            else if (!Equals(PeptideModSeq, other.PeptideModSeq))
            {
                return(PeptideModSeq.CompareTo(other.PeptideModSeq));
            }
            else if (!PrecursorAdduct.Equals(other.PrecursorAdduct))
            {
                return(PrecursorAdduct.CompareTo(other.PrecursorAdduct));
            }
            else if (FragmentIon != other.FragmentIon)
            {
                return(String.Compare(FragmentIon, other.FragmentIon, StringComparison.InvariantCulture));
            }
            else
            {
                return(ProductAdduct.CompareTo(other.ProductAdduct));
            }
        }
コード例 #2
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = _peptide.GetHashCode();
         result = (result * 397) ^ PrecursorAdduct.GetHashCode();
         result = (result * 397) ^ LabelType.GetHashCode();
         result = (result * 397) ^ (DecoyMassShift ?? 0);
         return(result);
     }
 }
コード例 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = (PeptideModSeq != null ? PeptideModSeq.GetHashCode() : 0);
         result = (result * 397) ^ OptType.GetHashCode();
         result = (result * 397) ^ PrecursorAdduct.GetHashCode();
         if (FragmentIon != null)
         {
             result = (result * 397) ^ FragmentIon.GetHashCode();
         }
         result = (result * 397) ^ ProductAdduct.GetHashCode();
         return(result);
     }
 }
コード例 #4
0
        public IEnumerable <TransitionDocNode> GetPrecursorTransitions(SrmSettings settings,
                                                                       ExplicitMods mods,
                                                                       IPrecursorMassCalc calcPredictPre,
                                                                       IFragmentMassCalc calcPredict,
                                                                       double precursorMz,
                                                                       IsotopeDistInfo isotopeDist,
                                                                       IList <IList <ExplicitLoss> > potentialLosses,
                                                                       IDictionary <double, LibraryRankedSpectrumInfo.RankedMI> transitionRanks,
                                                                       bool libraryFilter,
                                                                       bool useFilter)
        {
            var      tranSettings = settings.TransitionSettings;
            var      fullScan     = tranSettings.FullScan;
            int      minMz        = tranSettings.Instrument.GetMinMz(precursorMz);
            int      maxMz        = tranSettings.Instrument.MaxMz;
            bool     precursorMS1 = fullScan.IsEnabledMs;
            MassType massType     = tranSettings.Prediction.FragmentMassType;
            MassType massTypeIon  = precursorMS1 ? tranSettings.Prediction.PrecursorMassType : massType;

            var  sequence            = Peptide.Target;
            var  ionTypes            = IsProteomic ? tranSettings.Filter.PeptideIonTypes : tranSettings.Filter.SmallMoleculeIonTypes;
            bool precursorNoProducts = precursorMS1 && !fullScan.IsEnabledMsMs &&
                                       ionTypes.Count == 1 && ionTypes[0] == IonType.precursor;
            var precursorMassPredict = precursorMS1
                ? calcPredictPre.GetPrecursorMass(sequence)
                : calcPredict.GetPrecursorFragmentMass(sequence);

            foreach (var losses in CalcTransitionLosses(IonType.precursor, 0, massType, potentialLosses))
            {
                double ionMz = IsProteomic ?
                               SequenceMassCalc.GetMZ(Transition.CalcMass(precursorMassPredict, losses), PrecursorAdduct) :
                               PrecursorAdduct.MzFromNeutralMass(CustomMolecule.GetMass(massTypeIon), massTypeIon);

                if (losses == null)
                {
                    if (precursorMS1 && isotopeDist != null)
                    {
                        foreach (int i in fullScan.SelectMassIndices(isotopeDist, useFilter))
                        {
                            var precursorMS1Mass = isotopeDist.GetMassI(i, DecoyMassShift);
                            ionMz = SequenceMassCalc.GetMZ(precursorMS1Mass, PrecursorAdduct);
                            if (minMz > ionMz || ionMz > maxMz)
                            {
                                continue;
                            }
                            var isotopeDistInfo = new TransitionIsotopeDistInfo(
                                isotopeDist.GetRankI(i), isotopeDist.GetProportionI(i));
                            yield return(CreateTransitionNode(i, precursorMS1Mass, isotopeDistInfo, null, transitionRanks));
                        }
                        continue;
                    }
                }
                // If there was loss, it is possible (though not likely) that the ion m/z value
                // will now fall below the minimum measurable value for the instrument
                else if (minMz > ionMz)
                {
                    continue;
                }

                // If filtering precursors from MS1 scans, then ranking in MS/MS does not apply
                bool precursorIsProduct = !precursorMS1 || losses != null;
                // Skip product ion precursors, if the should not be included
                if (useFilter && precursorIsProduct && precursorNoProducts)
                {
                    continue;
                }
                if (!useFilter || !precursorIsProduct ||
                    !libraryFilter || IsMatched(transitionRanks, ionMz, IonType.precursor,
                                                PrecursorAdduct, losses))
                {
                    yield return(CreateTransitionNode(0, precursorMassPredict, null, losses,
                                                      precursorIsProduct ? transitionRanks : null));
                }
            }
        }