当前位置: 首页>>代码示例>>C#>>正文


C# SrmDocument.FindNode方法代码示例

本文整理汇总了C#中SrmDocument.FindNode方法的典型用法代码示例。如果您正苦于以下问题:C# SrmDocument.FindNode方法的具体用法?C# SrmDocument.FindNode怎么用?C# SrmDocument.FindNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SrmDocument的用法示例。


在下文中一共展示了SrmDocument.FindNode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDocNodes

 private List<DocNode> GetDocNodes(IdentityPath identityPath, SrmDocument document)
 {
     var result = new List<DocNode>();
     while (!identityPath.IsRoot)
     {
         result.Insert(0, document.FindNode(identityPath));
         identityPath = identityPath.Parent;
     }
     return result;
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:10,代码来源:ToolService.cs

示例2: ChangePeakBounds

 /// <summary>
 /// Modifies a document in response to a user's mouse dragging on a GraphChromatogram.
 /// </summary>
 private static SrmDocument ChangePeakBounds(SrmDocument document, IEnumerable<ChangedPeakBoundsEventArgs> changes)
 {
     var changedGroupIds = new HashSet<IdentityPath>();
     var peptideChanges = new Dictionary<IdentityPath, ChangedPeakBoundsEventArgs>();
     foreach (var change in changes)
     {
         document = document.ChangePeak(change.GroupPath, change.NameSet, change.FilePath, change.Transition,
             change.StartTime.MeasuredTime, change.EndTime.MeasuredTime, UserSet.TRUE, change.Identified, false);
         changedGroupIds.Add(change.GroupPath);
         if (!peptideChanges.ContainsKey(change.GroupPath.Parent)) {
             var transitionGroup = (TransitionGroupDocNode) document.FindNode(change.GroupPath);
             if (transitionGroup.RelativeRT == RelativeRT.Matching)
             {
                 peptideChanges.Add(change.GroupPath.Parent, change);
             }
         }
     }
     // See if there are any other TransitionGroups that also have RelativeRT matching,
     // and set their peak boundaries to the same.
     foreach (var entry in peptideChanges)
     {
         var peptide = (PeptideDocNode) document.FindNode(entry.Key);
         var change = entry.Value;
         foreach (var transitionGroup in peptide.TransitionGroups)
         {
             if (transitionGroup.RelativeRT != RelativeRT.Matching)
             {
                 continue;
             }
             var groupId = new IdentityPath(entry.Key, transitionGroup.TransitionGroup);
             if (changedGroupIds.Contains(groupId))
             {
                 continue;
             }
             if (null == FindChromInfo(document, transitionGroup, change.NameSet, change.FilePath))
             {
                 continue;
             }
             document = document.ChangePeak(groupId, change.NameSet, change.FilePath, null,
                 change.StartTime.MeasuredTime, change.EndTime.MeasuredTime, UserSet.TRUE, change.Identified, true);
         }
     }
     return document;
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:47,代码来源:SkylineGraphs.cs

示例3: PickPeak

 /// <summary>
 /// Modifies a document in response to the user clicking on a peak in the GraphChromatogram.
 /// </summary>
 private static SrmDocument PickPeak(SrmDocument document, PickedPeakEventArgs e)
 {
     document = document.ChangePeak(e.GroupPath, e.NameSet, e.FilePath, e.TransitionId, e.RetentionTime.MeasuredTime, UserSet.TRUE);
     var activeTransitionGroup = (TransitionGroupDocNode) document.FindNode(e.GroupPath);
     if (activeTransitionGroup.RelativeRT != RelativeRT.Matching)
     {
         return document;
     }
     var activeChromInfo = FindChromInfo(document, activeTransitionGroup, e.NameSet, e.FilePath);
     var peptide = (PeptideDocNode) document.FindNode(e.GroupPath.Parent);
     // See if there are any other transition groups that should have their peak bounds set to the same value
     foreach (var transitionGroup in peptide.TransitionGroups)
     {
         if (transitionGroup.RelativeRT != RelativeRT.Matching)
         {
             continue;
         }
         var groupPath = new IdentityPath(e.GroupPath.Parent, transitionGroup.TransitionGroup);
         if (Equals(groupPath, e.GroupPath))
         {
             continue;
         }
         var chromInfo = FindChromInfo(document, transitionGroup, e.NameSet, e.FilePath);
         if (null == chromInfo)
         {
             continue;
         }
         document = document.ChangePeak(groupPath, e.NameSet, e.FilePath, null,
             activeChromInfo.StartRetentionTime, activeChromInfo.EndRetentionTime, UserSet.TRUE, activeChromInfo.Identified, true);
     }
     return document;
 }
开发者ID:lgatto,项目名称:proteowizard,代码行数:35,代码来源:SkylineGraphs.cs

示例4: FindPeptideGroupDocNode

        private static PeptideGroupDocNode FindPeptideGroupDocNode(SrmDocument document, PeptideGroupDocNode nodePepGroup)
        {
            if (!nodePepGroup.IsPeptideList)
                return (PeptideGroupDocNode) document.FindNode(nodePepGroup.PeptideGroup);

            // Find peptide lists by name
            return FindPeptideGroupDocNode(document, nodePepGroup.Name);
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:8,代码来源:PasteDlg.cs

示例5: GetSelectedPeptideGroupDocNode

        private PeptideGroupDocNode GetSelectedPeptideGroupDocNode(SrmDocument document, IdentityPath selectedPath)
        {
            var to = selectedPath;
            if (to != null && to.Depth >= (int)SrmDocument.Level.MoleculeGroups)
                return (PeptideGroupDocNode) document.FindNode(to.GetIdentity((int) SrmDocument.Level.MoleculeGroups));

            PeptideGroupDocNode lastPeptideGroupDocuNode = null;
            foreach (PeptideGroupDocNode peptideGroupDocNode in document.MoleculeGroups)
            {
                lastPeptideGroupDocuNode = peptideGroupDocNode;
            }
            return lastPeptideGroupDocuNode;
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:13,代码来源:PasteDlg.cs

示例6: MultiLabelExplicitSerialTest

        public void MultiLabelExplicitSerialTest()
        {
            // Create a simple document and add two peptides
            SrmDocument document = new SrmDocument(SrmSettingsList.GetDefault());
            const string pepSequence1 = "QFVLSCVILR";
            const string pepSequence2 = "DIEVYCDGAITTK";
            var reader = new StringReader(string.Join("\n", new[] {">peptides1", pepSequence1, pepSequence2}));
            IdentityPath path;
            document = document.ImportFasta(reader, true, IdentityPath.ROOT, out path);
            Assert.AreEqual(2, document.PeptideCount);

            // Add some modifications in two new label types
            var modCarb = new StaticMod("Carbamidomethyl Cysteine", "C", null, "C2H3ON");
            var modOther = new StaticMod("Another Cysteine", "C", null, "CO8N2");
            var staticMods = new[] {modCarb, modOther};
            var mod15N = new StaticMod("All 15N", null, null, null, LabelAtoms.N15, null, null);
            var modK13C = new StaticMod("13C K", "K", ModTerminus.C, null, LabelAtoms.C13, null, null);
            var modR13C = new StaticMod("13C R", "R", ModTerminus.C, null, LabelAtoms.C13, null, null);
            var modV13C = new StaticMod("Heavy V", "V", null, null, LabelAtoms.C13 | LabelAtoms.N15, null, null);
            var heavyMods = new[] { mod15N, modK13C, modR13C, modV13C };
            var labelTypeAA = new IsotopeLabelType("heavy AA", IsotopeLabelType.FirstHeavy);
            var labelTypeAll = new IsotopeLabelType("heavy All", IsotopeLabelType.FirstHeavy + 1);

            var settings = document.Settings;
            settings = settings.ChangePeptideModifications(mods =>
                new PeptideModifications(mods.StaticModifications,
                    new[]
                        {
                            new TypedModifications(labelTypeAA, new[] {modK13C, modR13C}),
                            new TypedModifications(labelTypeAll, new[] {mod15N})
                        }));
            document = document.ChangeSettings(settings);
            Assert.AreEqual(6, document.PeptideTransitionGroupCount);

            // Add modifications to light and heavy AA in the first peptide
            path = document.GetPathTo((int) SrmDocument.Level.Molecules, 0);
            var nodePepMod = (PeptideDocNode) document.FindNode(path);
            var explicitMod = new ExplicitMods(nodePepMod.Peptide,
                new[] {new ExplicitMod(pepSequence1.IndexOf('C'), modOther)},
                new[] {new TypedExplicitModifications(nodePepMod.Peptide, labelTypeAA, new ExplicitMod[0])});
            document = document.ChangePeptideMods(path, explicitMod, staticMods, heavyMods);
            Assert.AreEqual(5, document.PeptideTransitionGroupCount);

            // Add a modification to heavy All in the second peptide
            path = document.GetPathTo((int)SrmDocument.Level.Molecules, 1);
            nodePepMod = (PeptideDocNode)document.FindNode(path);
            explicitMod = new ExplicitMods(nodePepMod.Peptide, null,
                new[] { new TypedExplicitModifications(nodePepMod.Peptide, labelTypeAll,
                            new[] {new ExplicitMod(pepSequence2.IndexOf('V'), modV13C)}) });
            document = document.ChangePeptideMods(path, explicitMod, staticMods, heavyMods);
            Assert.AreEqual(5, document.PeptideTransitionGroupCount);

            AssertEx.Serializable(document, 3, AssertEx.DocumentCloned);
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:54,代码来源:IsotypeModTest.cs

示例7: MergeAnnotations

        public static Annotations MergeAnnotations(SrmDocument document, IEnumerable<IdentityPath> selPaths, 
            out AnnotationDef.AnnotationTargetSet annotationTarget)
        {
            annotationTarget = AnnotationDef.AnnotationTargetSet.EMPTY;

            // If the nodes have matching text, colors, or annotations, then we should display these values
            // in the EditNodeDlg. Otherwise, we should not display any value for that variable.
            bool matchingText = true;
            bool matchingColors = true;
            bool isFirstSelNode = true;
            bool allEmpty = true;

            // These are the default values we want for the annotations, if the node(s) do not already have
            // annotations, or if the annotations do not match.
            string text = null;
            int colorIndex = -1;
            var dictMatchingAnnotations = new Dictionary<string, string>();

            // Find what all nodes have in common as far as note, annotations, and color.
            foreach (IdentityPath selPath in selPaths)
            {
                if(Equals(selPath.Child, SequenceTree.NODE_INSERT_ID))
                    continue;

                var nodeDoc = document.FindNode(selPath);
                var nodeAnnotations = nodeDoc.Annotations;
                var dictNodeAnnotations = nodeAnnotations.ListAnnotations()
                    .ToDictionary(nodeAnnotation => nodeAnnotation.Key,
                                  nodeAnnotation => nodeAnnotation.Value);

                // If this is the first iteration, use the value for this node to start matching.
                if (isFirstSelNode)
                {
                    foreach (KeyValuePair<string, string> annotation in dictNodeAnnotations)
                    {
                        dictMatchingAnnotations.Add(annotation.Key, annotation.Value);
                    }
                    text = nodeAnnotations.Note;
                    colorIndex = nodeAnnotations.ColorIndex;
                    isFirstSelNode = false;
                }
                foreach (string key in dictMatchingAnnotations.Keys.ToArray())
                {
                    string value;
                    // If the list of annotations we are building for the dialog contains this key,
                    // check that the values are the same, otherwise the value for this annotation needs
                    // to be null for the dialog.
                    if (!dictNodeAnnotations.TryGetValue(key, out value) || !Equals(dictMatchingAnnotations[key], value))
                        dictMatchingAnnotations.Remove(key);
                }

                matchingText = matchingText && nodeAnnotations.Note != null && Equals(text, nodeAnnotations.Note);
                matchingColors = matchingColors
                    && !nodeAnnotations.IsEmpty
                    && nodeAnnotations.ColorIndex != -1
                    && Equals(colorIndex, nodeAnnotations.ColorIndex);

                allEmpty = allEmpty && nodeAnnotations.IsEmpty;

                // Update annotation target to include this type of node.
                annotationTarget = annotationTarget.Union(nodeDoc.AnnotationTarget);
            }
            if (!matchingText)
                text = string.Empty;
            if (allEmpty)
                colorIndex = Settings.Default.AnnotationColor;
            else if (!matchingColors)
                colorIndex = -1;
            return new Annotations(text, dictMatchingAnnotations, colorIndex);
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:70,代码来源:EditNoteDlg.cs

示例8: ChangePeak

            public SrmDocument ChangePeak(SrmDocument doc, SrmTreeNode nodePepTree, TransitionGroupDocNode nodeTranGroup, string nameSet, MsDataFileUri filePath)
            {
                if ((_retentionTime ?? StartTime) == null)
                    return doc;

                var groupPath = new IdentityPath(nodePepTree.Path, nodeTranGroup.Id);

                doc = _retentionTime.HasValue
                    ? doc.ChangePeak(groupPath, nameSet, filePath, null, _retentionTime.Value, UserSet.TRUE)
                    : doc.ChangePeak(groupPath, nameSet, filePath, null, StartTime, EndTime, UserSet.TRUE, null, false);

                var activeTransitionGroup = (TransitionGroupDocNode) doc.FindNode(groupPath);
                if (activeTransitionGroup.RelativeRT != RelativeRT.Matching)
                    return doc;

                var activeChromInfo = SkylineWindow.FindChromInfo(doc, activeTransitionGroup, nameSet, filePath);
                var peptide = (PeptideDocNode) doc.FindNode(groupPath.Parent);
                // See if there are any other transition groups that should have their peak bounds set to the same value
                foreach (var tranGroup in peptide.TransitionGroups.Where(tranGroup => tranGroup.RelativeRT == RelativeRT.Matching))
                {
                    var otherGroupPath = new IdentityPath(groupPath.Parent, tranGroup.TransitionGroup);
                    if (Equals(groupPath, otherGroupPath) || SkylineWindow.FindChromInfo(doc, tranGroup, nameSet, filePath) == null)
                        continue;

                    doc = doc.ChangePeak(otherGroupPath, nameSet, filePath, null,
                        activeChromInfo.StartRetentionTime, activeChromInfo.EndRetentionTime, UserSet.TRUE, activeChromInfo.Identified, false);
                }
                return doc;
            }
开发者ID:lgatto,项目名称:proteowizard,代码行数:29,代码来源:PeakMatcher.cs


注:本文中的SrmDocument.FindNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。