Пример #1
0
        public static TransitionGroupTreeNode CreateInstance(SequenceTree tree, DocNode nodeDoc)
        {
            Debug.Assert(nodeDoc is TransitionGroupDocNode);
            var nodeTree = new TransitionGroupTreeNode(tree, (TransitionGroupDocNode)nodeDoc);

            if (tree.ExpandPrecursors)
            {
                nodeTree.Expand();
            }

            return(nodeTree);
        }
Пример #2
0
        public static Size RenderTip(PeptideDocNode nodePep,
                                     TransitionDocNode nodeTranSelected,
                                     SrmSettings settings,
                                     Graphics g,
                                     Size sizeMax,
                                     bool draw)
        {
            var table = new TableDesc();

            using (RenderTools rt = new RenderTools())
            {
                Peptide peptide = nodePep.Peptide;
                SizeF   size;
                if (peptide.IsCustomMolecule)
                {
                    table.AddDetailRow(Resources.TransitionGroupTreeNode_RenderTip_Molecule, nodePep.CustomMolecule.Name, rt);
                    table.AddDetailRow(Resources.TransitionTreeNode_RenderTip_Formula, nodePep.CustomMolecule.Formula, rt);
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_Neutral_Mass,
                                       nodePep.CustomMolecule.GetMass(settings.TransitionSettings.Prediction.PrecursorMassType).ToString(LocalizationHelper.CurrentCulture), rt);
                    foreach (var id in nodePep.CustomMolecule.AccessionNumbers.AccessionNumbers)
                    {
                        table.AddDetailRow(id.Key, id.Value, rt); // Show InChiKey etc as available
                    }
                    size = table.CalcDimensions(g);
                    table.Draw(g);
                    return(new Size((int)Math.Round(size.Width + 2), (int)Math.Round(size.Height + 2)));
                }
                if (peptide.IsDecoy)
                {
                    string sourceText = nodePep.SourceTextId
                                        .Replace(@".0]", @"]")
                                        .Replace(@".", LocalizationHelper.CurrentCulture.NumberFormat.NumberDecimalSeparator);
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_Source, sourceText, rt);
                }

                if (nodePep.Children.Count > 1)
                {
                    foreach (var typedModSequence in GetTypedModifiedSequences(nodePep, settings))
                    {
                        table.AddDetailRow(typedModSequence.Key.Title, typedModSequence.Value, rt);
                    }
                }

                if (peptide.Begin.HasValue)
                {
                    // Add a spacing row, if anything was added
                    if (table.Count > 0)
                    {
                        table.AddDetailRow(@" ", @" ", rt);
                    }
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_Previous, peptide.PrevAA.ToString(CultureInfo.InvariantCulture), rt);
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_First, peptide.Begin.Value.ToString(LocalizationHelper.CurrentCulture), rt);
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_Last, ((peptide.End ?? 1) - 1).ToString(LocalizationHelper.CurrentCulture), rt);
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_Next, peptide.NextAA.ToString(CultureInfo.InvariantCulture), rt);
                }
                if (nodePep.Rank.HasValue)
                {
                    table.AddDetailRow(Resources.PeptideTreeNode_RenderTip_Rank, nodePep.Rank.Value.ToString(LocalizationHelper.CurrentCulture), rt);
                }

                size = table.CalcDimensions(g);
                if (draw)
                {
                    table.Draw(g);
                }

                // Render group tip, if there is only one, and this node is collapsed
                if (nodePep.Children.Count == 1)
                {
                    var nodeGroup = (TransitionGroupDocNode)nodePep.Children[0];
                    if (size.Height > 0)
                    {
                        size.Height += TableDesc.TABLE_SPACING;
                    }
                    if (draw)
                    {
                        g.TranslateTransform(0, size.Height);
                    }
                    Size  sizeMaxGroup = new Size(sizeMax.Width, sizeMax.Height - (int)size.Height);
                    SizeF sizeGroup    = TransitionGroupTreeNode.RenderTip(nodePep, nodeGroup,
                                                                           nodeTranSelected, settings, g, sizeMaxGroup, draw);
                    if (draw)
                    {
                        g.TranslateTransform(0, -size.Height);
                    }

                    size.Width   = Math.Max(size.Width, sizeGroup.Width);
                    size.Height += sizeGroup.Height;
                }

                return(new Size((int)Math.Round(size.Width + 2), (int)Math.Round(size.Height + 2)));
            }
        }
Пример #3
0
 public Size RenderTip(Graphics g, Size sizeMax, bool draw)
 {
     return(TransitionGroupTreeNode.RenderTip(_nodePep, _nodeGroup, null,
                                              _settings, g, sizeMax, draw));
 }
Пример #4
0
 public override Image GetPickPeakImage(DocNode child)
 {
     return(TransitionGroupTreeNode.GetPeakImage((TransitionGroupDocNode)child, DocNode, SequenceTree));
 }
Пример #5
0
 public override string GetPickLabel(DocNode child)
 {
     return(TransitionGroupTreeNode.DisplayText((TransitionGroupDocNode)child,
                                                SequenceTree.GetDisplaySettings((PeptideDocNode)Model)));
 }
        public static TransitionGroupTreeNode CreateInstance(SequenceTree tree, DocNode nodeDoc)
        {
            Debug.Assert(nodeDoc is TransitionGroupDocNode);
            var nodeTree = new TransitionGroupTreeNode(tree, (TransitionGroupDocNode) nodeDoc);

            if (tree.ExpandPrecursors)
                nodeTree.Expand();

            return nodeTree;
        }