Beispiel #1
0
 public TransitionDocNode(Transition id,
                          TransitionLosses losses,
                          TypedMass massH,
                          TransitionQuantInfo quantInfo,
                          ExplicitTransitionValues explicitTransitionValues)
     : this(id, Annotations.EMPTY, losses, massH, quantInfo, explicitTransitionValues, null)
 {
 }
Beispiel #2
0
 protected bool Equals(ExplicitTransitionValues other)
 {
     return(Equals(CollisionEnergy, other.CollisionEnergy) &&
            Equals(IonMobilityHighEnergyOffset, other.IonMobilityHighEnergyOffset) &&
            Equals(SLens, other.SLens) &&
            Equals(ConeVoltage, other.ConeVoltage) &&
            DeclusteringPotential.Equals(other.DeclusteringPotential));
 }
Beispiel #3
0
 public ExplicitTransitionValues(ExplicitTransitionValues other)
     : this(
         (other == null) ? null : other.CollisionEnergy,
         (other == null) ? null : other.IonMobilityHighEnergyOffset,
         (other == null) ? null : other.SLens,
         (other == null) ? null : other.ConeVoltage,
         (other == null) ? null : other.DeclusteringPotential)
 {
 }
Beispiel #4
0
        /// <summary>
        /// return a new object with values set only where they differ betwwen this and other, using the values of other
        /// </summary>
        public ExplicitTransitionValues Diff(ExplicitTransitionValues other)
        {
            if (other == null || other.Equals(EMPTY))
            {
                return(this);
            }

            return(Create(Equals(other.CollisionEnergy, CollisionEnergy) ? null : other.CollisionEnergy,
                          Equals(other.IonMobilityHighEnergyOffset, IonMobilityHighEnergyOffset) ? null : other.IonMobilityHighEnergyOffset,
                          Equals(other.SLens, SLens) ? null : other.SLens,
                          Equals(other.ConeVoltage, ConeVoltage) ? null : other.ConeVoltage,
                          Equals(other.DeclusteringPotential, DeclusteringPotential) ? null : other.DeclusteringPotential));
        }
Beispiel #5
0
        /// <summary>
        /// return a new object with values taken from other, only where this lacks values
        /// </summary>
        public ExplicitTransitionValues Merge(ExplicitTransitionValues other)
        {
            if (other == null || other.Equals(EMPTY))
            {
                return(this);
            }

            return(Create(CollisionEnergy.HasValue ? CollisionEnergy : other.CollisionEnergy,
                          IonMobilityHighEnergyOffset.HasValue ? IonMobilityHighEnergyOffset : other.IonMobilityHighEnergyOffset,
                          SLens.HasValue ? SLens : other.SLens,
                          ConeVoltage.HasValue ? ConeVoltage : other.ConeVoltage,
                          DeclusteringPotential.HasValue ? DeclusteringPotential : other.DeclusteringPotential));
        }
Beispiel #6
0
 public TransitionDocNode(Transition id,
                          Annotations annotations,
                          TransitionLosses losses,
                          TypedMass mass,
                          TransitionQuantInfo transitionQuantInfo,
                          ExplicitTransitionValues explicitTransitionValues,
                          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;
     ExplicitQuantitative = transitionQuantInfo.Quantititative;
     ExplicitValues       = explicitTransitionValues ?? ExplicitTransitionValues.EMPTY;
 }
Beispiel #7
0
 public TransitionDocNode ChangeExplicitValues(ExplicitTransitionValues prop)
 {
     return(ChangeProp(ImClone(this), im => im.ExplicitValues = prop));
 }
Beispiel #8
0
        public static TransitionDocNode FromTransitionProto(AnnotationScrubber scrubber, SrmSettings settings,
                                                            TransitionGroup group, ExplicitMods mods, IsotopeDistInfo isotopeDist, ExplicitTransitionValues pre422ExplicitTransitionValues,
                                                            SkylineDocumentProto.Types.Transition transitionProto)
        {
            var         stringPool  = scrubber.StringPool;
            IonType     ionType     = DataValues.FromIonType(transitionProto.FragmentType);
            MeasuredIon measuredIon = null;

            if (transitionProto.MeasuredIonName != null)
            {
                measuredIon = settings.TransitionSettings.Filter.MeasuredIons.SingleOrDefault(
                    i => i.Name.Equals(transitionProto.MeasuredIonName.Value));
                if (measuredIon == null)
                {
                    throw new InvalidDataException(string.Format(Resources.TransitionInfo_ReadXmlAttributes_The_reporter_ion__0__was_not_found_in_the_transition_filter_settings_, transitionProto.MeasuredIonName));
                }
                ionType = IonType.custom;
            }
            bool           isCustom    = Transition.IsCustom(ionType, group);
            bool           isPrecursor = Transition.IsPrecursor(ionType);
            CustomMolecule customIon   = null;

            if (isCustom)
            {
                if (measuredIon != null)
                {
                    customIon = measuredIon.SettingsCustomIon;
                }
                else if (isPrecursor)
                {
                    customIon = group.CustomMolecule;
                }
                else
                {
                    var formula      = DataValues.FromOptional(transitionProto.Formula);
                    var moleculeID   = MoleculeAccessionNumbers.FromString(DataValues.FromOptional(transitionProto.MoleculeId)); // Tab separated list of InChiKey, CAS etc
                    var monoMassH    = DataValues.FromOptional(transitionProto.MonoMassH);
                    var averageMassH = DataValues.FromOptional(transitionProto.AverageMassH);
                    var monoMass     = DataValues.FromOptional(transitionProto.MonoMass) ?? monoMassH;
                    var averageMass  = DataValues.FromOptional(transitionProto.AverageMass) ?? averageMassH;
                    customIon = new CustomMolecule(formula,
                                                   new TypedMass(monoMass.Value, monoMassH.HasValue ? MassType.MonoisotopicMassH : MassType.Monoisotopic),
                                                   new TypedMass(averageMass.Value, averageMassH.HasValue ? MassType.AverageMassH : MassType.Average),
                                                   DataValues.FromOptional(transitionProto.CustomIonName), moleculeID);
                }
            }
            Transition transition;
            var        adductString = DataValues.FromOptional(transitionProto.Adduct);
            var        adduct       = string.IsNullOrEmpty(adductString)
                ? Adduct.FromChargeProtonated(transitionProto.Charge)
                : Adduct.FromStringAssumeChargeOnly(adductString);

            if (isCustom)
            {
                transition = new Transition(group, isPrecursor ? group.PrecursorAdduct :adduct, transitionProto.MassIndex, customIon, ionType);
            }
            else if (isPrecursor)
            {
                transition = new Transition(group, ionType, group.Peptide.Length - 1, transitionProto.MassIndex,
                                            group.PrecursorAdduct, DataValues.FromOptional(transitionProto.DecoyMassShift));
            }
            else
            {
                int offset = Transition.OrdinalToOffset(ionType, transitionProto.FragmentOrdinal,
                                                        group.Peptide.Length);
                transition = new Transition(group, ionType, offset, transitionProto.MassIndex, adduct, DataValues.FromOptional(transitionProto.DecoyMassShift));
            }
            var losses          = TransitionLosses.FromLossProtos(settings, transitionProto.Losses);
            var mass            = settings.GetFragmentMass(group, mods, transition, isotopeDist);
            var isotopeDistInfo = GetIsotopeDistInfo(transition, losses, isotopeDist);

            if (group.DecoyMassShift.HasValue && transitionProto.DecoyMassShift == null)
            {
                throw new InvalidDataException(Resources.SrmDocument_ReadTransitionXml_All_transitions_of_decoy_precursors_must_have_a_decoy_mass_shift);
            }

            TransitionLibInfo libInfo = null;

            if (transitionProto.LibInfo != null)
            {
                libInfo = new TransitionLibInfo(transitionProto.LibInfo.Rank, transitionProto.LibInfo.Intensity);
            }
            var annotations = scrubber.ScrubAnnotations(Annotations.FromProtoAnnotations(transitionProto.Annotations), AnnotationDef.AnnotationTarget.transition);
            var results     = TransitionChromInfo.FromProtoTransitionResults(scrubber, settings, transitionProto.Results);
            var explicitTransitionValues = pre422ExplicitTransitionValues ?? ExplicitTransitionValues.Create(
                DataValues.FromOptional(transitionProto.ExplicitCollisionEnergy),
                DataValues.FromOptional(transitionProto.ExplicitIonMobilityHighEnergyOffset),
                DataValues.FromOptional(transitionProto.ExplicitSLens),
                DataValues.FromOptional(transitionProto.ExplicitConeVoltage),
                DataValues.FromOptional(transitionProto.ExplicitDeclusteringPotential));

            return(new TransitionDocNode(transition, annotations, losses, mass, new TransitionQuantInfo(isotopeDistInfo, libInfo, !transitionProto.NotQuantitative), explicitTransitionValues, results));
        }