コード例 #1
0
ファイル: LinkedPeptide.cs プロジェクト: laeubisoft/pwiz
 protected bool Equals(LinkedPeptide other)
 {
     return(Equals(Peptide, other.Peptide) && IndexAa == other.IndexAa &&
            Equals(ExplicitMods, other.ExplicitMods));
 }
コード例 #2
0
ファイル: CrosslinkBuilder.cs プロジェクト: laeubisoft/pwiz
        public IEnumerable <TransitionDocNode> GetAllComplexTransitions(
            TransitionGroup transitionGroup,
            IsotopeDistInfo isotopeDist,
            IEnumerable <TransitionDocNode> simpleTransitions,
            bool useFilter)
        {
            var startingFragmentIons = new List <ComplexFragmentIon>();
            var productAdducts       = Settings.TransitionSettings.Filter.PeptideProductCharges.ToHashSet();
            var precursorLosses      = new HashSet <TransitionLosses>();

            foreach (var simpleTransition in simpleTransitions)
            {
                var startingFragmentIon = simpleTransition.ComplexFragmentIon
                                          .ChangeCrosslinkStructure(ExplicitMods.Crosslinks);
                startingFragmentIons.Add(startingFragmentIon);
                if (startingFragmentIon.IsIonTypePrecursor)
                {
                    precursorLosses.Add(startingFragmentIon.TransitionLosses);
                }
            }

            bool excludePrecursors = false;
            IEnumerable <Adduct> allProductAdducts;

            if (useFilter)
            {
                allProductAdducts = Settings.TransitionSettings.Filter.PeptideProductCharges;
                excludePrecursors = !Settings.TransitionSettings.Filter.PeptideIonTypes.Contains(IonType.precursor);
            }
            else
            {
                allProductAdducts = Settings.TransitionSettings.Filter.PeptideProductCharges
                                    .Concat(Transition.DEFAULT_PEPTIDE_CHARGES);
            }

            allProductAdducts = allProductAdducts.Append(transitionGroup.PrecursorAdduct);

            // Add ions representing the precursor waiting to be joined with a crosslinked peptide
            foreach (var productAdduct in allProductAdducts.Distinct())
            {
                foreach (var transitionLosses in precursorLosses)
                {
                    if (productAdduct.IsValidProductAdduct(transitionGroup.PrecursorAdduct, null))
                    {
                        var precursorTransition = new Transition(transitionGroup, IonType.precursor,
                                                                 Peptide.Sequence.Length - 1, 0, productAdduct);

                        startingFragmentIons.Add(new ComplexFragmentIon(precursorTransition, transitionLosses, ExplicitMods.Crosslinks, true));
                        startingFragmentIons.Add(new ComplexFragmentIon(precursorTransition, transitionLosses, ExplicitMods.Crosslinks));
                    }
                }
            }

            foreach (var complexFragmentIon in LinkedPeptide.PermuteComplexFragmentIons(ExplicitMods, Settings,
                                                                                        Settings.PeptideSettings.Modifications.MaxNeutralLosses, useFilter, startingFragmentIons.Distinct()).Distinct())
            {
                bool isPrecursor = complexFragmentIon.IsIonTypePrecursor;
                if (isPrecursor)
                {
                    if (excludePrecursors)
                    {
                        continue;
                    }
                    var expectedCharge = transitionGroup.PrecursorAdduct.AdductCharge;
                    if (complexFragmentIon.TransitionLosses != null)
                    {
                        if (complexFragmentIon.Transition.MassIndex != 0)
                        {
                            continue;
                        }
                        expectedCharge -= complexFragmentIon.TransitionLosses.TotalCharge;
                    }

                    if (expectedCharge != complexFragmentIon.Transition.Adduct.AdductCharge)
                    {
                        continue;
                    }
                }
                else
                {
                    if (complexFragmentIon.Transition.MassIndex != 0)
                    {
                        continue;
                    }
                    if (useFilter)
                    {
                        if (!productAdducts.Contains(complexFragmentIon.Transition.Adduct))
                        {
                            continue;
                        }
                    }
                }

                if (!complexFragmentIon.Transition.Adduct.IsValidProductAdduct(transitionGroup.PrecursorAdduct,
                                                                               complexFragmentIon.TransitionLosses))
                {
                    continue;
                }

                var complexTransitionDocNode = MakeTransitionDocNode(complexFragmentIon, isotopeDist);
                yield return(complexTransitionDocNode);
            }
        }