示例#1
0
        private void buttonSearchAll_Click(object sender, EventArgs e)
        {
            //Check if we have the results already loaded
            try
            {
                checkIfResultsAreLoaded();
            }
            catch
            {
                MessageBox.Show("Please verify the result report", "Error");
                return;
            }

            //Collect the search all parameters
            SearchAll searchAllWindow = new SearchAll();

            searchAllWindow.ShowDialog();

            //Make sure he pressed the work button
            if (!searchAllWindow.Work)
            {
                return;
            }

            //Now lets rock!
            double hypeGeoPValueCutoff  = searchAllWindow.HyperGeometricPValueCutOff;
            int    minimumNumberOfTerms = searchAllWindow.MinimumNumberOfTerms;
            bool   useFDR       = searchAllWindow.FDR;
            double FDRAlfa      = searchAllWindow.FDRAlfa;
            int    minimumDepth = searchAllWindow.MinimumDepth;

            //Give them the wait window
            WaitWindow ww = new WaitWindow();

            System.Threading.Thread tt = new System.Threading.Thread(new System.Threading.ThreadStart(ww.ShowWindow));
            tt.Start();

            //Analyze all terms
            if (termScoreAnalysisListForAllParameters.Count == 0)
            {
                ww.ChangeLowerLable("Please wait... evaluating for " + gt.Terms.Count.ToString() + " terms.");

                termScoreAnalysisListForAllParameters = (from toEvaluate in gt.Terms.AsParallel()
                                                         select termScoreCalculator.calculate(toEvaluate, false, true)).ToList();
            }

            //Performing post processing;
            //sort the arrays
            if (useFDR)
            {
                //Sorts ascending by pvalue then by foldChange
                termScoreAnalysisListForAllParameters.Sort((a, b) => a.FoldChange.CompareTo(b.FoldChange));
                termScoreAnalysisListForAllParameters.Sort((a, b) => a.CummulativeHypeGeo.CompareTo(b.CummulativeHypeGeo));
            }

            //Prepare the array for plotting
            List <TermScoreCalculator.TermScoreAnalysis> termToPlot = new List <TermScoreCalculator.TermScoreAnalysis>();
            int counter2 = 0;

            foreach (TermScoreCalculator.TermScoreAnalysis tsc in termScoreAnalysisListForAllParameters)
            {
                counter2++;
                if (tsc.CummulativeHypeGeo <= hypeGeoPValueCutoff && tsc.AbsoluteFoldChange > 1 && tsc.IdentifiedTermsInStudySet >= minimumNumberOfTerms)
                {
                    if (useFDR)
                    {
                        double FDRCutoff = (FDRAlfa * counter2) / termScoreAnalysisListForAllParameters.Count;
                        if (tsc.CummulativeHypeGeo <= FDRCutoff)
                        {
                            termToPlot.Add(tsc);
                        }
                    }
                    else
                    {
                        termToPlot.Add(tsc);
                    }
                }
            }

            //Plotting
            PlotPieDotAndUpdateTable(termToPlot, minimumDepth);

            //Shut down our wait window
            tt.Abort();
        }