示例#1
0
 private void BelaGraphPeptideDistribution_SizeChanged(object sender, SizeChangedEventArgs e)
 {
     BelaGraphPeptideDistribution.Plot(BelaGraph.BackgroundOption.YellowXGradient, true, true, new System.Drawing.Font("Courier New", 14));
 }
示例#2
0
        private void PlotQuants()
        {
            //------------------------------------


            BelaGraphPeptideDistribution.ClearDataBuffer();
            BelaGraphPeptideDistribution.XLabel = "-log(p-value)";
            BelaGraphPeptideDistribution.YLabel = "log(fold)";
            BelaGraphPeptideDistribution.XRound = 4;
            BelaGraphPeptideDistribution.YRound = 4;


            SolidColorBrush redBrush = Brushes.Red.Clone();

            redBrush.Opacity = 0.5;

            SolidColorBrush greenBrush = Brushes.Green.Clone();

            greenBrush.Opacity = 0.5;

            SolidColorBrush grayBrush = Brushes.LightGray.Clone();

            grayBrush.Opacity = 0.4;

            BelaGraph.DataVector greenVectorPep = new BelaGraph.DataVector(BelaGraph.GraphStyle.Bubble, "Green dots", greenBrush);
            BelaGraph.DataVector redVectorPep   = new BelaGraph.DataVector(BelaGraph.GraphStyle.Bubble, "Red dots", redBrush);
            BelaGraph.DataVector grayVectorPep  = new BelaGraph.DataVector(BelaGraph.GraphStyle.Bubble, "Gray dots", grayBrush);

            foreach (PepQuant pq in MyPeptides)
            {
                //Skip Quants composed mainly of zeros or quants that have exactly 0.5 as a p-value
                if (pq.TTest == 0.5)
                {
                    continue;
                }

                double avgLogFold = pq.AVGLogFold;
                double pValue     = pq.TTest;

                if (avgLogFold < -3)
                {
                    avgLogFold = -3;
                }
                if (avgLogFold > 3)
                {
                    avgLogFold = 3;
                }

                BelaGraph.PointCav dp = new BelaGraph.PointCav();
                dp.Y          = avgLogFold;
                dp.X          = Math.Round(1 - pValue, 4);
                dp.ExtraParam = dp.Y.ToString();

                dp.MouseOverTip = "Sequence: " + pq.Sequence + "\nQuants: " + pq.MyQuants.Count + "\nAvg Log Fold: " + avgLogFold + "\nTtest: " + pValue;

                if (myPeptidesTMP.Exists(a => a.Sequence.Equals(pq.Sequence)))
                {
                    if (dp.Y > 0)
                    {
                        greenVectorPep.AddPoint(dp);
                    }
                    else
                    {
                        redVectorPep.AddPoint(dp);
                    }
                }
                else
                {
                    if ((bool)CheckBoxPlotFilteredPeptides.IsChecked)
                    {
                        grayVectorPep.AddPoint(dp);
                    }
                }
            }

            grayVectorPep.ThePoints.Sort((a, b) => b.X.CompareTo(a.X));
            redVectorPep.ThePoints.Sort((a, b) => b.X.CompareTo(a.X));
            greenVectorPep.ThePoints.Sort((a, b) => b.X.CompareTo(a.X));

            BelaGraphPeptideDistribution.AddDataVector(grayVectorPep);
            BelaGraphPeptideDistribution.AddDataVector(redVectorPep);
            BelaGraphPeptideDistribution.AddDataVector(greenVectorPep);


            BelaGraphPeptideDistribution.Plot(BelaGraph.BackgroundOption.YellowXGradient, true, true, new System.Drawing.Font("Courier New", 14));
        }