Exemple #1
0
        public static void MakeGenomeBaseRatio()
        {
            try
            {
                UpdateLog("Fragmenting " + Genome.ShortFileName + " Into 200bp Fragments & calculcating base ratios..", true);
                List <double> ratios = Genome.FindAllBaseRatios();
                int           bcount = Math.Min(ratios.Count / 300, 40);
                DoublesHisto  dHisto = new DoublesHisto(ratios, bcount, "CG Ratio", false, ModelDisplayType.Bar);

                PlotModel model = new PlotModel {
                    Title = "For 200bp fragments: Base Ratio: CG / (AT + CG)"
                };
                LinearAxis axX = new LinearAxis(AxisPosition.Bottom, 0, 1, "CG Ratio");
                LinearAxis axY = new LinearAxis(AxisPosition.Left, 0, dHisto.GetYPercentLimit(1), "Density");
                model.TitlePadding    = 10;
                axX.AxisTitleDistance = 10;
                axY.AxisTitleDistance = 10;

                model.Axes.Add(axX);
                model.Axes.Add(axY);

                dHisto.AddToModel(model);
                model.IsLegendVisible = true;

                MainWindow.InsertGraph(GraphWindow.Genome, model, dHisto);
                UpdateLog("Made a base ratio graph in the Genome tab.", true);

                ProgramState.MadeGenomeGraph = true;
            }
            catch (Exception e) {
                ShowMessageWindow(e.Message, true);
            }
        }
Exemple #2
0
        public MultiHisto(Dictionary <string, List <double> > dict, int buckets, ModelDisplayType dtype) : base()
        {
            histos = new List <GraphingClass> ();

            double fullMax = 0;
            double fullMin = 999999999;
            double stdMin  = 999999999;
            double stdMax  = 0;

            foreach (KeyValuePair <string, List <double> > kvp in dict)
            {
                if (kvp.Value.Count > 5)
                {
                    DoublesHisto h = new DoublesHisto(kvp.Value, buckets, kvp.Key, true, dtype);
                    histos.Add(h);

                    fullMax = Math.Max(h.GetLocalMax(), fullMax);
                    fullMin = Math.Min(h.GetLocalMin(), fullMin);
                    stdMax  = Math.Max(h.GetPlusTwoStdDevs(), stdMax);
                    stdMin  = Math.Min(h.GetMinusTwoStdDevs(), stdMin);
                }
            }

            stdMin = Math.Max(0, stdMin);
            List <double> increments = DoublesHisto.CreateBoundaryIncrements(fullMin, fullMax, stdMin, stdMax, buckets);

            int pos = 1;
            int cnt = histos.Count;

            foreach (DoublesHisto h in histos)
            {
                h.SetBoundaryIncrements(increments);
                h.CountToBins(fullMin);
                h.SetTotalHistos(cnt, pos);
                pos++;
            }
        }