Exemplo n.º 1
0
 public Chromatogram(Chromatogram metaChromatogram, pwiz.CLI.msdata.Chromatogram chromatogram)
 {
     source = metaChromatogram.source;
     this.chromatogramList = metaChromatogram.chromatogramList;
     this.index            = index;
     Tag = metaChromatogram.Tag;
     AnnotationSettings = metaChromatogram.AnnotationSettings;
     //element = chromatogram;
     id = Element.id;
 }
Exemplo n.º 2
0
        public void updateRow(ChromatogramDataSet.ChromatogramTableRow row, Chromatogram chromatogram)
        {
            chromatogramList[chromatogram.Index] = chromatogram;

            pwiz.CLI.msdata.Chromatogram c = chromatogram.Element;
            DataProcessing dp = chromatogram.DataProcessing;

            if (dp == null)
            {
                dp = c.dataProcessing;
            }

            row.Type       = c.cvParamChild(CVID.MS_chromatogram_type).name;
            row.DataPoints = c.defaultArrayLength;
            row.DpId       = (dp == null || dp.id.Length == 0 ? "unknown" : dp.id);
        }
Exemplo n.º 3
0
        private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            if (listView.SelectedItems.Count > 1)
            {
                List <string> dataSourceList = new List <string>();
                foreach (ListViewItem item in listView.SelectedItems)
                {
                    if (item.SubItems[1].Text != "File Folder")
                    {
                        dataSourceList.Add(String.Format("\"{0}\"", item.SubItems[0].Text));
                    }
                }
                sourcePathTextBox.Text = String.Join(" ", dataSourceList.ToArray());

                ticGraphControl.GraphPane.GraphObjList.Clear();
                ticGraphControl.GraphPane.CurveList.Clear();
                ticGraphControl.Visible = false;
            }
            else if (listView.SelectedItems.Count > 0)
            {
                sourcePathTextBox.Text = listView.SelectedItems[0].SubItems[0].Text;

                ticGraphControl.GraphPane.GraphObjList.Clear();
                ticGraphControl.GraphPane.CurveList.Clear();

                string sourcePath = Path.Combine(CurrentDirectory, sourcePathTextBox.Text);
                string sourceType = getSourceType(sourcePath);
                if (!String.IsNullOrEmpty(sourceType) &&
                    sourceType != "File Folder")
                {
                    using (MSDataFile msData = new MSDataFile(sourcePath))
                        using (ChromatogramList cl = msData.run.chromatogramList)
                        {
                            if (cl != null && !cl.empty() && cl.find("TIC") != cl.size())
                            {
                                ticGraphControl.Visible = true;
                                pwiz.CLI.msdata.Chromatogram tic = cl.chromatogram(cl.find("TIC"), true);
                                Map <double, double>         sortedFullPointList = new Map <double, double>();
                                IList <double> timeList      = tic.binaryDataArrays[0].data;
                                IList <double> intensityList = tic.binaryDataArrays[1].data;
                                int            arrayLength   = timeList.Count;
                                for (int i = 0; i < arrayLength; ++i)
                                {
                                    sortedFullPointList[timeList[i]] = intensityList[i];
                                }
                                ZedGraph.PointPairList points = new ZedGraph.PointPairList(
                                    new List <double>(sortedFullPointList.Keys).ToArray(),
                                    new List <double>(sortedFullPointList.Values).ToArray());
                                ZedGraph.LineItem item = ticGraphControl.GraphPane.AddCurve("TIC", points, Color.Black, ZedGraph.SymbolType.None);
                                item.Line.IsAntiAlias = true;
                                ticGraphControl.AxisChange();
                                ticGraphControl.Refresh();
                            }
                            else
                            {
                                ticGraphControl.Visible = false;
                            }
                        }
                }
                else
                {
                    ticGraphControl.Visible = false;
                }
            }
            else
            {
                sourcePathTextBox.Text = "";
            }
        }
Exemplo n.º 4
0
        private void listView_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
        {
            string sourcePath = null;
            string sourceType = null;
            int    runIndex   = 0;

            if (listView.SelectedItems.Count > 0)
            {
                List <string> dataSourceList = new List <string>();
                foreach (ListViewItem item in listView.SelectedItems)
                {
                    var sourceInfo = item.Tag as SourceInfo;
                    if (sourceInfo != null)
                    {
                        dataSourceList.Add(sourceInfo.path.ToString());
                        sourcePath = sourceInfo.path.Filepath;
                        sourceType = sourceInfo.type;
                        runIndex   = sourceInfo.path.RunIndex;
                    }
                    else
                    {
                        dataSourceList.Add(item.SubItems[0].Text);
                        sourcePath = Path.Combine(CurrentDirectory, sourcePathTextBox.Text);
                        sourceType = getSourceType(sourcePath);
                    }
                }
                sourcePathTextBox.Text = $"\"{String.Join("\" \"", dataSourceList.ToArray())}\"";
            }

            ticGraphControl.GraphPane.GraphObjList.Clear();
            ticGraphControl.GraphPane.CurveList.Clear();
            if (listView.SelectedItems.Count != 1)
            {
                ticGraphControl.Visible = false;
                return;
            }

            if (!String.IsNullOrEmpty(sourceType) &&
                sourceType != "File Folder")
            {
                using (MSData msd = new MSData())
                {
                    ReaderList.FullReaderList.read(sourcePath, msd, runIndex, SpectrumSource.GetReaderConfig());
                    using (ChromatogramList cl = msd.run.chromatogramList)
                    {
                        if (cl != null && !cl.empty() && cl.find("TIC") != cl.size())
                        {
                            ticGraphControl.Visible = true;
                            pwiz.CLI.msdata.Chromatogram tic = cl.chromatogram(cl.find("TIC"), true);
                            Map <double, double>         sortedFullPointList = new Map <double, double>();
                            IList <double> timeList      = tic.binaryDataArrays[0].data;
                            IList <double> intensityList = tic.binaryDataArrays[1].data;
                            int            arrayLength   = timeList.Count;
                            for (int i = 0; i < arrayLength; ++i)
                            {
                                sortedFullPointList[timeList[i]] = intensityList[i];
                            }
                            ZedGraph.PointPairList points = new ZedGraph.PointPairList(
                                new List <double>(sortedFullPointList.Keys).ToArray(),
                                new List <double>(sortedFullPointList.Values).ToArray());
                            ZedGraph.LineItem item = ticGraphControl.GraphPane.AddCurve("TIC", points, Color.Black, ZedGraph.SymbolType.None);
                            item.Line.IsAntiAlias = true;
                            ticGraphControl.AxisChange();
                            ticGraphControl.Refresh();
                        }
                        else
                        {
                            ticGraphControl.Visible = false;
                        }
                    }
                }
            }
            else
            {
                ticGraphControl.Visible = false;
            }
        }