Example #1
0
        // function to save a given arry's bytes to file
        public void SaveListToFile(string FileLocation, PointPairList list)
        {
            File.AppendAllText(FileLocation, Convert.ToString(DateTime.Now) + "\r\n");
            File.AppendAllText(FileLocation, this.filename.Text + "\r\n");
            File.AppendAllText(FileLocation, "Data from Graph" + "\r\n");

            double[] SaveArray = list.Select(P => P.Y).ToArray();
            Console.WriteLine("Size of SvarArray {0}", SaveArray.Length);

            //  Stop = true;
            for (int j = 0; j < SaveArray.Length; j++)
            {
                string Reading = SaveArray[j].ToString() + "\r\n";
                File.AppendAllText(FileLocation, Reading);
            }

            SumProcessedBytes1 = 0;
            SumProcessedBytes2 = 0;
            PreviousScreenRemainder1 = 0;
            PreviousScreenRemainder2 = 0;
            AverageIndex1 = 1;
            AverageIndex2 = 1;
            list1.Clear();
            list2.Clear();
            Array.Clear(ScreenBuffer, 0, ScreenBuffer.Length);
            COPY_POS = 0;
            CreateGraph(zgc);
        }
Example #2
0
        public void UpdateGraph()
        {
            zedGraphControl.GraphPane.CurveList.Clear();
            zedGraphControl.GraphPane.GraphObjList.Clear();
            if (!(bindingSource.Current is DataRow))
            {
                return;
            }
            var currentRow = (DataRow) bindingSource.Current;
            var alignedFile = currentRow.AlignedRetentionTimes;
            if (alignedFile == null)
            {
                zedGraphControl.GraphPane.Title.Text = Resources.AlignmentForm_UpdateGraph_Waiting_for_retention_time_alignment;
                return;
            }
            var points = new PointPairList();
            var outliers = new PointPairList();
            var peptideTimes = alignedFile.Regression.PeptideTimes;
            for (int i = 0; i < peptideTimes.Count; i++)
            {
                var peptideTime = peptideTimes[i];
                var point = new PointPair(alignedFile.OriginalTimes[peptideTime.PeptideSequence],
                                            peptideTime.RetentionTime,
                                            peptideTime.PeptideSequence);
                if (alignedFile.OutlierIndexes.Contains(i))
                {
                    outliers.Add(point);
                }
                else
                {
                    points.Add(point);
                }
            }

            var goodPointsLineItem = new LineItem("Peptides", points, Color.Black, SymbolType.Diamond) // Not L10N?
                {
                    Symbol = {Size = 8f},
                    Line = {IsVisible = false}
                };
            goodPointsLineItem.Symbol.Border.IsVisible = false;
            goodPointsLineItem.Symbol.Fill = new Fill(RTLinearRegressionGraphPane.COLOR_REFINED);

            if (outliers.Count > 0)
            {
                var outlierLineItem = zedGraphControl.GraphPane.AddCurve(Resources.AlignmentForm_UpdateGraph_Outliers, outliers, Color.Black,
                                                                        SymbolType.Diamond);
                outlierLineItem.Symbol.Size = 8f;
                outlierLineItem.Line.IsVisible = false;
                outlierLineItem.Symbol.Border.IsVisible = false;
                outlierLineItem.Symbol.Fill = new Fill(RTLinearRegressionGraphPane.COLOR_OUTLIERS);
                goodPointsLineItem.Label.Text = Resources.AlignmentForm_UpdateGraph_Peptides_Refined;
            }
            zedGraphControl.GraphPane.CurveList.Add(goodPointsLineItem);
            if (points.Count > 0)
            {
                double xMin = points.Select(p => p.X).Min();
                double xMax = points.Select(p => p.X).Max();
                var regression = alignedFile.RegressionRefined ?? alignedFile.Regression;
                var regressionLine = zedGraphControl.GraphPane
                        .AddCurve(Resources.AlignmentForm_UpdateGraph_Regression_line, new[] { xMin, xMax },
                        new[] { regression.Conversion.GetY(xMin), regression.Conversion.GetY(xMax) },
                        Color.Black);
                regressionLine.Symbol.IsVisible = false;
            }
                zedGraphControl.GraphPane.Title.Text = string.Format(Resources.AlignmentForm_UpdateGraph_Alignment_of__0__to__1_,
                currentRow.DataFile,
                currentRow.Target.Name);
                zedGraphControl.GraphPane.XAxis.Title.Text = string.Format(Resources.AlignmentForm_UpdateGraph_Time_from__0__,
                    currentRow.DataFile);
                zedGraphControl.GraphPane.YAxis.Title.Text = Resources.AlignmentForm_UpdateGraph_Aligned_time;
            zedGraphControl.GraphPane.AxisChange();
            zedGraphControl.Invalidate();
        }
Example #3
0
        // function to save a given arry's bytes to file
        public void SaveListToFile(string FileLocation, PointPairList list)
        {
            MetaData(1)[4] = this.filename.Text;

            File.AppendAllText(FileLocation, "Data from LHS Graph" + "\r\n");
            File.AppendAllText(FileLocation, MetaData(1)[0] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(1)[1] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(1)[2] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(1)[3] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(1)[4] + "\r\n");

            double[] SaveArray = list.Select(P => P.Y).ToArray();
            Console.WriteLine("Size of SvarArray {0}", SaveArray.Length);

            //  Stop = true;
            for (int j = 0; j < SaveArray.Length; j++)
            {
                string Reading = SaveArray[j].ToString() + "\r\n";
                File.AppendAllText(FileLocation, Reading);
            }
        }
Example #4
0
        // function to save a given list's values to file
        public void SaveListToFile(string FileLocation, PointPairList list, int Pane)
        {
            MetaData(1)[4] = this.filedescription.Text;

            //Add some MetaData at beginning of file
            File.AppendAllText(FileLocation, MetaData(Pane)[0] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[1] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[2] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[3] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[4] + "\r\n");

            //List converted to array for saving
            double[][] SaveArray = new double[Convert.ToInt32(list.LongCount())][];
            SaveArray[0] = list.Select(P => P.X).ToArray();
            SaveArray[1] = list.Select(P => P.Y).ToArray();

            for (int j = 0; j < SaveArray.Length; j++)
            {
                string Reading = SaveArray[0][j].ToString() + "\t" + SaveArray[1][j] + "\r\n";
                File.AppendAllText(FileLocation, Reading);
            }
        }
Example #5
0
        // function to save both graphs' data
        public void SaveBothListsToFile(string FileLocation, PointPairList listA, PointPairList listB)
        {
            MetaData(1)[4] = this.filedescription.Text;
            string LHSfile = FileLocation + "Pane1.txt";
            string RHSfile = FileLocation + "Pane2.txt";

            File.AppendAllText(LHSfile, "Data from Pane1 Graph" + "\r\n");
            File.AppendAllText(LHSfile, MetaData(1)[0] + "\r\n");
            File.AppendAllText(LHSfile, MetaData(1)[1] + "\r\n");
            File.AppendAllText(LHSfile, MetaData(1)[2] + "\r\n");
            File.AppendAllText(LHSfile, MetaData(1)[3] + "\r\n");
            File.AppendAllText(LHSfile, MetaData(1)[4] + "\r\n");

            // Array of values to be saved (LHS Graph)
            double[][] SaveArray1 = new double[Convert.ToInt32(listA.LongCount())][];
            SaveArray1[0] = listA.Select(P => P.X).ToArray();
            SaveArray1[1] = listA.Select(P => P.Y).ToArray();
            for (int j = 0; j < SaveArray1.Length; j++)
            {
                string Reading = SaveArray1[0][j].ToString() + "\t" + SaveArray1[1][j] + "\r\n";
                File.AppendAllText(LHSfile, Reading);
            }

            File.AppendAllText(RHSfile, "Data from Pane2 Graph" + "\r\n");
            File.AppendAllText(RHSfile, MetaData(2)[0] + "\r\n");
            File.AppendAllText(RHSfile, MetaData(2)[1] + "\r\n");
            File.AppendAllText(RHSfile, MetaData(2)[2] + "\r\n");
            File.AppendAllText(RHSfile, MetaData(2)[3] + "Environment time = " + Convert.ToString(Environment.TickCount - tickStart) + "\r\n");
            File.AppendAllText(RHSfile, MetaData(2)[4] + "\r\n");

            double[][] SaveArray2 = new double[Convert.ToInt32(listB.LongCount())][];
            SaveArray2[0] = listB.Select(P => P.X).ToArray();
            SaveArray2[1] = listB.Select(P => P.Y).ToArray();
            for (int j = 0; j < SaveArray2.Length; j++)
            {
                string Reading = SaveArray2[0][j].ToString() + "\t" + SaveArray2[1][j].ToString() + "\r\n";
                File.AppendAllText(RHSfile, Reading);
            }

            Reset(zgc);
            Reset(Window2.zgc2);
        }
Example #6
0
        // function to save a given list's values to file
        public void SaveListToFile(string FileLocation, PointPairList list, int Pane)
        {
            File.AppendAllText(FileLocation, MetaData(Pane)[0] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[1] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[2] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[3] + "\r\n");
            File.AppendAllText(FileLocation, MetaData(Pane)[4] + "\r\n");

            double[][] SaveArray = new double[Convert.ToInt32(list.LongCount())][];
            SaveArray[0] = list.Select(P => P.X).ToArray();
            SaveArray[1] = list.Select(P => P.Y).ToArray();

            for (int j = 0; j < SaveArray.Length; j++)
            {
                string Reading = SaveArray[0][j].ToString() + "\t" + SaveArray[1][j] + "\r\n";
                File.AppendAllText(FileLocation, Reading);
            }
        }