Example #1
0
            public UniquePeptideSettings(UniquePeptidesDlg dlg)
            {
                ProteinPeptideSelections = new Dictionary <int, ProteinPeptideSelection>();
                for (var i = 0; i < dlg.dataGridView1.Rows.Count; ++i)
                {
                    var row    = dlg.dataGridView1.Rows[i];
                    var rowTag = (Tuple <IdentityPath, PeptideDocNode>)row.Tag;
                    if (!(bool)row.Cells[dlg.PeptideIncludedColumn.Name].Value)
                    {
                        var id = rowTag.Item1.GetIdentity(0);
                        if (!ProteinPeptideSelections.ContainsKey(id.GlobalIndex))
                        {
                            var node = (PeptideGroupDocNode)dlg.SrmDocument.FindNode(id);
                            ProteinPeptideSelections.Add(id.GlobalIndex, new ProteinPeptideSelection(node.ProteinMetadata.Name, new List <string>()));
                        }

                        var item = ProteinPeptideSelections[id.GlobalIndex];
                        item.Peptides.Add(PeptideTreeNode.GetLabel(rowTag.Item2, string.Empty));
                        ++_excludedCount;
                    }
                }
            }
Example #2
0
        public ToolStripMenuItem MakeExcludeStandardMenuItem(int replicateIndex)
        {
            var document = DocumentUiContainer.DocumentUI;

            if (!document.Settings.HasResults)
            {
                return(null);
            }
            ChromatogramSet chromatogramSet = null;

            if (replicateIndex >= 0 &&
                replicateIndex < document.Settings.MeasuredResults.Chromatograms.Count)
            {
                chromatogramSet = document.Settings.MeasuredResults.Chromatograms[replicateIndex];
            }
            if (chromatogramSet == null)
            {
                return(null);
            }
            if (!chromatogramSet.SampleType.AllowExclude)
            {
                return(null);
            }
            PeptideDocNode      peptideDocNode;
            PeptideGroupDocNode peptideGroupDocNode;

            if (!TryGetSelectedPeptide(out peptideGroupDocNode, out peptideDocNode))
            {
                return(null);
            }
            bool isExcluded   = peptideDocNode.IsExcludeFromCalibration(replicateIndex);
            var  menuItemText = isExcluded ? QuantificationStrings.CalibrationForm_MakeExcludeStandardMenuItem_Include_Standard
                : QuantificationStrings.CalibrationForm_MakeExcludeStandardMenuItem_Exclude_Standard;
            var peptideIdPath = new IdentityPath(peptideGroupDocNode.Id, peptideDocNode.Id);
            var menuItem      = new ToolStripMenuItem(menuItemText, null, (sender, args) =>
            {
                _skylineWindow.ModifyDocument(menuItemText,
                                              doc => SetExcludeStandard(doc, peptideIdPath, replicateIndex, !isExcluded), docPair =>
                {
                    var msgType = isExcluded
                            ? MessageType.set_included_standard
                            : MessageType.set_excluded_standard;
                    return(AuditLogEntry.CreateSingleMessageEntry(new MessageInfo(msgType, docPair.NewDocumentType, PeptideTreeNode.GetLabel(peptideDocNode, string.Empty), chromatogramSet.Name)));
                });
            });

            return(menuItem);
        }