コード例 #1
0
 public TransitionDocNode(Transition id,
                          Annotations annotations,
                          TransitionLosses losses,
                          double massH,
                          TransitionIsotopeDistInfo isotopeDistInfo,
                          TransitionLibInfo libInfo,
                          Results <TransitionChromInfo> results)
     : base(id, annotations)
 {
     Losses = losses;
     if (losses != null)
     {
         massH -= losses.Mass;
     }
     if (id.IsCustom())
     {
         Mz = new SignedMz(BioMassCalc.CalculateIonMz(massH, id.Charge), id.IsNegative());
     }
     else
     {
         Mz = new SignedMz(SequenceMassCalc.GetMZ(massH, id.Charge) + SequenceMassCalc.GetPeptideInterval(id.DecoyMassShift), id.IsNegative());
     }
     IsotopeDistInfo = isotopeDistInfo;
     LibInfo         = libInfo;
     Results         = results;
 }
コード例 #2
0
        private static string GetMzLabel(TransitionDocNode nodeTran)
        {
            int?   massShift = nodeTran.Transition.DecoyMassShift;
            double shift     = SequenceMassCalc.GetPeptideInterval(massShift);

            return(string.Format(@"{0:F04}{1}", nodeTran.Mz - shift,
                                 Transition.GetDecoyText(massShift)));
        }
コード例 #3
0
        private static string GetMzLabel(TransitionGroup tranGroup, double precursorMz)
        {
            int?   massShift = tranGroup.DecoyMassShift;
            double shift     = SequenceMassCalc.GetPeptideInterval(massShift);

            return(string.Format(@"{0:F04}{1}", precursorMz - shift,
                                 Transition.GetDecoyText(massShift)));
        }
コード例 #4
0
        public double GetMassI(int massIndex, int?decoyMassShift = null)
        {
            // Return the original monoisotopic mass + H, if requested to maintain an exact match.
            if (massIndex == 0 && !decoyMassShift.HasValue)
            {
                return(_monoisotopicMass);
            }
            // Otherwize use the charge to convert from the peak center m/z values
            double shift = SequenceMassCalc.GetPeptideInterval(decoyMassShift);    // Correct for shift applied to the distribution

            return(_isMassH ? SequenceMassCalc.GetMH(ExpectedPeaks[MassIndexToPeakIndex(massIndex)].Mz - shift, _charge) : BioMassCalc.CalculateIonMassFromMz(ExpectedPeaks[MassIndexToPeakIndex(massIndex)].Mz - shift, _charge));
        }
コード例 #5
0
        public TypedMass GetMassI(int massIndex, int?decoyMassShift = null)
        {
            // Return the original monoisotopic mass + H, if requested to maintain an exact match.
            if (massIndex == 0 && !decoyMassShift.HasValue)
            {
                return(_monoisotopicMass);
            }
            // Otherwize use the charge to convert from the peak center m/z values
            double shift = SequenceMassCalc.GetPeptideInterval(decoyMassShift);    // Correct for shift applied to the distribution

            // ReSharper disable ImpureMethodCallOnReadonlyValueField
            return(_monoisotopicMass.IsMassH() ?
                   new TypedMass(SequenceMassCalc.GetMH(ExpectedPeaks[MassIndexToPeakIndex(massIndex)].Mz - shift, _adduct.AdductCharge), _monoisotopicMass.MassType) :
                   _adduct.MassFromMz(ExpectedPeaks[MassIndexToPeakIndex(massIndex)].Mz - shift, _monoisotopicMass.MassType));
            // ReSharper restore ImpureMethodCallOnReadonlyValueField
        }
コード例 #6
0
 public TransitionDocNode(Transition id,
                          Annotations annotations,
                          TransitionLosses losses,
                          TypedMass mass,
                          TransitionQuantInfo transitionQuantInfo,
                          Results <TransitionChromInfo> results)
     : base(id, annotations)
 {
     Losses = losses;
     if (losses != null)
     {
         mass -= losses.Mass;
     }
     Mz = id.IsCustom() ?
          new SignedMz(id.Adduct.MzFromNeutralMass(mass), id.IsNegative()) :
          new SignedMz(SequenceMassCalc.GetMZ(mass, id.Adduct) + SequenceMassCalc.GetPeptideInterval(id.DecoyMassShift), id.IsNegative());
     MzMassType      = mass.MassType;
     IsotopeDistInfo = transitionQuantInfo.IsotopeDistInfo;
     LibInfo         = transitionQuantInfo.LibInfo;
     Results         = results;
     Quantitative    = transitionQuantInfo.Quantititative;
 }
コード例 #7
0
        private static void ValidateDecoys(SrmDocument document, SrmDocument decoysDoc, bool modifiesSequences)
        {
            AssertEx.IsDocumentState(decoysDoc, 1, document.PeptideGroupCount + 1, document.PeptideCount * 2,
                                     document.PeptideTransitionGroupCount * 2, document.PeptideTransitionCount * 2);

            // Check for the existence of the Decoys peptide group and that everything under it is marked as a decoy.
            var nodePeptideGroupDecoy = decoysDoc.PeptideGroups.Single(nodePeptideGroup => nodePeptideGroup.IsDecoy);
            var dictModsToPep         = document.Peptides.ToDictionary(nodePep => nodePep.ModifiedSequence);

            foreach (var nodePep in nodePeptideGroupDecoy.Peptides)
            {
                Assert.AreEqual(true, nodePep.IsDecoy);
                PeptideDocNode nodePepSource = null;
                if (!modifiesSequences)
                {
                    Assert.IsNull(nodePep.SourceKey);
                }
                else
                {
                    Assert.IsNotNull(nodePep.SourceKey, string.Format("Source key for {0}{1} is null", nodePep.ModifiedSequence,
                                                                      nodePep.IsDecoy ? " - decoy" : string.Empty));
                    Assert.IsTrue(FastaSequence.IsExSequence(nodePep.SourceKey.Sequence));
                    Assert.AreEqual(nodePep.SourceKey.ModifiedSequence,
                                    SequenceMassCalc.NormalizeModifiedSequence(nodePep.SourceKey.ModifiedSequence));
                    if (nodePep.HasExplicitMods)
                    {
                        Assert.IsNotNull(nodePep.SourceKey.ExplicitMods);
                    }
                    Assert.IsTrue(dictModsToPep.TryGetValue(nodePep.SourceTextId, out nodePepSource));
                    var sourceKey = new ModifiedSequenceMods(nodePepSource.Peptide.Sequence, nodePepSource.ExplicitMods);
                    Assert.AreEqual(sourceKey.ExplicitMods, nodePep.SourceExplicitMods);
                }
                for (int i = 0; i < nodePep.TransitionGroupCount; i++)
                {
                    var nodeGroup = nodePep.TransitionGroups.ElementAt(i);
                    Assert.AreEqual(true, nodeGroup.IsDecoy);
                    TransitionGroupDocNode nodeGroupSource = null;
                    double shift = SequenceMassCalc.GetPeptideInterval(nodeGroup.TransitionGroup.DecoyMassShift);
                    if (nodePepSource != null && nodeGroup.TransitionGroup.DecoyMassShift.HasValue)
                    {
                        nodeGroupSource = nodePepSource.TransitionGroups.ElementAt(i);
                        Assert.AreEqual(nodeGroupSource.PrecursorMz + shift, nodeGroup.PrecursorMz, SequenceMassCalc.MassTolerance);
                    }
                    for (int j = 0; j < nodeGroup.TransitionCount; j++)
                    {
                        var nodeTran = nodeGroup.Transitions.ElementAt(j);
                        Assert.IsTrue(nodeTran.IsDecoy);
                        if (nodeTran.Transition.IsPrecursor())
                        {
                            Assert.AreEqual(nodeGroup.TransitionGroup.DecoyMassShift, nodeTran.Transition.DecoyMassShift);
                            if (nodeGroupSource != null)
                            {
                                Assert.AreEqual(nodeGroupSource.Transitions.ElementAt(j).Mz + shift, nodeTran.Mz, SequenceMassCalc.MassTolerance);
                            }
                        }
                    }
                }
            }

            // Check that the resulting document persists correctly by passing the SrmDocument to AssertEx.IsSerializable().
            AssertEx.Serializable(decoysDoc);
        }