private static List<TransitionGroupDocNode> GetDecoyGroups(PeptideDocNode nodePep, Peptide decoyPeptide,
            ExplicitMods mods, IEnumerable<TransitionGroupDocNode> comparableGroups, SrmDocument document, bool shiftMass)
        {
            var decoyNodeTranGroupList = new List<TransitionGroupDocNode>();

            var chargeToPrecursor = new Tuple<int, TransitionGroupDocNode>[TransitionGroup.MAX_PRECURSOR_CHARGE+1];
            foreach (TransitionGroupDocNode nodeGroup in comparableGroups)
            {
                var transGroup = nodeGroup.TransitionGroup;

                int precursorMassShift;
                TransitionGroupDocNode nodeGroupPrimary = null;

                var primaryPrecursor = chargeToPrecursor[nodeGroup.TransitionGroup.PrecursorCharge];
                if (primaryPrecursor != null)
                {
                    precursorMassShift = primaryPrecursor.Item1;
                    nodeGroupPrimary = primaryPrecursor.Item2;
                }
                else if (shiftMass)
                {
                    precursorMassShift = GetPrecursorMassShift();
                }
                else
                {
                    precursorMassShift = TransitionGroup.ALTERED_SEQUENCE_DECOY_MZ_SHIFT;
                }

                var decoyGroup = new TransitionGroup(decoyPeptide, transGroup.PrecursorCharge,
                                                        transGroup.LabelType, false, precursorMassShift);

                var decoyNodeTranList = nodeGroupPrimary != null
                    ? decoyGroup.GetMatchingTransitions(document.Settings, nodeGroupPrimary, mods)
                    : GetDecoyTransitions(nodeGroup, decoyGroup, shiftMass);

                var nodeGroupDecoy = new TransitionGroupDocNode(decoyGroup,
                                                                Annotations.EMPTY,
                                                                document.Settings,
                                                                mods,
                                                                nodeGroup.LibInfo,
                                                                nodeGroup.ExplicitValues,
                                                                nodeGroup.Results,
                                                                decoyNodeTranList,
                                                                false);
                decoyNodeTranGroupList.Add(nodeGroupDecoy);

                if (primaryPrecursor == null)
                {
                    chargeToPrecursor[transGroup.PrecursorCharge] =
                        new Tuple<int, TransitionGroupDocNode>(precursorMassShift, nodeGroupDecoy);
                }
            }

            return decoyNodeTranGroupList;
        }
Beispiel #2
0
        public TransitionDocNode[] GetMatchingTransitions(TransitionGroup tranGroup, SrmSettings settings, ExplicitMods explicitMods)
        {
            int iMatch = Children.IndexOf(nodeGroup =>
                                          ((TransitionGroupDocNode)nodeGroup).TransitionGroup.PrecursorCharge == tranGroup.PrecursorCharge);
            if (iMatch == -1)
                return null;
            TransitionGroupDocNode nodeGroupMatching = (TransitionGroupDocNode) Children[iMatch];
            // If the matching node is auto-managed, and auto-select is on in the settings,
            // then returning no transitions should allow transitions to be chosen correctly
            // automatically.
            if (nodeGroupMatching.AutoManageChildren && settings.TransitionSettings.Filter.AutoSelect &&
                // Having disconnected libraries can mess up automatic picking
                    settings.PeptideSettings.Libraries.DisconnectedLibraries == null)
                return null;

            return tranGroup.GetMatchingTransitions(settings, nodeGroupMatching, explicitMods);
        }