/// <summary>
        /// True if this node has siblings with the same charge state, and
        /// if those siblings must be in-synch, then only if they are not.
        /// For small molecules, true only if all transitions are precursor transitions
        /// </summary>
        private bool HasSiblingsToSynch(bool mustBeInSynch)
        {
            var siblingNodes = Parent.Nodes;

            if (siblingNodes.Count > 1)
            {
                // For small molecules, we can only synch precursor transitions,
                // and only if both transition groups are defined by formula, or both by mz
                if (!IsSynchable())
                {
                    return(false);
                }
                var tranGroupThis = DocNode.TransitionGroup;
                foreach (TransitionGroupTreeNode nodeTree in siblingNodes)
                {
                    var tranGroup = nodeTree.DocNode.TransitionGroup;
                    if (!ReferenceEquals(tranGroupThis, tranGroup) &&
                        tranGroupThis.PrecursorCharge == tranGroup.PrecursorCharge &&
                        !(mustBeInSynch && DocNode.EquivalentChildren(nodeTree.DocNode)))
                    {
                        if (!tranGroupThis.IsCustomIon)
                        {
                            return(true);
                        }
                        else if (tranGroup.IsCustomIon && nodeTree.IsSynchable() &&
                                 string.IsNullOrEmpty(tranGroupThis.CustomIon.Formula) ==
                                 string.IsNullOrEmpty(tranGroup.CustomIon.Formula))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemple #2
0
        /// <summary>
        /// True if this node has siblings with the same charge state, and
        /// if those siblings must be in-synch, then only if they are not.
        /// For small molecules, true only if all transitions are precursor transitions
        /// </summary>
        private bool HasSiblingsToSynch(bool mustBeInSynch)
        {
            var siblingNodes = Parent.Nodes;

            if (siblingNodes.Count > 1)
            {
                // For small molecules, we can only synch precursor transitions,
                // and only if both transition groups are defined by formula, or both by mz
                if (!IsSynchable())
                {
                    return(false);
                }
                var tranGroupThis  = DocNode.TransitionGroup;
                var adductNoLabels = tranGroupThis.PrecursorAdduct.Unlabeled; // If adduct contains an isotope label, ignore label for comparison purposes
                foreach (TransitionGroupTreeNode nodeTree in siblingNodes)
                {
                    var tranGroup = nodeTree.DocNode.TransitionGroup;
                    if (!ReferenceEquals(tranGroupThis, tranGroup) &&
                        Equals(adductNoLabels, tranGroup.PrecursorAdduct.Unlabeled) &&
                        !(mustBeInSynch && DocNode.EquivalentChildren(nodeTree.DocNode)))
                    {
                        if (!tranGroupThis.IsCustomIon)
                        {
                            return(true);
                        }
                        else if (tranGroup.IsCustomIon && nodeTree.IsSynchable() &&
                                 string.IsNullOrEmpty(tranGroupThis.CustomMolecule.Formula) ==
                                 string.IsNullOrEmpty(tranGroup.CustomMolecule.Formula))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }