public IEnumerable <SkylineDocumentProto.Types.LinkedIon> GetLinkedIonProtos()
        {
            foreach (var child in Children)
            {
                var proto = new SkylineDocumentProto.Types.LinkedIon()
                {
                    ModificationIndex = child.Item1.IndexAa,
                    ModificationName  = child.Item1.ModName
                };

                if (child.Item2.IsOrphan)
                {
                    proto.Orphan = true;
                }
                else
                {
                    proto.IonType = DataValues.ToIonType(child.Item2.IonType);
                    proto.Ordinal = child.Item2.Ordinal;
                }
                proto.Children.AddRange(child.Item2.GetLinkedIonProtos());
                yield return(proto);
            }
        }
Exemple #2
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);
        }