Esempio n. 1
0
 private void SetCustomIonFragmentInfo(SkylineDocumentProto.Types.Transition transitionProto)
 {
     if (Transition.IsNonReporterCustomIon())
     {
         transitionProto.Formula = DataValues.ToOptional(Transition.CustomIon.Formula);
         if (Transition.CustomIon.AverageMass.IsMassH())
         {
             transitionProto.AverageMassH = DataValues.ToOptional(Transition.CustomIon.AverageMass);
         }
         else
         {
             transitionProto.AverageMass = DataValues.ToOptional(Transition.CustomIon.AverageMass);
         }
         if (Transition.CustomIon.MonoisotopicMass.IsMassH())
         {
             transitionProto.MonoMassH = DataValues.ToOptional(Transition.CustomIon.MonoisotopicMass);
         }
         else
         {
             transitionProto.MonoMass = DataValues.ToOptional(Transition.CustomIon.MonoisotopicMass);
         }
         transitionProto.CustomIonName = DataValues.ToOptional(Transition.CustomIon.Name);
         transitionProto.MoleculeId    = DataValues.ToOptional(Transition.CustomIon.AccessionNumbers.ToString());
     }
     else
     {
         transitionProto.MeasuredIonName = DataValues.ToOptional(Transition.CustomIon.Name);
     }
 }
Esempio n. 2
0
        public IEnumerable <SkylineDocumentProto.Types.TransitionPeak> GetTransitionPeakProtos(MeasuredResults measuredResults)
        {
            if (Results == null)
            {
                yield break;
            }
            for (int replicateIndex = 0; replicateIndex < Results.Count; replicateIndex++)
            {
                var replicateResults = Results[replicateIndex];
                if (replicateResults.IsEmpty)
                {
                    continue;
                }
                foreach (var transitionChromInfo in replicateResults)
                {
                    if (transitionChromInfo == null)
                    {
                        continue;
                    }
                    var transitionPeak = new SkylineDocumentProto.Types.TransitionPeak();
                    transitionPeak.OptimizationStep = transitionChromInfo.OptimizationStep;
                    if (null != transitionChromInfo.Annotations)
                    {
                        transitionPeak.Annotations = transitionChromInfo.Annotations.ToProtoAnnotations();
                    }
                    transitionPeak.ReplicateIndex       = replicateIndex;
                    transitionPeak.FileIndexInReplicate = measuredResults.Chromatograms[replicateIndex].IndexOfId(transitionChromInfo.FileId);
                    transitionPeak.MassError            = DataValues.ToOptional(transitionChromInfo.MassError);
                    transitionPeak.RetentionTime        = transitionChromInfo.RetentionTime;
                    transitionPeak.StartRetentionTime   = transitionChromInfo.StartRetentionTime;
                    transitionPeak.EndRetentionTime     = transitionChromInfo.EndRetentionTime;
                    transitionPeak.IonMobility          = DataValues.ToOptional(transitionChromInfo.IonMobility.IonMobility.Mobility);
                    transitionPeak.IonMobilityWindow    = DataValues.ToOptional(transitionChromInfo.IonMobility.IonMobilityExtractionWindowWidth);
                    transitionPeak.Area              = transitionChromInfo.Area;
                    transitionPeak.BackgroundArea    = transitionChromInfo.BackgroundArea;
                    transitionPeak.Height            = transitionChromInfo.Height;
                    transitionPeak.Fwhm              = transitionChromInfo.Fwhm;
                    transitionPeak.IsFwhmDegenerate  = transitionChromInfo.IsFwhmDegenerate;
                    transitionPeak.Truncated         = DataValues.ToOptional(transitionChromInfo.IsTruncated);
                    transitionPeak.UserSet           = DataValues.ToUserSet(transitionChromInfo.UserSet);
                    transitionPeak.ForcedIntegration = transitionChromInfo.IsForcedIntegration;
                    switch (transitionChromInfo.Identified)
                    {
                    case PeakIdentification.ALIGNED:
                        transitionPeak.Identified = SkylineDocumentProto.Types.PeakIdentification.Aligned;
                        break;

                    case PeakIdentification.FALSE:
                        transitionPeak.Identified = SkylineDocumentProto.Types.PeakIdentification.False;
                        break;

                    case PeakIdentification.TRUE:
                        transitionPeak.Identified = SkylineDocumentProto.Types.PeakIdentification.True;
                        break;
                    }
                    transitionPeak.Rank             = transitionChromInfo.Rank;
                    transitionPeak.RankByLevel      = transitionChromInfo.RankByLevel;
                    transitionPeak.PointsAcrossPeak = DataValues.ToOptional(transitionChromInfo.PointsAcrossPeak);
                    yield return(transitionPeak);
                }
            }
        }
Esempio n. 3
0
        public SkylineDocumentProto.Types.Transition ToTransitionProto(SrmSettings settings)
        {
            var transitionProto = new SkylineDocumentProto.Types.Transition
            {
                FragmentType    = DataValues.ToIonType(Transition.IonType),
                NotQuantitative = !ExplicitQuantitative
            };

            if (Transition.IsCustom() && !Transition.IsPrecursor())
            {
                SetCustomIonFragmentInfo(transitionProto);
            }
            transitionProto.DecoyMassShift = DataValues.ToOptional(Transition.DecoyMassShift);
            transitionProto.MassIndex      = Transition.MassIndex;
            if (HasDistInfo)
            {
                transitionProto.IsotopeDistRank       = DataValues.ToOptional(IsotopeDistInfo.Rank);
                transitionProto.IsotopeDistProportion = DataValues.ToOptional(IsotopeDistInfo.Proportion);
            }
            if (!Transition.IsPrecursor())
            {
                if (!Transition.IsCustom())
                {
                    transitionProto.FragmentOrdinal = Transition.Ordinal;
                    transitionProto.CalcNeutralMass = GetMoleculePersistentNeutralMass();
                }
                transitionProto.Charge = Transition.Charge;
                if (!Transition.Adduct.IsProteomic)
                {
                    transitionProto.Adduct = DataValues.ToOptional(Transition.Adduct.AsFormulaOrSignedInt());
                }
                if (!Transition.IsCustom())
                {
                    transitionProto.CleavageAa = Transition.AA;
                    transitionProto.LostMass   = LostMass;
                }
            }
            if (Annotations != null)
            {
                transitionProto.Annotations = Annotations.ToProtoAnnotations();
            }
            transitionProto.ProductMz = Mz;
            if (Losses != null)
            {
                foreach (var loss in Losses.Losses)
                {
                    var neutralLoss = new SkylineDocumentProto.Types.TransitionLoss();
                    if (loss.PrecursorMod == null)
                    {
                        neutralLoss.Formula          = loss.Loss.Formula;
                        neutralLoss.MonoisotopicMass = loss.Loss.MonoisotopicMass;
                        neutralLoss.AverageMass      = loss.Loss.AverageMass;
                        neutralLoss.LossInclusion    = DataValues.ToLossInclusion(loss.Loss.Inclusion);
                        neutralLoss.Charge           = loss.Loss.Charge;
                    }
                    else
                    {
                        neutralLoss.ModificationName = loss.PrecursorMod.Name;
                        neutralLoss.LossIndex        = loss.LossIndex;
                    }
                    transitionProto.Losses.Add(neutralLoss);
                }
            }
            if (HasLibInfo)
            {
                transitionProto.LibInfo = new SkylineDocumentProto.Types.TransitionLibInfo
                {
                    Intensity = LibInfo.Intensity,
                    Rank      = LibInfo.Rank
                };
            }
            if (Results != null)
            {
                transitionProto.Results = new SkylineDocumentProto.Types.TransitionResults();
                transitionProto.Results.Peaks.AddRange(GetTransitionPeakProtos(settings.MeasuredResults));
            }

            if (!Equals(ExplicitValues, ExplicitTransitionValues.EMPTY))
            {
                transitionProto.ExplicitCollisionEnergy             = DataValues.ToOptional(ExplicitValues.CollisionEnergy);
                transitionProto.ExplicitConeVoltage                 = DataValues.ToOptional(ExplicitValues.ConeVoltage);
                transitionProto.ExplicitDeclusteringPotential       = DataValues.ToOptional(ExplicitValues.DeclusteringPotential);
                transitionProto.ExplicitIonMobilityHighEnergyOffset = DataValues.ToOptional(ExplicitValues.IonMobilityHighEnergyOffset);
                transitionProto.ExplicitSLens = DataValues.ToOptional(ExplicitValues.SLens);
            }

            return(transitionProto);
        }