예제 #1
0
        /// <summary>
        /// Use the DocumentGrid to set the PrecursorConcentration values on all of the precursors in the document.
        /// </summary>
        private void SetPrecursorConcentrations(DocumentGridForm documentGrid)
        {
            RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Precursors));
            WaitForConditionUI(() => documentGrid.IsComplete);
            var viewEditor = ShowDialog <ViewEditor>(documentGrid.DataboundGridControl.NavBar.CustomizeView);

            RunUI(() =>
            {
                viewEditor.ActiveAvailableFieldsTree.SelectColumn(PropertyPath.Root.Property("Proteins")
                                                                  .LookupAllItems().Property("Peptides").LookupAllItems().Property("Precursors").LookupAllItems()
                                                                  .Property("PrecursorConcentration"));
                viewEditor.ChooseColumnsTab.AddColumn(
                    PropertyPath.Parse("Proteins!*.Peptides!*.Precursors!*.PrecursorConcentration"));
                viewEditor.ViewName = "PrecursorConcentrations";
            });
            OkDialog(viewEditor, viewEditor.OkDialog);
            WaitForConditionUI(() => documentGrid.IsComplete);
            var colPrecursorConcentration =
                documentGrid.DataboundGridControl.FindColumn(PropertyPath.Root.Property("PrecursorConcentration"));

            Assert.IsNotNull(colPrecursorConcentration);
            // These are the concentrations of the light, heavy4, heavy3, heavy2, heavy1
            double[] concentrations = { 0.125, 200, 20, 2, .5 };
            // Set the clipboard text to the list of concentrations repeated twice since there are two peptides
            ClipboardEx.SetText(string.Join(Environment.NewLine, concentrations.Concat(concentrations)));
            RunUI(() =>
            {
                documentGrid.DataGridView.CurrentCell =
                    documentGrid.DataGridView.Rows[0].Cells[colPrecursorConcentration.Index];
                documentGrid.DataGridView.SendPaste();
            });
        }
예제 #2
0
        private void gridStatistics_KeyDown(object sender, KeyEventArgs e)
        {
            // Handle Ctrl + C for copy
            if (e.KeyCode == Keys.V && e.Control)
            {
                StringBuilder sb = new StringBuilder();
                foreach (DataGridViewRow row in gridStatistics.Rows)
                {
                    if (row.IsNewRow)
                    {
                        continue;
                    }

                    foreach (DataGridViewCell cell in row.Cells)
                    {
                        if (sb[sb.Length - 1] != '\n') // Not L10N
                        {
                            sb.Append('\t');           // Not L10N
                        }
                        sb.Append(cell.Value);
                    }
                    sb.Append('\n'); // Not L10N
                }
                try
                {
                    ClipboardEx.Clear();
                    ClipboardEx.SetText(sb.ToString());
                }
                catch (ExternalException)
                {
                    MessageDlg.Show(this, ClipboardHelper.GetOpenClipboardMessage(Resources.RTDetails_gridStatistics_KeyDown_Failed_setting_data_to_clipboard));
                }
            }
        }
예제 #3
0
        /// <summary>
        /// 右クリックメニュー「読み筋を表示のままの文字列でクリップボードに貼り付ける(&P)」
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PastePvToClipboard_Click(object sender, EventArgs e)
        {
            if (pvTextOnClick == null)
            {
                return;
            }

            ClipboardEx.SetText(pvTextOnClick);

            ResetContextMenu();
        }
 private void HandleTextBoxCommandPreviewExecuted(object sender, ExecutedRoutedEventArgs e)
 {
     if (e.Command == ApplicationCommands.Cut)
     {
         var textBox = (TextBox)sender;
         if (textBox.SelectionLength == textBox.Text.Length)
         {
             ClipboardEx.SetText(textBox.Text);
             SetNullText(textBox);
             e.Handled = true;
         }
     }
 }
예제 #5
0
        /// <summary>
        /// [UI Thread] : クリップボードに文字列を設定する。
        ///
        /// 注意 : Clipboard.SetText() を実行するスレッドは Single Thread Apartment モードに設定されていなければならない
        /// UI Threadからこのメソッドを呼び出すこと。
        /// </summary>
        /// <param name="o"></param>
        public static void SetText(string s)
        {
            try
            {
                if (s.Empty())
                {
                    return;
                }

                ClipboardEx.SetText(s);
            }
            catch (Exception) { }
        }
예제 #6
0
        /// <summary>
        /// 右クリックメニュー「読み筋をKIF形式でクリップボードに貼り付ける(&K)」
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void PasteKifToClipboard_Click(object sender, EventArgs e)
        {
            // KIF形式で保存する

            var kifu = KifuManager.ToStringFromRootSfenAndMoves(KifuFileType.KIF,
                                                                boardDataOnRightClick.rootSfen, boardDataOnRightClick.moves);

            if (kifu == null)
            {
                return;
            }

            ClipboardEx.SetText(kifu);

            ResetContextMenu();
        }
예제 #7
0
        public CopyColorForm(Color color, Point invocationOrigin, int indexUnderMouse = 1)
        {
            InitializeComponent();
            SuspendLayout();

            colorBox.Color = color;

            StartPosition = FormStartPosition.Manual;

            var lastLabelPosition = new Point(12, 42);

            for (int i = 0; i < _formats.Count; ++i)
            {
                var format         = _formats[i];
                var formattedColor = format(color);
                var l = new CopyCodeLinkLabel()
                {
                    Text     = formattedColor,
                    Location = new Point(
                        lastLabelPosition.X,
                        lastLabelPosition.Y + 18 + 3
                        ),
                    Padding  = new Padding(0, 0, 0, 10),
                    AutoSize = true,
                };

                l.Click += (s, e) =>
                {
                    ClipboardEx.SetText(formattedColor);
                    Close();
                };

                Controls.Add(l);

                if (i == indexUnderMouse)
                {
                    Location = new Point(
                        invocationOrigin.X - (l.Location.X + 20),
                        invocationOrigin.Y - (l.Location.Y + 20)
                        );
                }

                lastLabelPosition = l.Location;
            }

            ResumeLayout(true);
        }
        /// <summary>
        /// Copy the data from the curves in the ZedGraphControl to the clipboard.
        /// </summary>
        public static void CopyGraphData(ZedGraphControl zedGraphControl)
        {
            var graphData = GraphData.GetGraphData(zedGraphControl.MasterPane);

            if (graphData.Panes.Count == 0)
            {
                return;
            }
            try
            {
                ClipboardEx.Clear();
                ClipboardEx.SetText(graphData.ToString());
            }
            catch (ExternalException)
            {
                MessageBox.Show(ClipboardHelper.GetOpenClipboardMessage(Resources.CopyGraphDataToolStripMenuItem_CopyGraphData_Failed_setting_data_to_clipboard), Program.Name);
            }
        }
        /// <summary>
        /// Use the DocumentGrid to set the PrecursorConcentration values on all of the precursors in the document.
        /// </summary>
        private void SetPrecursorConcentrations(DocumentGridForm documentGrid)
        {
            RunUI(() => documentGrid.ChooseView(PRECURSOR_CONCENTRATIONS_VIEW));
            WaitForConditionUI(() => documentGrid.IsComplete);
            var colPrecursorConcentration = documentGrid.DataboundGridControl.FindColumn(
                PropertyPath.Root.Property(nameof(Precursor.PrecursorConcentration)));

            Assert.IsNotNull(colPrecursorConcentration);
            // These are the concentrations of the light, heavy4, heavy3, heavy2, heavy1
            double[] concentrations = { 0.125, 200, 20, 2, .5 };
            // Set the clipboard text to the list of concentrations repeated twice since there are two peptides
            ClipboardEx.SetText(string.Join(Environment.NewLine, concentrations.Concat(concentrations)));
            RunUI(() =>
            {
                documentGrid.DataGridView.CurrentCell =
                    documentGrid.DataGridView.Rows[0].Cells[colPrecursorConcentration.Index];
                documentGrid.DataGridView.SendPaste();
            });
        }
예제 #10
0
        public void CopyMessage()
        {
            const string  separator = "---------------------------"; // Not L10N
            List <string> lines     = new List <String>();

            lines.Add(separator);
            lines.Add(Text);
            lines.Add(separator);
            lines.Add(Message);
            lines.Add(separator);
            lines.Add(TextUtil.SpaceSeparate(VisibleButtons.Select(btn => btn.Text)));
            if (null != DetailMessage)
            {
                lines.Add(separator);
                lines.Add(DetailMessage);
            }
            lines.Add(separator);
            lines.Add(string.Empty);
            ClipboardEx.SetText(TextUtil.LineSeparate(lines));
        }
예제 #11
0
        public static void InvokeUploadFinishedUI(UploadResult result, HSSettings settingsContext)
        {
            Debug.Assert(result != null);
            Debug.Assert(!string.IsNullOrWhiteSpace(result.Url));

            switch (settingsContext.ActionAfterUpload)
            {
            case UploadHandlingAction.Flyout:
                (new UploadResultForm(result, settingsContext)).Show();
                break;

            case UploadHandlingAction.CopyToClipboard:
            {
                var success = ClipboardEx.SetText(result.Url);
                if (settingsContext.ShowCopyConfirmation)
                {
                    if (success)
                    {
                        NotificationManager.ShowCopyConfirmation(result.Url);
                    }
                    else
                    {
                        NotificationManager.CopyingFailed(result.Url);
                    }
                }
            }
            break;

            case UploadHandlingAction.None:
                // Intentionally left empty
                break;

            default:
                // Intentionally left empty
                break;
            }
        }
예제 #12
0
 private void copyButton_Click(object sender, EventArgs e)
 {
     ClipboardEx.SetText(extraInfoTextBox.Text);
 }
예제 #13
0
 private void btnCopyLink_Click(object sender, EventArgs e)
 {
     ClipboardEx.SetText(LinkUrl);
 }
예제 #14
0
        protected override void DoTest()
        {
            RunUI(() => SetClipboardFileText(@"RenameProteinsTest\Fasta.txt")); // Not L10N

            RunUI(() => SkylineWindow.Paste());

            WaitForCondition(() => SkylineWindow.SequenceTree.Nodes.Count > 4);

            var docOrig = WaitForProteinMetadataBackgroundLoaderCompletedUI();

            Assert.AreNotEqual(FIRST_RENAMED_PROTEIN, docOrig.PeptideGroups.ToArray()[1].Name);
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[1];
                SkylineWindow.SequenceTree.BeginEdit(false);
                SkylineWindow.SequenceTree.StatementCompletionEditBox.TextBox.Text = FIRST_RENAMED_PROTEIN;
                SkylineWindow.SequenceTree.CommitEditBox(false);
            });
            var docEdited = WaitForDocumentChange(docOrig);

            Assert.AreEqual(FIRST_RENAMED_PROTEIN, docEdited.PeptideGroups.ToArray()[1].Name);
            RunUI(() =>
            {
                SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[SkylineWindow.SequenceTree.Nodes.Count - 1];
                SkylineWindow.SequenceTree.BeginEdit(false);
                SkylineWindow.SequenceTree.StatementCompletionEditBox.TextBox.Text = NON_FASTA_PROTEIN;
                SkylineWindow.SequenceTree.CommitEditBox(false);
            });


            // Choose valid proteins to rename
            {
                ClipboardEx.SetText(string.Format("YAL001C\n{0}\nYAL003W\t{1}\nYAL035W\n{2}\t{3}\n", FIRST_RENAMED_PROTEIN,
                                                  SECOND_RENAMED_PROTEIN, NON_FASTA_PROTEIN, NON_FASTA_PROTEIN_RENAMED));
                RunDlg <RenameProteinsDlg>(SkylineWindow.ShowRenameProteinsDlg,
                                           renameProteinsDlg =>
                {
                    renameProteinsDlg.Paste();
                    Assert.IsTrue(Equals(renameProteinsDlg.NameCount, 5));
                    renameProteinsDlg.OkDialog();
                });

                RunUI(() =>
                {
                    SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[2];
                    Assert.IsTrue(Equals(SkylineWindow.SequenceTree.SelectedNode.Text, SECOND_RENAMED_PROTEIN));
                    SkylineWindow.SequenceTree.SelectedNode =
                        SkylineWindow.SequenceTree.Nodes[SkylineWindow.SequenceTree.Nodes.Count - (TestSmallMolecules ? 3 : 2)];
                    Assert.IsTrue(Equals(SkylineWindow.SequenceTree.SelectedNode.Text, NON_FASTA_PROTEIN_RENAMED));
                });
            }

            // Choose invalid proteins to rename
            {
                ClipboardEx.SetText(string.Format("Random\tHello\n{0}\n{1}\nYAL035W\n", FIRST_RENAMED_PROTEIN, SECOND_RENAMED_PROTEIN));
                var renameProteinsDlg = ShowDialog <RenameProteinsDlg>(SkylineWindow.ShowRenameProteinsDlg);
                RunUI(renameProteinsDlg.Paste);
                RunDlg <MessageDlg>(renameProteinsDlg.OkDialog,
                                    messageDlg =>
                {
                    AssertEx.AreComparableStrings(Resources.RenameProteinsDlg_OkDialog__0__is_not_a_current_protein, messageDlg.Message, 1);
                    messageDlg.OkDialog();
                });
                RunUI(renameProteinsDlg.Clear);

                // Try to rename a protein twice
                ClipboardEx.SetText(string.Format("YAL001C\tTest2\n{0}\n{1}\nYAL001C\tTest3\n", FIRST_RENAMED_PROTEIN, SECOND_RENAMED_PROTEIN));
                RunUI(renameProteinsDlg.Paste);
                RunDlg <MessageDlg>(renameProteinsDlg.OkDialog,
                                    messageDlg =>
                {
                    AssertEx.AreComparableStrings(
                        Resources.
                        RenameProteinsDlg_OkDialog_Cannot_rename__0__more_than_once__Please_remove_either__1__or__2__,
                        messageDlg.Message, 3);
                    messageDlg.OkDialog();
                });

                // Populate grid test
                RunUI(() =>
                {
                    renameProteinsDlg.PopulateGrid();
                    Assert.IsTrue(Equals(renameProteinsDlg.NameCount, SkylineWindow.Document.MoleculeGroupCount));
                    renameProteinsDlg.CancelButton.PerformClick();
                });

                WaitForClosedForm(renameProteinsDlg);
            }

            // Use FASTA File
            {
                Assert.AreNotSame(docOrig, SkylineWindow.Document);
                RunUI(() =>
                {
                    SkylineWindow.Undo();           // Rename
                    SkylineWindow.Undo();           // Add nonFASTA protein
                    SkylineWindow.Undo();           // Direct edit
                });
                WaitForCondition(() => !Equals(SkylineWindow.Document.PeptideGroups.ToArray()[1].Name, FIRST_RENAMED_PROTEIN));
                WaitForProteinMetadataBackgroundLoaderCompletedUI();
                Assert.AreSame(docOrig, SkylineWindow.Document);
                Assert.AreNotEqual(FIRST_RENAMED_PROTEIN, docOrig.PeptideGroups.ToArray()[1].Name);
                WaitForCondition(() => !Equals(SkylineWindow.SequenceTree.Nodes[2].Text, SECOND_RENAMED_PROTEIN));
                WaitForProteinMetadataBackgroundLoaderCompletedUI();
                RunUI(() =>
                {
                    SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[2];
                    Assert.IsTrue(!Equals(SkylineWindow.SequenceTree.SelectedNode.Text, SECOND_RENAMED_PROTEIN));
                });


                // Use FASTA file where only two names differ
                RunDlg <RenameProteinsDlg>(SkylineWindow.ShowRenameProteinsDlg,
                                           renameProteinsDlg =>
                {
                    renameProteinsDlg.UseFastaFile(TestFilesDir.GetTestPath(@"RenameProteinsTest\FastaPartialRenamed.txt"));
                    Assert.IsTrue(Equals(renameProteinsDlg.NameCount, 2));
                    renameProteinsDlg.CancelButton.PerformClick();
                });

                // Use FASTA file where all names differ
                RunDlg <RenameProteinsDlg>(SkylineWindow.ShowRenameProteinsDlg,
                                           renameProteinsDlg =>
                {
                    renameProteinsDlg.UseFastaFile(TestFilesDir.GetTestPath(@"RenameProteinsTest\FastaRenamed.txt"));
                    Assert.IsTrue(Equals(renameProteinsDlg.NameCount, SkylineWindow.Document.PeptideGroupCount));
                    renameProteinsDlg.OkDialog();
                });
                var docFastaRename = WaitForDocumentChange(docOrig);
                var peptideGroups  = docFastaRename.PeptideGroups.ToArray();
                for (int i = 0; i < peptideGroups.Length; i++)
                {
                    Assert.AreEqual(string.Format("Test{0}", i + 1), peptideGroups[i].Name);
                }
            }

            // Reopen file
            {
                RunUI(() =>
                {
                    SkylineWindow.SaveDocument(TestContext.GetTestPath("test.sky"));
                    SkylineWindow.NewDocument();
                    SkylineWindow.OpenFile(TestContext.GetTestPath("test.sky"));
                });
                var docFastaRename = WaitForDocumentChange(docOrig);
                var peptideGroups  = docFastaRename.PeptideGroups.ToArray();
                for (int i = 0; i < peptideGroups.Length; i++)
                {
                    Assert.AreEqual(string.Format("Test{0}", i + 1), peptideGroups[i].Name);
                }
            }

            // Name repetition
            {
                RunUI(() =>
                {
                    SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[0];
                    SkylineWindow.SequenceTree.BeginEdit(false);
                    SkylineWindow.SequenceTree.StatementCompletionEditBox.TextBox.Text = FIRST_RENAMED_PROTEIN;
                    SkylineWindow.SequenceTree.CommitEditBox(false);
                    SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SequenceTree.Nodes[1];
                    SkylineWindow.SequenceTree.BeginEdit(false);
                    SkylineWindow.SequenceTree.StatementCompletionEditBox.TextBox.Text = FIRST_RENAMED_PROTEIN;
                    SkylineWindow.SequenceTree.CommitEditBox(false);
                });
                var renameProteinsDlg = ShowDialog <RenameProteinsDlg>(SkylineWindow.ShowRenameProteinsDlg);
                RunDlg <MessageDlg>(() => renameProteinsDlg.UseFastaFile(TestFilesDir.GetTestPath(@"RenameProteinsTest\Fasta.txt")),
                                    messageDlg =>
                {
                    AssertEx.AreComparableStrings(Resources.RenameProteinsDlg_UseFastaFile_The_document_contains_a_naming_conflict_The_name__0__is_currently_used_by_multiple_protein_sequences, messageDlg.Message, 1);
                    messageDlg.OkDialog();
                });
                RunUI(() => renameProteinsDlg.CancelButton.PerformClick());
                WaitForClosedForm(renameProteinsDlg);
            }
        }
예제 #15
0
        static async Task InvokeAfterCaptureAction(ScreenRecording recording, HSSettings settingsContext)
        {
            switch (settingsContext.ActionAfterVideoCapture)
            {
            case VideoCaptureHandlingAction.Upload:
                try
                {
                    var payload = new VideoUploadPayload(recording);

                    var result = await UploadDispatcher.InitiateUploadToDefaultUploader(payload, settingsContext, HolzShotsApplication.Instance.Uploaders, null).ConfigureAwait(true);

                    UploadHelper.InvokeUploadFinishedUI(result, settingsContext);
                }
                catch (UploadCanceledException)
                {
                    NotificationManager.ShowOperationCanceled();
                }
                catch (UploadException ex)
                {
                    await NotificationManager.UploadFailed(ex);
                }
                return;

            case VideoCaptureHandlingAction.CopyFile:
            {
                var success = ClipboardEx.SetFiles(recording.FilePath);
                if (settingsContext.ShowCopyConfirmation)
                {
                    if (success)
                    {
                        NotificationManager.ShowFileCopyConfirmation();
                    }
                    else
                    {
                        NotificationManager.CopyingFileFailed();
                    }
                }
            }
            break;

            case VideoCaptureHandlingAction.CopyFilePath:
            {
                var success = ClipboardEx.SetText(recording.FilePath);
                if (settingsContext.ShowCopyConfirmation)
                {
                    if (success)
                    {
                        NotificationManager.ShowFilePathCopyConfirmation();
                    }
                    else
                    {
                        NotificationManager.CopyingFilePathFailed();
                    }
                }
            }
            break;

            case VideoCaptureHandlingAction.ShowInExplorer:
                IO.HolzShotsPaths.OpenSelectedFileInExplorer(recording.FilePath);
                return;

            case VideoCaptureHandlingAction.OpenInDefaultApp:
                Process.Start(recording.FilePath);
                return;

            case VideoCaptureHandlingAction.None: return;

            default: throw new ArgumentException("Unhandled VideoCaptureHandlingAction: " + settingsContext.ActionAfterVideoCapture);
            }
        }
예제 #16
0
        /// <summary>
        /// Use the document grid to change the StandardType and NormalizationMethod values for
        /// several peptides in the document.
        /// </summary>
        private void SetNormalizationMethodsInDocumentGrid()
        {
            RunUI(() => SkylineWindow.ShowDocumentGrid(true));
            var documentGrid = FormUtil.OpenForms.OfType <DocumentGridForm>()
                               .FirstOrDefault(form => form.ShowViewsMenu);

            Assert.IsNotNull(documentGrid);
            RunUI(() => documentGrid.ChooseView("NormalizationMethods"));
            WaitForConditionUI(() => documentGrid.IsComplete);
            var colModifiedSequence =
                documentGrid.FindColumn(PropertyPath.Root.Property("ModifiedSequence").Property("MonoisotopicMasses"));

            Assert.IsNotNull(colModifiedSequence);
            string[] modifiedSequences = null;
            RunUI(() =>
            {
                modifiedSequences = documentGrid.DataGridView.Rows.OfType <DataGridViewRow>()
                                    .Select(row => row.Cells[colModifiedSequence.Index].Value.ToString()).ToArray();
            });
            string[] expectedPeptides =
            {
                "GNPTVEVELTTEK",
                "SIVPSGASTGVHEALEMR",
                "NVNDVIAPAFVK",
                "AVDDFLISLDGTANK",
                "LGANAILGVSLAASR",
                "TSPYVLPVPFLNVLNGGSHAGGALALQEFMIAPTGAK",
                "IGSEVYHNLK",
                "YGASAGNVGDEGGVAPNIQTAEEALDLIVDAIK",
                "IGLDC[+57.021464]ASSEFFK",
                "WLTGPQLADLYHSLMK",
                "YPIVSIEDPFAEDDWEAWSHFFK",
                "TAGIQIVADDLTVTNPK",
                "VNQIGTLSESIK",
                "SGETEDTFIADLVVGLR",
                "IEEELGDNAVFAGENFHHGDK",
            };
            CollectionAssert.AreEqual(expectedPeptides, modifiedSequences);
            StandardType[] newStandardTypes =
            {
                null,
                null,
                StandardType.GLOBAL_STANDARD,    // NVNDVIAPAFVK
                StandardType.SURROGATE_STANDARD, // AVDDFLISLDGTANK
                null,
                null,
                null,
                null,
                StandardType.SURROGATE_STANDARD, // IGLDC[+57.021464]ASSEFFK
                null,
                null,
                StandardType.GLOBAL_STANDARD, // TAGIQIVADDLTVTNPK
                null,
                null,
                null
            };
            Assert.AreEqual(expectedPeptides.Length, newStandardTypes.Length);
            var colStandardType = documentGrid.FindColumn(PropertyPath.Root.Property("StandardType"));

            Assert.IsNotNull(colStandardType);
            RunUI(() =>
            {
                documentGrid.DataGridView.CurrentCell =
                    documentGrid.DataGridView.Rows[0].Cells[colStandardType.Index];
                string strStandardTypes = string.Join(Environment.NewLine, newStandardTypes.Cast <object>()
                                                      .Select(standardType => (standardType ?? string.Empty).ToString()));
                ClipboardEx.SetText(strStandardTypes);
                documentGrid.DataGridView.SendPaste();
            });
            VerifyCalculatedAreas();

            WaitForConditionUI(() => documentGrid.IsComplete);
            NormalizationMethod[] normalizationMethods =
            {
                new NormalizationMethod.RatioToSurrogate("IGLDC[+57.021464]ASSEFFK"),
                NormalizationMethod.GLOBAL_STANDARDS,
                null,
                null,
                new NormalizationMethod.RatioToSurrogate("AVDDFLISLDGTANK")
            };
            var colNormalizationMethod = documentGrid.FindColumn(PropertyPath.Root.Property("NormalizationMethod"));

            Assert.IsNotNull(colNormalizationMethod);
            RunUI(() =>
            {
                documentGrid.DataGridView.CurrentCell =
                    documentGrid.DataGridView.Rows[0].Cells[colNormalizationMethod.Index];
                string strNormalizationMethods = string.Join(Environment.NewLine, normalizationMethods.Cast <object>()
                                                             .Select(normalizationMethod => (normalizationMethod ?? string.Empty).ToString()));
                ClipboardEx.SetText(strNormalizationMethods);
                documentGrid.DataGridView.SendPaste();
            });
            var actualNormalizationMethods = SkylineWindow.Document.Molecules.Select(mol => mol.NormalizationMethod)
                                             .ToArray();
            var expectedNormalizationMethods = normalizationMethods.Concat(Enumerable.Repeat((NormalizationMethod)null,
                                                                                             actualNormalizationMethods.Length - normalizationMethods.Length)).ToArray();

            CollectionAssert.AreEqual(expectedNormalizationMethods, actualNormalizationMethods);
            VerifyCalculatedAreas();
        }
예제 #17
0
        protected override void DoTest()
        {
            RunUI(() =>
            {
                SkylineWindow.ResetDefaultSettings();
                SkylineWindow.NewDocument();
            });
            ShowAndPositionAuditLog(false);
            PauseForScreenShot <AuditLogForm>("Empty Audit Log form.", 2);

            // Configuring Settings for Inserting a New Peptide, p. 3
            {
                var doc = SkylineWindow.Document;
                var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI);

                RunUI(() =>
                {
                    // Filter Settings
                    transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Filter;
                    transitionSettingsUI.RangeFrom   = Resources.TransitionFilter_FragmentStartFinders_ion_3;
                    transitionSettingsUI.RangeTo     = Resources.TransitionFilter_FragmentEndFinders_last_ion_minus_1;
                });
                OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog);
                WaitForDocumentChange(doc);
            }

            PeptideSettingsUI peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            RunUI(() => peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Modifications);

            var modHeavyK = new StaticMod("Label:13C(6)15N(2) (C-term K)", "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15,
                                          RelativeRT.Matching, null, null, null);

            AddHeavyMod(modHeavyK, peptideSettingsUi);
            RunUI(() => peptideSettingsUi.PickedHeavyMods = new[] { modHeavyK.Name });

            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

            PauseForScreenShot <AuditLogForm>("Audit Log form with settings modifications.", 4);

            RunUI(() =>
            {
                SkylineWindow.AuditLogForm.Close();
                SkylineWindow.Width = 1010;
            });

            PauseForScreenShot("Undo list expanded. (manual)", 4);

            RunUI(SkylineWindow.Undo);

            PauseForScreenShot("Redo list expanded. (manual)", 5);

            RunUI(SkylineWindow.Redo);

            // Inserting a peptide sequence p. 5
            using (new CheckDocumentState(1, 1, 2, 10))
            {
                WaitForProteinMetadataBackgroundLoaderCompletedUI();

                var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg);
                RunUI(() => SetClipboardText("IEAIPQIDK\tGST-tag"));
                RunUI(pasteDlg.PastePeptides);
                RunUI(() =>
                {
                    pasteDlg.Size = new Size(700, 210);
                    pasteDlg.Top  = SkylineWindow.Bottom + 20;
                });
                PauseForScreenShot <PasteDlg.PeptideListTab>("Insert Peptide List", 6);

                using (new WaitDocumentChange())
                {
                    OkDialog(pasteDlg, pasteDlg.OkDialog);
                }

                WaitForConditionUI(() => SkylineWindow.SequenceTree.Nodes.Count > 0);
            }

            RunUI(() =>
            {
                SkylineWindow.ExpandPrecursors();
                SkylineWindow.Height = 390;
            });

            PauseForScreenShot("Main window with Targets view", 6);

            ShowAndPositionAuditLog(true);
            PauseForScreenShot <AuditLogForm>("Audit Log form with inserted peptide.", 7);

            ShowLastExtraInfo("Extra info form with inserted peptide info.", 7);

            string documentPath = GetTestPath("AuditLogTutorial" + SrmDocument.EXT);

            RunUI(() => SkylineWindow.SaveDocument(documentPath));
            WaitForCondition(() => File.Exists(documentPath));

            // Importing RAW files into Skyline p. 7
            var importResultsDlg = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);

            RunUI(() =>
            {
                var rawFiles      = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value;
                var namedPathSets = from rawFile in rawFiles
                                    select new KeyValuePair <string, MsDataFileUri[]>(
                    rawFile.GetFileNameWithoutExtension(), new[] { rawFile });
                importResultsDlg.NamedPathSets = namedPathSets.ToArray();
            });
            OkDialog(importResultsDlg, importResultsDlg.OkDialog);

            WaitForGraphs();

            RunUI(() =>
            {
                SkylineWindow.SelectedPath             = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0);
                Settings.Default.ArrangeGraphsOrder    = GroupGraphsOrder.Document.ToString();
                Settings.Default.ArrangeGraphsReversed = false;
                SkylineWindow.ArrangeGraphsTabbed();
                SkylineWindow.AutoZoomBestPeak();
            });
            WaitForCondition(() => Equals(9, SkylineWindow.GraphChromatograms.Count(graphChrom => !graphChrom.IsHidden)),
                             "unexpected visible graphChromatogram count");

            WaitForCondition(10 * 60 * 1000,    // ten minutes
                             () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);

            PauseForScreenShot <AuditLogForm>("Audit Log form with imported data files.", 9);

            ShowLastExtraInfo("Extra info form for the import.", 9);

            // Peptide Quantitification Settings p. 9
            peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            RunUI(() => peptideSettingsUi.SelectedTab = (PeptideSettingsUI.TABS) 5);
            const string quantUnits = "fmol/ul";

            RunUI(() =>
            {
                peptideSettingsUi.QuantRegressionFit       = RegressionFit.LINEAR;
                peptideSettingsUi.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy);
                peptideSettingsUi.QuantUnits = quantUnits;
            });
            OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog);

            PauseForScreenShot <AuditLogForm>("Audit Log form with quantification settings.", 10);

            // Specify analyte concentrations of external standards
            RunUI(() =>
            {
                SkylineWindow.AuditLogForm.Close();
                SkylineWindow.ShowDocumentGrid(true);
            });
            var documentGridForm = FindOpenForm <DocumentGridForm>();

            RunUI(() =>
            {
                documentGridForm.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates);
            });
            WaitForConditionUI(() => documentGridForm.IsComplete);

            var concentrations = new[] { 40, 12.5, 5, 2.5, 1, .5, .25, .1 };

            string pasteString = TextUtil.LineSeparate(concentrations.Select((f, i) =>
                                                                             QuantificationStrings.SampleType_STANDARD_Standard + "\t" + f));

            ClipboardEx.SetText(pasteString);

            using (new WaitDocumentChange())
            {
                RunUI(() =>
                {
                    var colSampleType = documentGridForm.FindColumn(PropertyPath.Root.Property("SampleType"));
                    documentGridForm.DataGridView.CurrentCell = documentGridForm.DataGridView.Rows[1].Cells[colSampleType.Index];
                    documentGridForm.DataGridView.SendPaste();
                });
            }

            // ReSharper restore AccessToModifiedClosure
            WaitForConditionUI(() => documentGridForm.IsComplete);
            RunUI(() =>
            {
                var gridFloatingWindow  = documentGridForm.Parent.Parent;
                gridFloatingWindow.Size = new Size(370, 315);
                gridFloatingWindow.Top  = SkylineWindow.Bottom + 20;
            });
            PauseForScreenShot <DocumentGridForm>("Document grid with concentrations filled in", 11);
            RunUI(documentGridForm.Close);

            ShowAndPositionAuditLog(true);
            PauseForScreenShot <AuditLogForm>("Audit Log form with grid changes", 12);

            ShowLastExtraInfo("Extra Info for the analyte data import.", 12);
            RunUI(SkylineWindow.AuditLogForm.Close);

            const string unknownReplicate = "FOXN1-GST";

            RestoreViewOnScreen(13);
            ActivateReplicate(unknownReplicate);
            SelectNode(SrmDocument.Level.TransitionGroups, 1);
            RunUI(() => SkylineWindow.Size = new Size(936, 527));
            WaitForGraphs();

            PauseForScreenShot("Heavy precursor chromatogram", 13);

            RunUI(() =>
            {
                var pathHeavy = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 1);

                var graphChrom = SkylineWindow.GetGraphChrom(unknownReplicate);
                Assert.IsNotNull(graphChrom);
                Assert.AreEqual(unknownReplicate, graphChrom.NameSet);

                var firstGroupInfo = graphChrom.ChromGroupInfos.FirstOrDefault();
                Assert.IsNotNull(firstGroupInfo, "Missing group info");
                var firstChromItem = graphChrom.GraphItems.FirstOrDefault(gci => gci.TransitionChromInfo != null);
                Assert.IsNotNull(firstChromItem, "Missing graph item");

                var listChanges = new List <ChangedPeakBoundsEventArgs>
                {
                    new ChangedPeakBoundsEventArgs(pathHeavy,
                                                   null,
                                                   graphChrom.NameSet,
                                                   firstGroupInfo.FilePath,
                                                   firstChromItem.GetValidPeakBoundaryTime(20.65),
                                                   firstChromItem.GetValidPeakBoundaryTime(21.15),
                                                   PeakIdentification.FALSE,
                                                   PeakBoundsChangeType.both)
                };
                graphChrom.SimulateChangedPeakBounds(listChanges);
            });

            ShowAndPositionAuditLog(true, 50, 200);
            WaitForConditionUI(500, () => SkylineWindow.AuditLogForm.DataGridView.Rows.Count > 0);

            PauseForScreenShot <AuditLogForm>("Audit Log form with changed integration boundary.", 14);
            int reasonIndex = 2;

            using (new WaitDocumentChange())
            {
                RunUI(() =>
                {
                    var pathReason = PropertyPath.Root.Property("Reason");
                    var colReason  = SkylineWindow.AuditLogForm.FindColumn(pathReason);
                    reasonIndex    = colReason.Index;
                    SetCellValue(SkylineWindow.AuditLogForm.DataGridView, 0, reasonIndex,
                                 "Changed peak integration as instructed by the tutorial");
                });
            }
            RunUI(() => SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex));
            SetGridFormToFullWidth(SkylineWindow.AuditLogForm);
            PauseForScreenShot <AuditLogForm>("Audit Log form with updated reason.", 14);

            // View the calibration curve p. 15
            RunUI(() => SkylineWindow.ShowCalibrationForm());
            var calibrationForm = FindOpenForm <CalibrationForm>();
            var priorZoomState  = ZoomCalibrationCurve(calibrationForm, 0.52);

            RunUI(() =>
            {
                Assert.AreEqual(CalibrationCurveFitter.AppendUnits(QuantificationStrings.Analyte_Concentration, quantUnits), calibrationForm.ZedGraphControl.GraphPane.XAxis.Title.Text);
                Assert.AreEqual(string.Format(QuantificationStrings.CalibrationCurveFitter_PeakAreaRatioText__0___1__Peak_Area_Ratio, IsotopeLabelType.light.Title, IsotopeLabelType.heavy.Title),
                                calibrationForm.ZedGraphControl.GraphPane.YAxis.Title.Text);

                VerifyCalibrationCurve(calibrationForm, 5.4065E-1, -2.9539E-1, 0.999);
            });

            PauseForScreenShot <CalibrationForm>("Calibration curve zoomed", 15);
            RunUI(() =>
            {
                priorZoomState?.ApplyState(calibrationForm.ZedGraphControl.GraphPane);

                var chromatograms = SkylineWindow.DocumentUI.Settings.MeasuredResults.Chromatograms;
                new [] { 5, 6, 7, 8 }.ForEach((index) =>
                {
                    int replicateIdx = chromatograms.IndexOf((ch) => ch.Name.Equals("Standard_" + index));
                    Assert.IsTrue(replicateIdx >= 0);
                    using (var excludeStandardMenu = calibrationForm.MakeExcludeStandardMenuItem(replicateIdx))
                    {
                        excludeStandardMenu?.PerformClick();
                    }
                });
            });
            WaitForGraphs();
            RunUI(() => VerifyCalibrationCurve(calibrationForm, 5.52E-1, -6.3678E-1, 1));
            OkDialog(calibrationForm, calibrationForm.Close);

            PauseForScreenShot <AuditLogForm>("Audit Log with excluded standard records", 16);

            PauseForScreenShot <AuditLogForm>("Audit Log Reports menu (manual)", 16);

            // TODO(nicksh): Audit log reason field does not currently support fill down
//            RunUI(() =>
//            {
//                SetCellValue(SkylineWindow.AuditLogForm.DataGridView, 0, reasonIndex, "Excluded standard below LOD");
//                for (int i = 0; i < 4; i++)
//                    SkylineWindow.AuditLogForm.DataGridView.Rows[i].Cells[reasonIndex].Selected = true;
//            });
//            RunUI(() => SkylineWindow.AuditLogForm.DataboundGridControl.FillDown());
            RunUI(() =>
            {
                for (int i = 0; i < 4; i++)
                {
                    SetCellValue(SkylineWindow.AuditLogForm.DataGridView, i, reasonIndex, "Excluded standard below LOD");
                }
            });
            RunUI(() =>
            {
                SkylineWindow.AuditLogForm.ChooseView(AuditLogStrings.AuditLogForm_MakeAuditLogForm_Undo_Redo);
            });
            SetGridFormToFullWidth(SkylineWindow.AuditLogForm);
            RunUI(() =>
            {
                var floatingWindow    = SkylineWindow.AuditLogForm.Parent.Parent;
                floatingWindow.Height = 334;
                floatingWindow.Width -= 15;
            });
            PauseForScreenShot <AuditLogForm>("Audit Log with UndoRedo view.", 17);
            if (IsCoverShotMode)
            {
                RunUI(() =>
                {
                    SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                });

                RestoreCoverViewOnScreen();

                var calibrationCoverForm = WaitForOpenForm <CalibrationForm>();
                ZoomCalibrationCurve(calibrationCoverForm, 0.53);
                var floatingLogWindow = SkylineWindow.AuditLogForm.Parent.Parent;
                var floatingCalWindow = calibrationCoverForm.Parent.Parent;
                RunUI(() =>
                {
                    floatingLogWindow.Top  = SkylineWindow.Bottom - floatingLogWindow.Height - 8;
                    floatingLogWindow.Left =
                        (SkylineWindow.Left + SkylineWindow.Right) / 2 - floatingLogWindow.Width / 2;
                    floatingCalWindow.Top  = SkylineWindow.Top + 8;
                    floatingCalWindow.Left = SkylineWindow.Right - floatingCalWindow.Width - 8;
                    SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex);
                    SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex - 1);
                });
                TakeCoverShot();
            }

            var customizeDialog = ShowDialog <ViewEditor>(SkylineWindow.AuditLogForm.NavBar.CustomizeView);

            RunUI(() =>
            {
                customizeDialog.ViewName = "Custom Columns";
                var columnsToAdd         = new[]
                {
                    PropertyPath.Parse("SkylineVersion"),
                    PropertyPath.Parse("User"),
                };
                foreach (var id in columnsToAdd)
                {
                    Assert.IsTrue(customizeDialog.ChooseColumnsTab.TrySelect(id), "Unable to select {0}", id);
                    customizeDialog.ChooseColumnsTab.AddSelectedColumn();
                }

                customizeDialog.Height = 370;
            });
            PauseForScreenShot <ViewEditor.ChooseColumnsView>("Custom Columns report template", 17);
            OkDialog(customizeDialog, customizeDialog.OkDialog);
            SetGridFormToFullWidth(SkylineWindow.AuditLogForm);
            RunUI(() => SkylineWindow.AuditLogForm.Parent.Parent.Height += 10); // Extra for 2-line headers
            PauseForScreenShot <AuditLogForm>("Audit Log with custom view.", 18);

            var registrationDialog = ShowDialog <MultiButtonMsgDlg>(() => SkylineWindow.ShowPublishDlg(null));

            PauseForScreenShot <MultiButtonMsgDlg>("Upload confirmation dialog.", 19);

            var loginDialog = ShowDialog <EditServerDlg>(registrationDialog.ClickNo);

            PauseForScreenShot <EditServerDlg>("Login dialog.", 20);

            RunUI(() =>
            {
                loginDialog.URL      = SERVER_URL;
                loginDialog.Username = PANORAMA_USER_NAME;
            });

            if (!IsPauseForScreenShots)
            {
                OkDialog(loginDialog, loginDialog.CancelButton.PerformClick);
            }
            else
            {
                PauseTest("Enter password. (manual) No screen shot.");

                var publishDialog = ShowDialog <PublishDocumentDlg>(loginDialog.OkDialog);
                WaitForCondition(() => publishDialog.IsLoaded);
                RunUI(() =>
                {
                    publishDialog.SelectItem(testFolderName);
                });
                PauseForScreenShot <PublishDocumentDlg>("Folder selection dialog.", 21);
                var browserConfirmationDialog = ShowDialog <MultiButtonMsgDlg>(publishDialog.OkDialog);

                OkDialog(browserConfirmationDialog, browserConfirmationDialog.ClickYes);

                PauseForScreenShot("Uploaded document in Panorama (in browser).");

                Regex reDocId = new Regex(@"\?id=([0-9]+)");
                Assert.IsTrue(reDocId.IsMatch(publishDialog.PanoramaPublishClient.UploadedDocumentUri.ToString()));

                string docId      = reDocId.Match(publishDialog.PanoramaPublishClient.UploadedDocumentUri.ToString()).Groups[1].Captures[0].Value;
                Uri    serverUri  = new Uri(SERVER_URL);
                Uri    requestUri = PanoramaUtil.Call(serverUri, "targetedms", String.Format("{0}/{1}", PANORAMA_FOLDER, testFolderName),
                                                      "showSkylineAuditLog", "id=" + docId);
                Process.Start(requestUri.ToString());
                PauseForScreenShot("Uploaded document audit log in Panorama (in browser).");
            }
        }
예제 #18
0
        protected override void DoTest()
        {
            // p. 1 open the file
            string documentFile = GetTestPath(@"QuaSAR_Tutorial.sky"); // Not L10N

            WaitForCondition(() => File.Exists(documentFile));
            RunUI(() => SkylineWindow.OpenFile(documentFile));

            var document = SkylineWindow.Document;

            AssertEx.IsDocumentState(document, null, 34, 125, 250, 750);

            var configureToolsDlg = ShowDialog <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg);

            RunUI(() =>
            {
                configureToolsDlg.RemoveAllTools();
                configureToolsDlg.SaveTools();
            });

            PauseForScreenShot("p. 2 - External Tools");

            const string installZipName = "QuaSAR-1_0.zip"; // Not L10N

            if (IsPauseForScreenShots)
            {
                var rInstaller = ShowDialog <RInstaller>(() =>
                {
                    configureToolsDlg.RemoveAllTools();
                    configureToolsDlg.SaveTools();
                    configureToolsDlg.InstallZipTool(GetTestPath(installZipName));
                });

                PauseForScreenShot("p. 3 - R Installer");

                // cancel as we don't actually want to install R / Packages
                OkDialog(rInstaller, rInstaller.CancelButton.PerformClick);
            }

            RunUI(() =>
            {
                // bypass the R installer dialogue
                configureToolsDlg.TestInstallProgram = (container, collection, script) => @"FakeDirectory\R.exe";     // Not L10N

                configureToolsDlg.InstallZipTool(GetTestPath(installZipName));
                var installedQuaSAR = configureToolsDlg.ToolList[0];
                Assert.AreEqual(QUASAR.Title, installedQuaSAR.Title);
                Assert.AreEqual(QUASAR.Command, installedQuaSAR.Command);
                Assert.AreEqual(QUASAR.Arguments, installedQuaSAR.Arguments);
                Assert.AreEqual(QUASAR.InitialDirectory, installedQuaSAR.InitialDirectory);
                Assert.AreEqual(QUASAR.ReportTitle, installedQuaSAR.ReportTitle);
                Assert.AreEqual(QUASAR.OutputToImmediateWindow, installedQuaSAR.OutputToImmediateWindow);
            });

            PauseForScreenShot("p. 4 - External Tools (QuaSAR Installed)");

            OkDialog(configureToolsDlg, configureToolsDlg.OkDialog);
            RunUI(() => SkylineWindow.PopulateToolsMenu());

            var annotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);

            RunUI(() =>
            {
                var checkedListBox = annotationsDlg.AnnotationsCheckedListBox;
                for (int i = 0; i < checkedListBox.Items.Count; i++)
                {
                    checkedListBox.SetItemChecked(i, true);
                }
            });

            PauseForScreenShot("p. 5 - Annotation Settings");

            OkDialog(annotationsDlg, annotationsDlg.OkDialog);

            RunUI(() =>
            {
                Assert.IsTrue(SkylineWindow.Document.Settings.DataSettings.AnnotationDefs.Contains(SAMPLEGROUP));
                Assert.IsTrue(SkylineWindow.Document.Settings.DataSettings.AnnotationDefs.Contains(IS_SPIKE));
                Assert.IsTrue(SkylineWindow.Document.Settings.DataSettings.AnnotationDefs.Contains(CONCENTRATION));
            });

            RunUI(() => SkylineWindow.ShowResultsGrid(true));
            RunUI(() =>
            {
                SkylineWindow.SelectedPath =
                    SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.MoleculeGroups, 0);
            });
            WaitForGraphs();
            DataGridViewColumn colSampleId = null, colConcentration = null, colIsConc = null;
            DataGridView       resultsGrid = FindOpenForm <LiveResultsGrid>().DataGridView;

            WaitForConditionUI(() => 0 != resultsGrid.ColumnCount);
            RunUI(() =>
            {
                colSampleId =
                    resultsGrid.Columns.Cast <DataGridViewColumn>()
                    .First(col => SAMPLEGROUP.Name == col.HeaderText);
                colConcentration =
                    resultsGrid.Columns.Cast <DataGridViewColumn>()
                    .First(col => CONCENTRATION.Name == col.HeaderText);
                colIsConc =
                    resultsGrid.Columns.Cast <DataGridViewColumn>().First(col => IS_SPIKE.Name == col.HeaderText);
            });
            WaitForCondition(() => resultsGrid != null && colSampleId != null && colConcentration != null && colIsConc != null);

            float[]  concentrations = { 0f, .001f, .004f, .018f, .075f, .316f, 1.33f, 5.62f, 23.71f, 100 };
            string[] sampleIds      = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }; // Not L10N

            RunUI(() =>
            {
                Assert.AreEqual(colSampleId.DisplayIndex + 1, colConcentration.DisplayIndex);
                Assert.AreEqual(colSampleId.DisplayIndex + 1, colConcentration.DisplayIndex);
                StringBuilder clipboardText = new StringBuilder();
                for (int i = 0; i < concentrations.Length; i++)
                {
                    for (int j = i * 4; j < (i + 1) * 4; j++)
                    {
                        if (clipboardText.Length > 0)
                        {
                            clipboardText.Append('\n');
                        }
                        clipboardText.Append(sampleIds[i]);
                        clipboardText.Append('\t');
                        clipboardText.Append(concentrations[i]);
                        clipboardText.Append('\t');
                        clipboardText.Append(10);
                    }
                }
                resultsGrid.CurrentCell = resultsGrid.Rows[0].Cells[colSampleId.Index];
                ClipboardEx.SetText(clipboardText.ToString());
                SendMessage(resultsGrid.Handle, WM_KEYDOWN, (IntPtr)Keys.Control, (IntPtr)0);
                SendMessage(resultsGrid.Handle, WM_KEYDOWN, (IntPtr)Keys.V, (IntPtr)0);
                SendMessage(resultsGrid.Handle, WM_KEYUP, (IntPtr)Keys.V, (IntPtr)0);
                SendMessage(resultsGrid.Handle, WM_KEYUP, (IntPtr)Keys.Control, (IntPtr)0);
            });
            WaitForGraphs();
            PauseForScreenShot("p. 7 - Results Grid");

            RunUI(() => SkylineWindow.ShowResultsGrid(false));

            if (IsPauseForScreenShots)
            {
                int formCount = Application.OpenForms.Count;
                RunUI(() => SkylineWindow.RunTool(0));
                WaitForCondition(() => Application.OpenForms.Count == formCount + 1);
                Form argsCollector = Application.OpenForms["QuaSARUI"]; // Not L10N
                Assert.IsNotNull(argsCollector);
                PauseForScreenShot("p. 8 - Args Collector");

                Action actCancel = () => argsCollector.CancelButton.PerformClick();
                argsCollector.BeginInvoke(actCancel);
                WaitForClosedForm(argsCollector);
            }
        }
예제 #19
0
 private void btnCopyText_Click(object sender, EventArgs e)
 {
     ClipboardEx.SetText(SelectedControl.GetErrorLog(cbMoreInfo.Checked));
 }
예제 #20
0
        private void DoStudy7Test()
        {
            // Preparing a Document to Accept the Study 7 Transition List, p. 18
            RunUI(() => SkylineWindow.NewDocument());
            var peptideSettingsUI1 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);

            if (IsCoverShotMode)
            {
                var modHeavyK = new StaticMod(HEAVY_K, "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, // Not L10N
                                              RelativeRT.Matching, null, null, null);
                AddHeavyMod(modHeavyK, peptideSettingsUI1, "Edit Isotope Modification form", 6);
            }
            var mod13Cr = new StaticMod("Label:13C(6) (C-term R)", "R", ModTerminus.C, false, null, LabelAtoms.C13,
                                        RelativeRT.Matching, null, null, null);

            AddHeavyMod(mod13Cr, peptideSettingsUI1, "Edit Isotope Modification form", 18);
            RunUI(() =>
            {
                peptideSettingsUI1.PickedHeavyMods            = new[] { "Label:13C(6) (C-term R)", HEAVY_K };
                peptideSettingsUI1.PickedLibraries            = new string[0];
                peptideSettingsUI1.SelectedBackgroundProteome = Resources.SettingsList_ELEMENT_NONE_None;
                peptideSettingsUI1.OkDialog();
            });

            // Pasting a Transition List into the Document, p. 19.
            string clipboardSaveText = string.Empty;

            RunUI(() =>
            {
                var filePath = GetTestPath(@"Study 7\Study7 transition list.xls");
                SetExcelFileClipboardText(filePath, "Simple", 6, false);
                clipboardSaveText = ClipboardEx.GetText();
            });
            // We expect this to fail due to instrument settings rather than format issues eg "The product m/z 1519.78 is out of range for the instrument settings, in the peptide sequence YEVQGEVFTKPQLWP. Check the Instrument tab in the Transition Settings."
            {
                var transitionSelectdgl = ShowDialog <ImportTransitionListColumnSelectDlg>(SkylineWindow.Paste);
                var messageDlg          = ShowDialog <ImportTransitionListErrorDlg>(transitionSelectdgl.AcceptButton.PerformClick);
                AssertEx.AreComparableStrings(TextUtil.SpaceSeparate(Resources.MassListRowReader_CalcTransitionExplanations_The_product_m_z__0__is_out_of_range_for_the_instrument_settings__in_the_peptide_sequence__1_,
                                                                     Resources.MassListRowReader_CalcPrecursorExplanations_Check_the_Instrument_tab_in_the_Transition_Settings),
                                              messageDlg.ErrorList[0].ErrorMessage,
                                              2);
                RunUI(() => messageDlg.Size = new Size(838, 192));
                PauseForScreenShot <ImportTransitionListErrorDlg>("Error message form (expected)", 19);
                OkDialog(messageDlg, messageDlg.CancelButton.PerformClick);          // Acknowledge the error but decline to proceed with import
                RunUI(() => transitionSelectdgl.DialogResult = DialogResult.Cancel); // Cancel the import

                // Restore the clipboard text after pausing
                ClipboardEx.SetText(clipboardSaveText);
            }

            RunDlg <TransitionSettingsUI>(() => SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.Instrument), transitionSettingsUI =>
            {
                transitionSettingsUI.InstrumentMaxMz = 1800;
                transitionSettingsUI.OkDialog();
            });
            PasteTransitionListSkipColumnSelect();
            RunUI(SkylineWindow.CollapsePeptides);
            PauseForScreenShot("Targets tree (selected from main window)", 20);

            // Adjusting Modifications Manually, p. 19.
            AdjustModifications("AGLCQTFVYGGCR", true, 'V', 747.348);
            PauseForScreenShot("Target tree clipped from main window", 22);

            AdjustModifications("IVGGWECEK", true, 'V', 541.763);
            AdjustModifications("YEVQGEVFTKPQLWP", false, 'L', 913.974);
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath(@"Study 7\Study7.sky")));

            // Importing Data from a Multiple Sample WIFF file, p. 23.
            var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
            var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                              importResultsDlg1.GetDataSourcePathsFile(null));

            RunUI(() =>
            {
                openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Study 7"));
                openDataSourceDialog1.SelectAllFileType(UseRawFilesOrFullData ? ".wiff" : ".mzML"); // Force true wiff for FullData
            });
            if (UseRawFilesOrFullData)
            {
                var importResultsSamplesDlg = ShowDialog <ImportResultsSamplesDlg>(openDataSourceDialog1.Open);
                PauseForScreenShot <ImportResultsSamplesDlg>("Choose Samples form", 24);

                RunUI(() =>
                {
                    if (IsFullData)
                    {
                        importResultsSamplesDlg.CheckAll(true);
                        importResultsSamplesDlg.ExcludeSample(0);           // Blank
                        importResultsSamplesDlg.ExcludeSample(25);          // QC
                        importResultsSamplesDlg.ExcludeSample(26);
                        importResultsSamplesDlg.ExcludeSample(27);
                        importResultsSamplesDlg.ExcludeSample(28);
                        importResultsSamplesDlg.ExcludeSample(45);           // A2
                        importResultsSamplesDlg.ExcludeSample(46);
                        importResultsSamplesDlg.ExcludeSample(47);
                        importResultsSamplesDlg.ExcludeSample(48);
                        importResultsSamplesDlg.ExcludeSample(49);           // gradientwash
                        importResultsSamplesDlg.ExcludeSample(50);
                        importResultsSamplesDlg.ExcludeSample(51);
                        importResultsSamplesDlg.ExcludeSample(52);
                        importResultsSamplesDlg.ExcludeSample(53);           // A3
                        importResultsSamplesDlg.ExcludeSample(54);
                        importResultsSamplesDlg.ExcludeSample(55);
                        importResultsSamplesDlg.ExcludeSample(56);
                    }
                    else
                    {
                        importResultsSamplesDlg.CheckAll(false);
                        importResultsSamplesDlg.IncludeSample(1);
                        importResultsSamplesDlg.IncludeSample(2);
                        importResultsSamplesDlg.IncludeSample(11);
                        importResultsSamplesDlg.IncludeSample(12);
                    }
                });
                OkDialog(importResultsSamplesDlg, importResultsSamplesDlg.OkDialog);
            }
            else
            {
                RunUI(openDataSourceDialog1.Open);
            }

            {
                var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                PauseForScreenShot <ImportResultsNameDlg>("Import Results Common prefix form", 25);

                OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog);
            }
            WaitForCondition(() =>
                             SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            RestoreViewOnScreen(26);

            // Inspecting and Adjusting Peak Integration, p. 24.
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.ShowGraphRetentionTime(true);
                SkylineWindow.Size = new Size(1029, 659);
            });

            if (!IsPauseForScreenShots && !IsFullData)
            {
                TestApplyToAll();
            }

            PauseForScreenShot <GraphSummary.RTGraphView>("Main window with peaks and retention times showing", 26);
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
            RunUI(SkylineWindow.EditDelete);
            FindNode("IVGGWECEK"); // Not L10N

            TransitionGroupTreeNode selNodeGroup = null;

            RunUI(() =>
            {
                selNodeGroup = (TransitionGroupTreeNode)SkylineWindow.SequenceTree.SelectedNode.Nodes[1];
                Assert.AreEqual(selNodeGroup.StateImageIndex, (int)SequenceTree.StateImageId.peak_blank);
            });
            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUI =>
            {
                transitionSettingsUI.MZMatchTolerance = 0.065;
                transitionSettingsUI.OkDialog();
            });
            RunUI(() =>
            {
                Assert.AreEqual((int)SequenceTree.StateImageId.peak, selNodeGroup.StateImageIndex);
                SkylineWindow.ToggleIntegrateAll();
            });
            RunUI(() =>
            {
                foreach (PeptideDocNode nodePep in SkylineWindow.Document.Molecules)
                {
                    string sequence = nodePep.Peptide.Sequence;
                    int imageIndex  = PeptideTreeNode.GetPeakImageIndex(nodePep, SkylineWindow.SequenceTree);
                    if ((sequence != null) && (sequence.StartsWith("YLA") || sequence.StartsWith("YEV"))) // Not L10N
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.keep, imageIndex,
                                        string.Format("Expected keep icon for the peptide {0}, found {1}", sequence, imageIndex));
                    }
                    else if (sequence != null)
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak, imageIndex,
                                        string.Format("Expected peak icon for the peptide {0}, found {1}", sequence, imageIndex));
                    }
                    else // Custom Ion
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak_blank, imageIndex,
                                        string.Format("Expected peak_blank icon for the custom ion {0}, found {1}", nodePep.ModifiedTarget, imageIndex));
                    }
                }
            });
            PauseForScreenShot("Main window", 27);

            // Data Inspection with Peak Areas View, p. 29.
            RestoreViewOnScreen(28);
            FindNode("SSDLVALSGGHTFGK"); // Not L10N
            RunUI(NormalizeGraphToHeavy);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 29);

            FindNode((564.7746).ToString(LocalizationHelper.CurrentCulture) + "++"); // ESDTSYVSLK - Not L10N
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 30);

            RunUI(SkylineWindow.ExpandPeptides);
            string hgflprLight = (363.7059).ToString(LocalizationHelper.CurrentCulture) + "++";  // HGFLPR - Not L10N

            FindNode(hgflprLight);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 31);

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(NormalizeOption.TOTAL));
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph normalized metafile", 32);

            RunUI(() =>
            {
                SkylineWindow.ShowGraphPeakArea(false);
                SkylineWindow.ActivateReplicate("E_03");
                SkylineWindow.Size = new Size(757, 655);
            });
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile with interference", 32);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(true));
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaPeptideGraph();
                SkylineWindow.ShowTotalTransitions();
                SkylineWindow.ShowCVValues(true);
                SkylineWindow.ShowPeptideOrder(SummaryPeptideOrder.document);
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Peptide Comparison graph metafile", 33);

            float[] concentrations    = { 0f, 60, 175, 513, 1500, 2760, 4980, 9060, 16500, 30000 };
            var     documentGrid      = ShowDialog <DocumentGridForm>(() => SkylineWindow.ShowDocumentGrid(true));
            var     pathConcentration = PropertyPath.Parse("AnalyteConcentration");
            var     pathSampleType    = PropertyPath.Parse("SampleType");

            RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates));
            WaitForConditionUI(() => documentGrid.RowCount == (IsFullData ? concentrations.Length * 4 : 4) &&
                               documentGrid.FindColumn(pathConcentration) != null &&
                               documentGrid.FindColumn(pathSampleType) != null);       // Let it initialize
            RunUI(() =>
            {
                // Parent is a DocPane and Parent.Parent is the floating window
                documentGrid.Parent.Parent.Size = new Size(585, 325);
                var documentGridView            = documentGrid.DataGridView;
                var colConcentration            = documentGrid.FindColumn(pathConcentration);
                var colStandardType             = documentGrid.FindColumn(pathSampleType);

                if (IsFullData)
                {
                    for (int i = 0; i < concentrations.Length; i++)
                    {
                        for (int j = i * 4; j < (i + 1) * 4; j++)
                        {
                            double?concentration = concentrations[i];
                            SetCellValue(documentGridView, j, colConcentration.Index, concentration);
                            SetCellValue(documentGridView, j, colStandardType.Index,
                                         concentration == 0 ? SampleType.BLANK : SampleType.STANDARD);
                        }
                    }
                }
                else
                {
                    SetCellValue(documentGridView, 0, colConcentration.Index, 0.0);
                    SetCellValue(documentGridView, 0, colStandardType.Index, SampleType.BLANK);
                    SetCellValue(documentGridView, 1, colConcentration.Index, 0.0);
                    SetCellValue(documentGridView, 1, colStandardType.Index, SampleType.BLANK);
                    SetCellValue(documentGridView, 2, colConcentration.Index, 175.0);
                    SetCellValue(documentGridView, 2, colStandardType.Index, SampleType.STANDARD);
                    SetCellValue(documentGridView, 3, colConcentration.Index, 175.0);
                    SetCellValue(documentGridView, 3, colStandardType.Index, SampleType.STANDARD);
                }
            });
            WaitForGraphs();
            PauseForScreenShot <DocumentGridForm>("Document grid filled (scrolled to the end)", 35);
            RunUI(() => documentGrid.Close());

            FindNode("SSDLVALSGGHTFGK"); // Not L10N
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaReplicateComparison();
                var settings         = SkylineWindow.DocumentUI.Settings;
                var valConcentration = ReplicateValue.GetAllReplicateValues(settings).Skip(1).First();
                SkylineWindow.GroupByReplicateValue(valConcentration);
                NormalizeGraphToHeavy();
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph with CVs metafile", 36);

            RunUI(() => SkylineWindow.ShowCVValues(false));
            RunUI(() => SkylineWindow.SaveDocument());
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph grouped by concentration metafile", 37);
            PauseForAuditLog();
            // Further Exploration, p. 33.
            RunUI(() =>
            {
                SkylineWindow.OpenFile(GetTestPath(@"Study 7\Study II\Study 7ii (site 52).sky")); // Not L10N
                SkylineWindow.ShowPeakAreaPeptideGraph();
                SkylineWindow.ShowCVValues(true);
            });
            WaitForCondition(() => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            RestoreViewOnScreen(38);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas peptide comparison graph metafile", 38);
            FindNode("LSEPAELTDAVK");
            RunUI(() =>
            {
                SkylineWindow.ShowGraphPeakArea(false);
                SkylineWindow.Width = 920;
                SkylineWindow.ShowRTReplicateGraph();
            });
            PauseForScreenShot <GraphSummary.RTGraphView>("Retention Times replicate graph metafile", 38);

            FindNode("INDISHTQSVSAK");
            RunUI(SkylineWindow.ShowPeakAreaReplicateComparison);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas normalized to heave graph metafile", 39);

            if (IsCoverShotMode)
            {
                RunUI(() =>
                {
                    Settings.Default.ChromatogramFontSize = 14;
                    Settings.Default.AreaFontSize         = 14;
                    SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR);
                    SkylineWindow.AutoZoomBestPeak();
                });
                RestoreCoverViewOnScreen();
                RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.Parent);
                WaitForGraphs();
                RunUI(() => SkylineWindow.SequenceTree.SelectedNode = SkylineWindow.SelectedNode.Nodes[0]);
                RunUI(SkylineWindow.FocusDocument);
                TakeCoverShot();
                return;
            }

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(NormalizeOption.NONE));
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas no normalization graph metafile", 40);

            FindNode(hgflprLight);
            RunUI(() =>
            {
                SkylineWindow.ShowAllTransitions();
                NormalizeGraphToHeavy();
            });
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Area Ratio to Heavy graph showing interference metafile", 41);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));
            RunUI(() => SkylineWindow.ActivateReplicate("E_ 03"));
            WaitForGraphs();
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile showing slight interference", 41);
        }
예제 #21
0
        private void DoStudy7Test()
        {
            // Preparing a Document to Accept the Study 7 Transition List, p. 15
            RunUI(() => SkylineWindow.NewDocument());
            var peptideSettingsUI1 = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI);
            var mod13Cr            = new StaticMod("Label:13C(6) (C-term R)", "R", ModTerminus.C, false, null, LabelAtoms.C13,
                                                   RelativeRT.Matching, null, null, null);

            AddHeavyMod(mod13Cr, peptideSettingsUI1, "Edit Isotope Modification form", 17);
            RunUI(() =>
            {
                peptideSettingsUI1.PickedHeavyMods            = new[] { "Label:13C(6) (C-term R)", HEAVY_K };
                peptideSettingsUI1.PickedLibraries            = new[] { "" };
                peptideSettingsUI1.SelectedBackgroundProteome = Resources.SettingsList_ELEMENT_NONE_None;
                peptideSettingsUI1.OkDialog();
            });

            // Pasting a Transition List into the Document, p. 18.
            string clipboardSaveText = string.Empty;

            RunUI(() =>
            {
                var filePath = GetTestPath(@"Study 7\Study7 transition list.xls");
                SetExcelFileClipboardText(filePath, "Simple", 6, false);
                clipboardSaveText = ClipboardEx.GetText();
            });

            {
                var messageDlg = ShowDialog <ImportTransitionListErrorDlg>(SkylineWindow.Paste);
                PauseForScreenShot <ImportTransitionListErrorDlg>("Error message form (expected)", 18);
                OkDialog(messageDlg, messageDlg.CancelDialog);

                // Restore the clipboard text after pausing
                ClipboardEx.SetText(clipboardSaveText);
            }

            RunDlg <TransitionSettingsUI>(() => SkylineWindow.ShowTransitionSettingsUI(TransitionSettingsUI.TABS.Instrument), transitionSettingsUI =>
            {
                transitionSettingsUI.InstrumentMaxMz = 1800;
                transitionSettingsUI.OkDialog();
            });
            RunUI(() =>
            {
                SkylineWindow.Paste();
                SkylineWindow.CollapsePeptides();
            });
            PauseForScreenShot("Targets tree (selected from main window)", 19);

            // Adjusting Modifications Manually, p. 19.
            AdjustModifications("AGLCQTFVYGGCR", true, 'V', 747.348);
            PauseForScreenShot("Target tree clipped from main window", 22);

            AdjustModifications("IVGGWECEK", true, 'V', 541.763);
            AdjustModifications("YEVQGEVFTKPQLWP", false, 'L', 913.974);
            RunUI(() => SkylineWindow.SaveDocument(GetTestPath(@"Study 7\Study7.sky")));

            // Importing Data from a Multiple Sample WIFF file, p. 23.
            var importResultsDlg1     = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults);
            var openDataSourceDialog1 = ShowDialog <OpenDataSourceDialog>(() => importResultsDlg1.NamedPathSets =
                                                                              importResultsDlg1.GetDataSourcePathsFile(null));

            RunUI(() =>
            {
                openDataSourceDialog1.CurrentDirectory = new MsDataFilePath(GetTestPath("Study 7"));
                openDataSourceDialog1.SelectAllFileType(IsFullData ? ".wiff" : ExtensionTestContext.ExtAbWiff); // Force true wiff for FullData
            });
            if (UseRawFilesOrFullData)
            {
                var importResultsSamplesDlg = ShowDialog <ImportResultsSamplesDlg>(openDataSourceDialog1.Open);
                PauseForScreenShot <ImportResultsSamplesDlg>("Choose Samples form", 23);

                RunUI(() =>
                {
                    if (IsFullData)
                    {
                        importResultsSamplesDlg.CheckAll(true);
                        importResultsSamplesDlg.ExcludeSample(0);           // Blank
                        importResultsSamplesDlg.ExcludeSample(25);          // QC
                        importResultsSamplesDlg.ExcludeSample(26);
                        importResultsSamplesDlg.ExcludeSample(27);
                        importResultsSamplesDlg.ExcludeSample(28);
                        importResultsSamplesDlg.ExcludeSample(45);           // A2
                        importResultsSamplesDlg.ExcludeSample(46);
                        importResultsSamplesDlg.ExcludeSample(47);
                        importResultsSamplesDlg.ExcludeSample(48);
                        importResultsSamplesDlg.ExcludeSample(49);           // gradientwash
                        importResultsSamplesDlg.ExcludeSample(50);
                        importResultsSamplesDlg.ExcludeSample(51);
                        importResultsSamplesDlg.ExcludeSample(52);
                        importResultsSamplesDlg.ExcludeSample(53);           // A3
                        importResultsSamplesDlg.ExcludeSample(54);
                        importResultsSamplesDlg.ExcludeSample(55);
                        importResultsSamplesDlg.ExcludeSample(56);
                    }
                    else
                    {
                        importResultsSamplesDlg.CheckAll(false);
                        importResultsSamplesDlg.IncludeSample(1);
                        importResultsSamplesDlg.IncludeSample(2);
                        importResultsSamplesDlg.IncludeSample(11);
                        importResultsSamplesDlg.IncludeSample(12);
                    }
                });
                OkDialog(importResultsSamplesDlg, importResultsSamplesDlg.OkDialog);
            }
            else
            {
                RunUI(openDataSourceDialog1.Open);
            }

            {
                var importResultsNameDlg = ShowDialog <ImportResultsNameDlg>(importResultsDlg1.OkDialog);
                PauseForScreenShot <ImportDocResultsDlg>("Import Results Common prefix form", 24);

                OkDialog(importResultsNameDlg, importResultsNameDlg.YesDialog);
            }
            WaitForCondition(() =>
                             SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            RestoreViewOnScreen(25);

            // Inspecting and Adjusting Peak Integration, p. 24.
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.ShowGraphRetentionTime(true);
            });

            if (!IsPauseForScreenShots && !IsFullData)
            {
                TestApplyToAll();
            }

            PauseForScreenShot <GraphSummary.RTGraphView>("Main window with peaks and retention times showing", 25);
            CheckReportCompatibility.CheckAll(SkylineWindow.Document);
            RunUI(SkylineWindow.EditDelete);
            FindNode("IVGGWECEK"); // Not L10N

            TransitionGroupTreeNode selNodeGroup = null;

            RunUI(() =>
            {
                selNodeGroup = (TransitionGroupTreeNode)SkylineWindow.SequenceTree.SelectedNode.Nodes[1];
                Assert.AreEqual(selNodeGroup.StateImageIndex, (int)SequenceTree.StateImageId.peak_blank);
            });
            RunDlg <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI, transitionSettingsUI =>
            {
                transitionSettingsUI.MZMatchTolerance = 0.065;
                transitionSettingsUI.OkDialog();
            });
            RunUI(() =>
            {
                Assert.AreEqual((int)SequenceTree.StateImageId.peak, selNodeGroup.StateImageIndex);
                SkylineWindow.ToggleIntegrateAll();
            });
            RunUI(() =>
            {
                foreach (PeptideDocNode nodePep in SkylineWindow.Document.Molecules)
                {
                    string sequence = nodePep.Peptide.Sequence;
                    int imageIndex  = PeptideTreeNode.GetPeakImageIndex(nodePep, SkylineWindow.SequenceTree);
                    if ((sequence != null) && (sequence.StartsWith("YLA") || sequence.StartsWith("YEV"))) // Not L10N
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.keep, imageIndex,
                                        string.Format("Expected keep icon for the peptide {0}, found {1}", sequence, imageIndex));
                    }
                    else if (sequence != null)
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak, imageIndex,
                                        string.Format("Expected peak icon for the peptide {0}, found {1}", sequence, imageIndex));
                    }
                    else // Custom Ion
                    {
                        Assert.AreEqual((int)SequenceTree.StateImageId.peak_blank, imageIndex,
                                        string.Format("Expected peak_blank icon for the custom ion {0}, found {1}", nodePep.ModifiedTarget, imageIndex));
                    }
                }
            });
            PauseForScreenShot("Main window", 27);

            // Data Inspection with Peak Areas View, p. 27.
            FindNode("SSDLVALSGGHTFGK"); // Not L10N
            RunUI(NormalizeGraphToHeavy);
            RestoreViewOnScreen(28);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 28);

            FindNode((564.7746).ToString(LocalizationHelper.CurrentCulture) + "++"); // ESDTSYVSLK - Not L10N
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 29);

            RunUI(SkylineWindow.ExpandPeptides);
            string hgflprLight = (363.7059).ToString(LocalizationHelper.CurrentCulture) + "++";  // HGFLPR - Not L10N

            FindNode(hgflprLight);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph metafile", 30);

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.area_percent_view));
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph normalized metafile", 31);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));
            RunUI(() => SkylineWindow.ActivateReplicate("E_03"));
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile with interference", 31);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(true));
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaPeptideGraph();
                SkylineWindow.ShowTotalTransitions();
                SkylineWindow.ShowCVValues(true);
                SkylineWindow.ShowPeptideOrder(SummaryPeptideOrder.document);
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas Peptide Comparison graph metafile", 32);

            // Annotating replicates with concentration values
            var chooseAnnotationsDlg = ShowDialog <DocumentSettingsDlg>(SkylineWindow.ShowDocumentSettingsDialog);
            var editListDlg          = ShowDialog <EditListDlg <SettingsListBase <AnnotationDef>, AnnotationDef> >(chooseAnnotationsDlg.EditAnnotationList);

            RunUI(editListDlg.ResetList);
            var defineAnnotationDlg = ShowDialog <DefineAnnotationDlg>(editListDlg.AddItem);

            RunUI(() =>
            {
                defineAnnotationDlg.AnnotationName    = "Concentration";
                defineAnnotationDlg.AnnotationType    = AnnotationDef.AnnotationType.number;
                defineAnnotationDlg.AnnotationTargets = AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.replicate);
            });
            PauseForScreenShot <DefineAnnotationDlg>("Define Annotation form", 33);
            OkDialog(defineAnnotationDlg, defineAnnotationDlg.OkDialog);
            OkDialog(editListDlg, () => editListDlg.DialogResult = DialogResult.OK);
            RunUI(() => chooseAnnotationsDlg.AnnotationsCheckedListBox.SetItemChecked(0, true));
            PauseForScreenShot <DocumentSettingsDlg>("Annotation Settings form", 34);
            OkDialog(chooseAnnotationsDlg, chooseAnnotationsDlg.OkDialog);
            RunUI(() => SkylineWindow.ShowResultsGrid(true));
            RunUI(() =>
            {
                SkylineWindow.SelectedPath =
                    SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.MoleculeGroups, 0);
            });
            WaitForGraphs();
            WaitForConditionUI(() => FindOpenForm <LiveResultsGrid>().IsComplete);
            RunUI(() =>
            {
                Settings.Default.ResultsGridSynchSelection = false;
                var resultsGrid      = FindOpenForm <LiveResultsGrid>().DataGridView;
                var colConcentration =
// ReSharper disable LocalizableElement
                    resultsGrid.Columns.Cast <DataGridViewColumn>().First(col => "Concentration" == col.HeaderText); // Not L10N
// ReSharper restore LocalizableElement
                if (IsFullData)
                {
                    float[] concentrations = { 0f, 60, 175, 513, 1500, 2760, 4980, 9060, 16500, 30000 };
                    for (int i = 0; i < concentrations.Length; i++)
                    {
                        for (int j = i * 4; j < (i + 1) * 4; j++)
                        {
                            SetCellValue(resultsGrid, j, colConcentration.Index, concentrations[i]);
                        }
                    }
                }
                else
                {
                    SetCellValue(resultsGrid, 0, colConcentration.Index, 0f);
                    SetCellValue(resultsGrid, 1, colConcentration.Index, 0f);
                    SetCellValue(resultsGrid, 2, colConcentration.Index, 175f);
                    SetCellValue(resultsGrid, 3, colConcentration.Index, 175f);
                }
            });
            WaitForGraphs();
            PauseForScreenShot <LiveResultsGrid>("Results grid with annotations (scrolled to the end)", 35);

            FindNode("SSDLVALSGGHTFGK"); // Not L10N
            RunUI(() =>
            {
                SkylineWindow.ShowPeakAreaReplicateComparison();
                SkylineWindow.GroupByReplicateAnnotation("Concentration");
                NormalizeGraphToHeavy();
            });
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph with CVs metafile", 36);

            RunUI(() => SkylineWindow.ShowCVValues(false));
            RunUI(() => SkylineWindow.SaveDocument());
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas graph grouped by concentration metafile", 36);
            PauseForAuditLog();
            // Further Exploration, p. 33.
            RunUI(() =>
            {
                SkylineWindow.OpenFile(GetTestPath(@"Study 7\Study II\Study 7ii (site 52).sky")); // Not L10N
                SkylineWindow.ShowPeakAreaPeptideGraph();
                SkylineWindow.ShowCVValues(true);
            });
            WaitForCondition(() => SkylineWindow.Document.Settings.MeasuredResults.IsLoaded);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas peptide comparison graph metafile", 37);
            FindNode("LSEPAELTDAVK");
            RunUI(SkylineWindow.ShowRTReplicateGraph);
            PauseForScreenShot <GraphSummary.RTGraphView>("Retention Times replicate graph metafile", 38);

            FindNode("INDISHTQSVSAK");
            RunUI(SkylineWindow.ShowPeakAreaReplicateComparison);
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas normalized to heave graph metafile", 38);

            RunUI(() => SkylineWindow.NormalizeAreaGraphTo(AreaNormalizeToView.none));
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Peak Areas no normalization graph metafile", 39);

            FindNode(hgflprLight);
            RunUI(() =>
            {
                SkylineWindow.ShowAllTransitions();
                NormalizeGraphToHeavy();
            });
            WaitForGraphs();
            PauseForScreenShot <GraphSummary.AreaGraphView>("Area Ratio to Heavy graph showing interference metafile", 40);

            RunUI(() => SkylineWindow.ShowGraphPeakArea(false));
            RunUI(() => SkylineWindow.ActivateReplicate("E_ 03"));
            WaitForGraphs();
            PauseForScreenShot <GraphChromatogram>("Chromatogram graph metafile showing slight interference", 40);
        }
예제 #22
0
 public void CopyMessage()
 {
     ClipboardEx.SetText(GetTitleAndMessageDetail());
 }