Exemple #1
0
        public override IEnumerable <DocNode> GetChoices(bool useFilter)
        {
            var nodePep = PepNode;

            if (nodePep == null)
            {
                throw new InvalidOperationException(
                          Resources.TransitionGroupTreeNode_GetChoices_Invalid_attempt_to_get_choices_for_a_node_that_has_not_been_added_to_the_tree_yet);
            }

            var listChildrenNew = DocNode.GetPrecursorChoices(DocSettings, nodePep.ExplicitMods, useFilter);

            // Existing transitions must be part of the first settings change to ensure proper
            // handling of user set peak boundaries.
            MergeChosen(listChildrenNew, useFilter, node => ((TransitionDocNode)node).Key(DocNode));
            var nodeGroup = (TransitionGroupDocNode)DocNode.ChangeChildrenChecked(listChildrenNew);
            var diff      = new SrmSettingsDiff(DocSettings, true);

            // Update results on the group to correctly handle user set peak boundaries
            nodeGroup = nodeGroup.UpdateResults(DocSettings, diff, nodePep, DocNode);

            // Make sure any properties that depend on peptide relationships,
            // like ratios get updated.
            nodePep = (PeptideDocNode)nodePep.ReplaceChild(nodeGroup);
            diff    = new SrmSettingsDiff(diff, SrmSettingsDiff.PROPS);
            nodePep = nodePep.ChangeSettings(DocSettings, diff);
            var id     = nodeGroup.Id;
            int iGroup = nodePep.Children.IndexOf(n => ReferenceEquals(n.Id, id));

            if (iGroup != -1)
            {
                nodeGroup = (TransitionGroupDocNode)nodePep.Children[iGroup];
            }
            listChildrenNew = new List <DocNode>(nodeGroup.Children);
            // Merge with existing transitions again to avoid changes based on the settings
            // updates.
            MergeChosen(listChildrenNew, useFilter, node => ((TransitionDocNode)node).Key(nodeGroup));
            return(listChildrenNew);
        }