コード例 #1
0
ファイル: SpectrumProcessingForm.cs プロジェクト: zrolfs/pwiz
        public void UpdateProcessing(MassSpectrum spectrum)
        {
            int newVirtualSize = spectrum.ProcessingList.Count;

            if (globalOverrideMode == OverrideMode.Replace)
            {
                newVirtualSize = globalProcessingListOverride.Count;
            }
            else
            {
                newVirtualSize += globalProcessingListOverride.Count;
            }

            if (processingListView.VirtualListSize != newVirtualSize)
            {
                processingListView.VirtualListSize = newVirtualSize;
                selectIndex(newVirtualSize - 1);
            }

            if (currentSpectrum != spectrum)
            {
                currentSpectrum = spectrum;
                Text            = TabText = "Processing for spectrum " + spectrum.Id;
                runOverrideToolStripButton.Text = "Override " + spectrum.Source.Source.Name + " Processing";
                processingListView_SelectedIndexChanged(this, EventArgs.Empty);
            }

            processingListView.Refresh();
        }
コード例 #2
0
        public void UpdateAnnotations(MassSpectrum spectrum)
        {
            if (currentSpectrum != spectrum)
            {
                currentSpectrum = spectrum;
                Text            = TabText = "Annotations for spectrum " + spectrum.Title;
                runOverrideToolStripButton.Text = "Override " + spectrum.Source.Source.Name + " Annotations";

                annotationsListView.VirtualListSize = spectrum.AnnotationList.Count;

                if (spectrum.AnnotationList.Count > 0)
                {
                    selectIndex(spectrum.AnnotationList.Count - 1);
                }
                else
                {
                    splitContainer.Panel2.Controls.Clear();
                    lastSelectedAnnotation = null;
                    clearing = true;
                    annotationsListView.SelectedIndices.Clear();
                    clearing = false;
                }
            }

            annotationsListView.Refresh();
        }
コード例 #3
0
ファイル: SpectrumProcessingForm.cs プロジェクト: zrolfs/pwiz
        public SpectrumList GetProcessingSpectrumList(MassSpectrum spectrum, SpectrumList spectrumList)
        {
            IList <IProcessing> usedProcessingList = spectrum.ProcessingList.ToList();

            if (globalProcessingListOverride.Any())
            {
                if (replaceToolStripMenuItem.Checked)
                {
                    usedProcessingList = globalProcessingListOverride;
                }
                else if (beforeToolStripMenuItem.Checked)
                {
                    usedProcessingList.InsertRange(0, globalProcessingListOverride);
                }
                else if (afterToolStripMenuItem.Checked)
                {
                    usedProcessingList.AddRange(globalProcessingListOverride);
                }
            }
            else if (processingListOverrideBySource.ContainsKey(spectrum.Source))
            {
                usedProcessingList = processingListOverrideBySource[spectrum.Source];
            }

            foreach (IProcessing item in usedProcessingList)
            {
                if (item.Enabled)
                {
                    spectrumList = item.ProcessList(spectrumList);
                }
            }
            return(spectrumList);
        }
コード例 #4
0
ファイル: SpectrumListForm.cs プロジェクト: zjjyyang/ftdr
        public void Add(MassSpectrum spectrum)
        {
            SpectrumDataSet.SpectrumTableRow row = spectrumDataSet.SpectrumTable.NewSpectrumTableRow();
            row.Id = spectrum.Id;

            if (nativeIdFormat != CVID.CVID_Unknown)
            {
                gridView.Columns["Id"].Visible = false;

                string[] nameValuePairs = spectrum.Id.Split(" ".ToCharArray());
                foreach (string nvp in nameValuePairs)
                {
                    string[] nameValuePair = nvp.Split("=".ToCharArray());
                    row[nameValuePair[0]] = nameValuePair[1];
                }
            }

            row.Index = spectrum.Index;
            updateRow(row, spectrum);
            spectrumDataSet.SpectrumTable.AddSpectrumTableRow(row);

            //int rowIndex = gridView.Rows.Add();
            //gridView.Rows[rowIndex].Tag = spectrum;
            spectrum.Tag = this;

            if (spectrum.Element.spotID.Length > 0)
            {
                gridView.Columns["SpotId"].Visible = true;
            }

            //UpdateRow( rowIndex );
        }
コード例 #5
0
 internal SpectrumListCellDoubleClickEventArgs(SpectrumListForm sender, DataGridViewCellMouseEventArgs e)
     : base(e.ColumnIndex, e.RowIndex, e.X, e.Y, e)
 {
     if (e.RowIndex > -1 && e.RowIndex < sender.GridView.RowCount)
     {
         spectrum = sender.GetSpectrum(e.RowIndex);
     }
 }
コード例 #6
0
        public void Add(MassSpectrum spectrum)
        {
            SpectrumDataSet.SpectrumTableRow row = spectrumDataSet.SpectrumTable.NewSpectrumTableRow();
            row.Id = spectrum.Id;

            if (nativeIdFormat != CVID.CVID_Unknown)
            {
                gridView.Columns["Id"].Visible = false;

                // guard against case where input is mzXML which
                // is identified as, say, Agilent-derived, but
                // which uses "scan" (as mzXML must) instead
                // of the Agilent "scanID" (as this mzML-centric code expects)
                bool foundit = false;

                string[] nameValuePairs = spectrum.Id.Split(' ');
                foreach (string nvp in nameValuePairs)
                {
                    string[] nameValuePair = nvp.Split('=');
                    if (row.Table.Columns.Contains(nameValuePair[0]))
                    {
                        row[nameValuePair[0]] = nameValuePair[1];
                        foundit = true;
                    }
                }
                if (!foundit)
                {
                    // mismatch between nativeID format and actual (probably mzXML) format
                    // better to show an ill-fit match - eg "scan" (mzXML) and "scanID" (Agilent)
                    // than no info at all
                    string   nativeIdDefinition = new CVTermInfo(nativeIdFormat).def;
                    string[] idPair             = nativeIdDefinition.Split('=');
                    if (row.Table.Columns.Contains(idPair[0]))
                    {
                        string[] valPair = spectrum.Id.Split('=');
                        row[idPair[0]] = (valPair.Length > 1) ? valPair[1] : spectrum.Id;
                        foundit        = true;
                    }
                }
            }

            row.Index = spectrum.Index;
            updateRow(row, spectrum);
            spectrumDataSet.SpectrumTable.AddSpectrumTableRow(row);

            //int rowIndex = gridView.Rows.Add();
            //gridView.Rows[rowIndex].Tag = spectrum;
            spectrum.Tag = this;

            if (spectrum.Element.spotID.Length > 0)
            {
                gridView.Columns["SpotId"].Visible = true;
            }

            //UpdateRow( rowIndex );
        }
コード例 #7
0
ファイル: Types.cs プロジェクト: tomas-pluskal/pwiz
 public MassSpectrum(MassSpectrum metaSpectrum, pwiz.CLI.msdata.Spectrum spectrum)
 {
     source             = metaSpectrum.source;
     spectrumList       = metaSpectrum.spectrumList;
     index              = metaSpectrum.index;
     Tag                = metaSpectrum.Tag;
     AnnotationSettings = metaSpectrum.AnnotationSettings;
     //element = spectrum;
     id = metaSpectrum.id;
 }
コード例 #8
0
        public DataPointTableForm(GraphItem graphItem)
        {
            InitializeComponent();

            item     = graphItem;
            spectrum = item as MassSpectrum;
            dataGridView.VirtualMode = true;
            //dataGridView.Rows.Insert( 0, pointList.Count );

            Refresh();

            if (mobilityArray != null)
            {
                dataGridView.Columns.Add("mobility", "Ion Mobility");
            }
        }
コード例 #9
0
        public void UpdateAnnotations(MassSpectrum spectrum)
        {
            if (currentSpectrum != spectrum)
            {
                currentSpectrum = spectrum;
                Text            = TabText = "Annotations for spectrum " + spectrum.Id;
                runOverrideToolStripButton.Text = "Override " + spectrum.Source.Source.Name + " Annotations";

                annotationsListView.VirtualListSize = spectrum.AnnotationList.Count;

                if (spectrum.AnnotationList.Count > 0)
                {
                    selectIndex(spectrum.AnnotationList.Count - 1);
                }
            }

            annotationsListView.Refresh();
        }
コード例 #10
0
        public void UpdateProcessing(MassSpectrum spectrum)
        {
            if (processingListView.VirtualListSize != spectrum.ProcessingList.Count)
            {
                processingListView.VirtualListSize = spectrum.ProcessingList.Count;
                selectIndex(spectrum.ProcessingList.Count - 1);
            }

            if (currentSpectrum != spectrum)
            {
                currentSpectrum = spectrum;
                Text            = TabText = "Processing for spectrum " + spectrum.Id;
                runOverrideToolStripButton.Text = "Override " + spectrum.Source.Source.Name + " Processing";
                processingListView_SelectedIndexChanged(this, EventArgs.Empty);
            }

            processingListView.Refresh();
        }
コード例 #11
0
        private void gridView_ShowCellToolTip(DataGridViewCell cell)
        {
            MassSpectrum spectrum = cell.OwningRow.Tag as MassSpectrum;
            Spectrum     s        = spectrum.Element;

            TreeViewForm treeViewForm = new TreeViewForm(spectrum);
            TreeView     tv           = treeViewForm.TreeView;

            if (gridView.Columns[cell.ColumnIndex].Name == "PrecursorInfo")
            {
                treeViewForm.Text = "Precursor Details";
                if (s.precursors.Count == 0)
                {
                    tv.Nodes.Add("No precursor information available.");
                }
                else
                {
                    foreach (Precursor p in s.precursors)
                    {
                        string pNodeText = "Precursor scan";
                        if (p.sourceFile != null && p.externalSpectrumID.Length > 0)
                        {
                            pNodeText += String.Format(": {0}:{1}", p.sourceFile.name, p.externalSpectrumID);
                        }
                        else if (p.spectrumID.Length > 0)
                        {
                            pNodeText += String.Format(": {0}", p.spectrumID);
                        }

                        TreeNode pNode = tv.Nodes.Add(pNodeText);
                        addParamsToTreeNode(p as ParamContainer, pNode);

                        if (p.selectedIons.Count == 0)
                        {
                            pNode.Nodes.Add("No selected ion list available.");
                        }
                        else
                        {
                            foreach (SelectedIon si in p.selectedIons)
                            {
                                TreeNode siNode = pNode.Nodes.Add("Selected ion");
                                //siNode.ToolTipText = new CVTermInfo(CVID.MS_selected_ion); // not yet in CV
                                addParamsToTreeNode(si as ParamContainer, siNode);
                            }
                        }

                        if (p.activation.empty())
                        {
                            pNode.Nodes.Add("No activation details available.");
                        }
                        else
                        {
                            TreeNode actNode = pNode.Nodes.Add("Activation");
                            addParamsToTreeNode(p.activation as ParamContainer, actNode);
                        }

                        if (p.isolationWindow.empty())
                        {
                            pNode.Nodes.Add("No isolation window details available.");
                        }
                        else
                        {
                            TreeNode iwNode = pNode.Nodes.Add("Isolation Window");
                            addParamsToTreeNode(p.isolationWindow as ParamContainer, iwNode);
                        }
                    }
                }
            }
            else if (gridView.Columns[cell.ColumnIndex].Name == "ScanInfo")
            {
                treeViewForm.Text = "Scan Configuration Details";
                if (s.scanList.empty())
                {
                    tv.Nodes.Add("No scan details available.");
                }
                else
                {
                    TreeNode slNode = tv.Nodes.Add("Scan List");
                    addParamsToTreeNode(s.scanList as ParamContainer, slNode);

                    foreach (Scan scan in s.scanList.scans)
                    {
                        TreeNode scanNode = slNode.Nodes.Add("Acquisition");
                        addParamsToTreeNode(scan as ParamContainer, scanNode);

                        foreach (ScanWindow sw in scan.scanWindows)
                        {
                            TreeNode swNode = scanNode.Nodes.Add("Scan Window");
                            addParamsToTreeNode(sw as ParamContainer, swNode);
                        }
                    }
                }
            }
            else if (gridView.Columns[cell.ColumnIndex].Name == "InstrumentConfigurationID")
            {
                treeViewForm.Text = "Instrument Configuration Details";
                InstrumentConfiguration ic = s.scanList.scans[0].instrumentConfiguration;
                if (ic == null || ic.empty())
                {
                    tv.Nodes.Add("No instrument configuration details available.");
                }
                else
                {
                    TreeNode icNode = tv.Nodes.Add(String.Format("Instrument Configuration ({0})", ic.id));
                    addParamsToTreeNode(ic as ParamContainer, icNode);

                    if (ic.componentList.Count == 0)
                    {
                        icNode.Nodes.Add("No component list available.");
                    }
                    else
                    {
                        TreeNode clNode = icNode.Nodes.Add("Component List");
                        foreach (pwiz.CLI.msdata.Component c in ic.componentList)
                        {
                            string cNodeText;
                            switch (c.type)
                            {
                            case ComponentType.ComponentType_Source:
                                cNodeText = "Source";
                                break;

                            case ComponentType.ComponentType_Analyzer:
                                cNodeText = "Analyzer";
                                break;

                            default:
                            case ComponentType.ComponentType_Detector:
                                cNodeText = "Detector";
                                break;
                            }
                            TreeNode cNode = clNode.Nodes.Add(cNodeText);
                            addParamsToTreeNode(c as ParamContainer, cNode);
                        }
                    }

                    Software sw = ic.software;
                    if (sw == null || sw.empty())
                    {
                        icNode.Nodes.Add("No software details available.");
                    }
                    else
                    {
                        TreeNode swNode        = icNode.Nodes.Add(String.Format("Software ({0})", sw.id));
                        CVParam  softwareParam = sw.cvParamChild(CVID.MS_software);
                        TreeNode swNameNode    = swNode.Nodes.Add("Name: " + softwareParam.name);
                        swNameNode.ToolTipText = new CVTermInfo(softwareParam.cvid).def;
                        swNode.Nodes.Add("Version: " + sw.version);
                    }
                }
            }
            else if (gridView.Columns[cell.ColumnIndex].Name == "DataProcessing")
            {
                treeViewForm.Text = "Data Processing Details";
                DataProcessing dp = s.dataProcessing;
                if (dp == null || dp.empty())
                {
                    tv.Nodes.Add("No data processing details available.");
                }
                else
                {
                    TreeNode dpNode = tv.Nodes.Add(String.Format("Data Processing ({0})", dp.id));

                    if (dp.processingMethods.Count == 0)
                    {
                        dpNode.Nodes.Add("No component list available.");
                    }
                    else
                    {
                        TreeNode pmNode = dpNode.Nodes.Add("Processing Methods");
                        foreach (ProcessingMethod pm in dp.processingMethods)
                        {
                            addParamsToTreeNode(pm as ParamContainer, pmNode);
                        }
                    }
                }
            }
            else
            {
                return;
            }

            tv.ExpandAll();
            treeViewForm.StartPosition = FormStartPosition.CenterParent;
            treeViewForm.AutoSize      = true;
            //treeViewForm.DoAutoSize();
            treeViewForm.Show(this.DockPanel);
            //leaveTimer.Start();
            this.Focus();
        }
コード例 #12
0
 public int IndexOf(MassSpectrum spectrum)
 {
     return(spectraSource.Find("Id", spectrum.Id));
 }
コード例 #13
0
        public void updateRow(SpectrumDataSet.SpectrumTableRow row, MassSpectrum spectrum)
        {
            spectrumList[spectrum.Index] = spectrum;

            Spectrum                s    = spectrum.Element; //GetElement(false);
            DataProcessing          dp   = spectrum.DataProcessing;
            Scan                    scan = null;
            InstrumentConfiguration ic   = null;

            if (s.scanList.scans.Count > 0)
            {
                scan = s.scanList.scans[0];
                ic   = scan.instrumentConfiguration;
            }

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

            CVParam param;

            param       = s.cvParam(CVID.MS_ms_level);
            row.MsLevel = !param.empty() ? (int)param.value : 0;

            param = scan != null?scan.cvParam(CVID.MS_scan_start_time) : new CVParam();

            row.ScanTime = !param.empty() ? (double)param.value : 0;

            param          = s.cvParam(CVID.MS_base_peak_m_z);
            row.BasePeakMz = !param.empty() ? (double)param.value : 0;

            param = s.cvParam(CVID.MS_base_peak_intensity);
            row.BasePeakIntensity = !param.empty() ? (double)param.value : 0;

            param = s.cvParam(CVID.MS_total_ion_current);
            row.TotalIonCurrent = !param.empty() ? (double)param.value : 0;

            var precursorInfo    = new StringBuilder();
            var isolationWindows = new StringBuilder();

            if (row.MsLevel == 1 || s.precursors.Count == 0)
            {
                precursorInfo.Append("n/a");
                isolationWindows.Append("n/a");
            }
            else
            {
                foreach (Precursor p in s.precursors)
                {
                    foreach (SelectedIon si in p.selectedIons)
                    {
                        if (precursorInfo.Length > 0)
                        {
                            precursorInfo.Append(",");
                        }
                        precursorInfo.AppendFormat("{0:G8}", (double)si.cvParam(CVID.MS_selected_ion_m_z).value);
                    }

                    var     iw = p.isolationWindow;
                    CVParam isolationTarget = iw.cvParam(CVID.MS_isolation_window_target_m_z);
                    if (!isolationTarget.empty())
                    {
                        double iwMz = (double)isolationTarget.value;

                        if (isolationWindows.Length > 0)
                        {
                            isolationWindows.Append(",");
                        }

                        CVParam lowerOffset = iw.cvParam(CVID.MS_isolation_window_lower_offset);
                        CVParam upperOffset = iw.cvParam(CVID.MS_isolation_window_upper_offset);
                        if (lowerOffset.empty() || upperOffset.empty())
                        {
                            isolationWindows.AppendFormat("{0:G8}", iwMz);
                        }
                        else
                        {
                            isolationWindows.AppendFormat("[{0:G8}-{1:G8}]", iwMz - (double)lowerOffset.value, iwMz + (double)upperOffset.value);
                        }
                    }
                }
            }

            if (precursorInfo.Length == 0)
            {
                precursorInfo.Append("unknown");
            }
            row.PrecursorInfo = precursorInfo.ToString();

            if (isolationWindows.Length == 0)
            {
                isolationWindows.Append("unknown");
            }
            row.IsolationWindows = isolationWindows.ToString();

            StringBuilder scanInfo = new StringBuilder();

            foreach (Scan scan2 in s.scanList.scans)
            {
                if (scan2.scanWindows.Count > 0)
                {
                    foreach (ScanWindow sw in scan2.scanWindows)
                    {
                        if (scanInfo.Length > 0)
                        {
                            scanInfo.Append(",");
                        }
                        scanInfo.AppendFormat("[{0:G8}-{1:G8}]",
                                              (double)sw.cvParam(CVID.MS_scan_window_lower_limit).value,
                                              (double)sw.cvParam(CVID.MS_scan_window_upper_limit).value);
                    }
                }
            }

            if (scanInfo.Length == 0)
            {
                scanInfo.Append("unknown");
            }
            row.ScanInfo = scanInfo.ToString();

            row.IonMobility = scan != null ? (double)scan.cvParam(CVID.MS_ion_mobility_drift_time).value : 0;
            if (row.IonMobility == 0 && scan != null)
            {
                row.IonMobility = (double)scan.cvParam(CVID.MS_inverse_reduced_ion_mobility).value;
                if (row.IonMobility == 0)
                {
                    // Early version of drift time info, before official CV params
                    var userparam = scan.userParam("drift time");
                    if (!userparam.empty())
                    {
                        row.IonMobility = userparam.timeInSeconds() * 1000.0;
                    }
                }
            }
            row.SpotId       = s.spotID;
            row.SpectrumType = s.cvParamChild(CVID.MS_spectrum_type).name;
            row.DataPoints   = s.defaultArrayLength;
            row.IcId         = (ic == null || ic.id.Length == 0 ? "unknown" : ic.id);
            row.DpId         = (dp == null || dp.id.Length == 0 ? "unknown" : dp.id);
        }
コード例 #14
0
        public void updateRow(SpectrumDataSet.SpectrumTableRow row, MassSpectrum spectrum)
        {
            spectrumList[spectrum.Index] = spectrum;

            Spectrum                s    = spectrum.Element; //GetElement(false);
            DataProcessing          dp   = spectrum.DataProcessing;
            Scan                    scan = null;
            InstrumentConfiguration ic   = null;

            if (s.scanList.scans.Count > 0)
            {
                scan = s.scanList.scans[0];
                ic   = scan.instrumentConfiguration;
            }

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

            CVParam param;

            param       = s.cvParam(CVID.MS_ms_level);
            row.MsLevel = !param.empty() ? (int)param.value : 0;

            param = scan != null?scan.cvParam(CVID.MS_scan_start_time) : new CVParam();

            row.ScanTime = !param.empty() ? (double)param.value : 0;

            param          = s.cvParam(CVID.MS_base_peak_m_z);
            row.BasePeakMz = !param.empty() ? (double)param.value : 0;

            param = s.cvParam(CVID.MS_base_peak_intensity);
            row.BasePeakIntensity = !param.empty() ? (double)param.value : 0;

            param = s.cvParam(CVID.MS_total_ion_current);
            row.TotalIonCurrent = !param.empty() ? (double)param.value : 0;

            StringBuilder precursorInfo = new StringBuilder();

            if (row.MsLevel == 1 || s.precursors.Count == 0)
            {
                precursorInfo.Append("n/a");
            }
            else
            {
                foreach (Precursor p in s.precursors)
                {
                    foreach (SelectedIon si in p.selectedIons)
                    {
                        if (precursorInfo.Length > 0)
                        {
                            precursorInfo.Append(",");
                        }
                        precursorInfo.Append((double)si.cvParam(CVID.MS_selected_ion_m_z).value);
                    }
                }
            }

            if (precursorInfo.Length == 0)
            {
                precursorInfo.Append("unknown");
            }
            row.PrecursorInfo = precursorInfo.ToString();

            StringBuilder scanInfo = new StringBuilder();

            foreach (Scan scan2 in s.scanList.scans)
            {
                if (scan2.scanWindows.Count > 0)
                {
                    foreach (ScanWindow sw in scan2.scanWindows)
                    {
                        if (scanInfo.Length > 0)
                        {
                            scanInfo.Append(",");
                        }
                        scanInfo.AppendFormat("[{0}-{1}]",
                                              (double)sw.cvParam(CVID.MS_scan_window_lower_limit).value,
                                              (double)sw.cvParam(CVID.MS_scan_window_upper_limit).value);
                    }
                }
            }

            if (scanInfo.Length == 0)
            {
                scanInfo.Append("unknown");
            }
            row.ScanInfo = scanInfo.ToString();

            row.SpotId       = s.spotID;
            row.SpectrumType = s.cvParamChild(CVID.MS_spectrum_type).name;
            row.DataPoints   = s.defaultArrayLength;
            row.IcId         = (ic == null || ic.id.Length == 0 ? "unknown" : ic.id);
            row.DpId         = (dp == null || dp.id.Length == 0 ? "unknown" : dp.id);
        }
コード例 #15
0
ファイル: SpectrumProcessingForm.cs プロジェクト: zrolfs/pwiz
 public ProcessingChangedEventArgs(Scope scope, MassSpectrum spectrum)
 {
     ChangeScope = scope;
     Spectrum    = spectrum;
 }