Beispiel #1
0
        private void AssertDataCorrect(SummaryGraphPane pane, int statsIndex, bool record = true)
        {
            AreaCVGraphData data = null;

            WaitForConditionUI(() => (data = GetCurrentData(pane)) != null && data.IsValid);
            WaitForGraphs();

            RunUI(() =>
            {
                var testSupport         = pane as IAreaCVHistogramInfo;
                int items               = testSupport != null ? testSupport.Items : 0;
                var graphDataStatistics = new AreaCVGraphDataStatistics(data, items);

                if (!RecordData)
                {
                    Assert.AreEqual(STATS[statsIndex], graphDataStatistics);
                }
                else if (record)
                {
                    Console.WriteLine(graphDataStatistics.ToCode());
                }
            });
        }
Beispiel #2
0
        private void AssertDataCorrect(SummaryGraphPane pane, int statsIndex)
        {
            AreaCVGraphData data = null;

            WaitForConditionUI(() => (data = GetCurrentData(pane)) != null);
            WaitForGraphs();

            RunUI(() =>
            {
                var info  = pane as IAreaCVHistogramInfo;
                int items = info != null ? info.Items : 0;
                var graphDataStatistics = new AreaCVGraphDataStatistics(data, items);

                if (!RecordData)
                {
                    Assert.AreEqual(STATS[statsIndex], new AreaCVGraphDataStatistics(data, items));
                }
                else
                {
                    Console.WriteLine(graphDataStatistics.ToCode());
                }
            });
        }
        private void TestHistogramQValues <T>(Action showHistogram, int statsStartIndex) where T : SummaryGraphPane
        {
            RunUI(() =>
            {
                showHistogram();
                SkylineWindow.SetAreaCVPointsType(PointsTypePeakArea.targets);
                SkylineWindow.SetNormalizationMethod(NormalizationMethod.NONE);
            });

            WaitForGraphs();

            var graph   = SkylineWindow.GraphPeakArea;
            var toolbar = graph.Toolbar as AreaCVToolbar;

            Assert.IsNotNull(toolbar);

            RunUI(() => toolbar.SetMinimumDetections(2));
            OpenAndChangeAreaCVProperties(graph, p => p.QValueCutoff = 0.01);

            // Test if the toolbar is there and if the displayed data is correct
            T pane;

            Assert.IsTrue(graph.TryGetGraphPane(out pane));
            Assert.IsTrue(pane.HasToolbar);
            AssertDataCorrect(pane, statsStartIndex++);

            RunUI(() =>
            {
                SkylineWindow.SetAreaCVPointsType(PointsTypePeakArea.decoys);
            });
            WaitForGraphs();
            AssertDataCorrect(pane, statsStartIndex); // No ++ here on purpose


            // Make sure the data is not affected by the qvalue cutoff if the points type is decoys
            OpenAndChangeAreaCVProperties(graph, p => p.QValueCutoff = 0.02);
            AssertDataCorrect(pane, statsStartIndex++, false);

            // Make sure that the data is correct after changing the qvalue cutoff, this time with points type targets
            RunUI(() =>
            {
                SkylineWindow.SetAreaCVPointsType(PointsTypePeakArea.targets);
            });
            WaitForGraphs();
            AssertDataCorrect(pane, statsStartIndex++);

            RunUI(() => toolbar.SetMinimumDetections(3));
            UpdateGraphAndWait(graph);
            AssertDataCorrect(pane, statsStartIndex++);

            // Verify that a qvalue cutoff of 1.0 has the same effect as no qvalue cutoff
            OpenAndChangeAreaCVProperties(graph, p => p.QValueCutoff = 1.0);
            AreaCVGraphData qvalue1Data = null;

            WaitForConditionUI(() => (qvalue1Data = GetCurrentData(pane)) != null);
            AreaCVGraphDataStatistics qvalue1Statistics = null;

            RunUI(() => qvalue1Statistics = new AreaCVGraphDataStatistics(qvalue1Data, pane.GetTotalBars()));
            OpenAndChangeAreaCVProperties(graph, p => p.QValueCutoff = double.NaN);
            AreaCVGraphData qvalueNaNData = null;

            WaitForConditionUI(() => (qvalueNaNData = GetCurrentData(pane)) != null);
            AreaCVGraphDataStatistics qvalueNaNStatistics = null;

            RunUI(() => qvalueNaNStatistics = new AreaCVGraphDataStatistics(qvalueNaNData, pane.GetTotalBars()));

            Assert.AreEqual(qvalue1Statistics, qvalueNaNStatistics);
        }