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); }
public MobilityData(SpectrumList spectrumList, double scanTime, int startIndex, int endIndex) : this() { SpectrumList = spectrumList; ScanTime = scanTime; StartIndex = startIndex; EndIndex = endIndex; }
public SpectrumList GetProcessingSpectrumList( SpectrumList spectrumList ) { foreach( IProcessing item in ProcessingList ) { if( item.Enabled ) spectrumList = item.ProcessList( spectrumList ); } return spectrumList; }
public SpectrumList_ECD_ETD_PrecursorFilter(SpectrumList inner) : base(inner) { ProcessingMethod method = new ProcessingMethod(); method.order = this.dataProcessing().processingMethods.Count; method.set(CVID.MS_charge_stripping); this.dataProcessing().processingMethods.Add(method); }
public MassSpectrum GetMassSpectrum(MassSpectrum metaSpectrum, SpectrumList spectrumList) { MassSpectrum spectrum = new MassSpectrum(metaSpectrum, spectrumList.spectrum(metaSpectrum.Index, true)); //MassSpectrum realMetaSpectrum = ( metaSpectrum.Tag as DataGridViewRow ).Tag as MassSpectrum; //realMetaSpectrum.Element.dataProcessing = spectrum.Element.dataProcessing; //realMetaSpectrum.Element.defaultArrayLength = spectrum.Element.defaultArrayLength; return(spectrum); }
public MassSpectrum(ManagedDataSource source, int index, SpectrumList spectrumList) { this.source = source; this.spectrumList = spectrumList; this.index = index; //element = spectrum; //using( Spectrum element = Element ) { id = Element.id; } }
public SpectrumList GetProcessingSpectrumList(SpectrumList spectrumList) { foreach (IProcessing item in ProcessingList) { if (item.Enabled) { spectrumList = item.ProcessList(spectrumList); } } return(spectrumList); }
public MassSpectrum(ManagedDataSource source, int index, SpectrumList spectrumList) { this.source = source; this.spectrumList = spectrumList; this.index = index; //element = spectrum; //using( Spectrum element = Element ) { id = Element.id; AbbreviatedId = pwiz.CLI.msdata.id.abbreviate(id); } }
public TextureExportPreview(SpectrumList specList_) { InitializeComponent(); pGridExport.PropertyValueChanged += new PropertyValueChangedEventHandler(pGridExport_PropertyValueChanged); specList = specList_; export = new SpectraTextureIO(specList); sfDlg.Filter = export.Extensions; pGridExport.SelectedObject = export; RefreshPropertyGrid(); }
protected void readVendorFile() { jobInfo.log("Prepare to Parse Vendor File", "Prepare"); msd = new MSDataFile(jobInfo.inputFilePath); jobInfo.log("Adapting Vendor File API", "Adapting"); List <string> filter = new List <string>(); SpectrumListFactory.wrap(msd, filter); //这一步操作可以帮助加快Wiff文件的初始化速度 spectrumList = msd.run.spectrumList; if (spectrumList == null || spectrumList.empty()) { jobInfo.logError("No Spectrums Found"); } else { jobInfo.log("Adapting Finished"); } if (jobInfo.format.Equals("WIFF")) { FileInfo file1 = new FileInfo(jobInfo.inputFilePath); if (file1.Exists) { fileSize += file1.Length; } FileInfo file2 = new FileInfo(jobInfo.inputFilePath + ".mtd"); if (file2.Exists) { fileSize += file2.Length; } FileInfo file3 = new FileInfo(jobInfo.inputFilePath + ".scan"); if (file3.Exists) { fileSize += file3.Length; } } if (jobInfo.format.Equals("RAW")) { FileInfo file1 = new FileInfo(jobInfo.inputFilePath); if (file1.Exists) { fileSize += file1.Length; } } }
public void UpdateRow(int rowIndex, SpectrumList spectrumList) { SpectrumDataSet.SpectrumTableRow row = (spectraSource[rowIndex] as DataRowView).Row as SpectrumDataSet.SpectrumTableRow; if (spectrumList != null) { this.spectrumList[row.Index].SpectrumList = spectrumList; updateRow(row, this.spectrumList[row.Index]); //dp = rowSpectrum.DataProcessing; //row.Tag = rowSpectrum = new MassSpectrum( rowSpectrum, s ); //rowSpectrum.DataProcessing = dp; } else { updateRow(row, this.spectrumList[row.Index]); //s = rowSpectrum.Element; //dp = rowSpectrum.DataProcessing; } }
public MassSpectrum GetMassSpectrum(object idOrIndex) { int index = -1; if (idOrIndex is int) { index = (int)idOrIndex; } else if (idOrIndex is string) { SpectrumList sl = source.MSDataFile.run.spectrumList; int findIndex = sl.find(idOrIndex as string); if (findIndex != sl.size()) { index = findIndex; } } return(GetMassSpectrum(index, source.MSDataFile.run.spectrumList)); }
public override void ReadFromDisk() { SpectrumList lSpectra = null; TextReader tr = new StreamReader(fname); try { XmlSerializer xs = new XmlSerializer(typeof(SpectrumList)); lSpectra = (SpectrumList)xs.Deserialize(tr); spectra = new SpectrumList(lSpectra); } catch (Exception e) { Console.WriteLine("Failed to deserialize. Reason: " + e.Message); } finally { tr.Close(); } }
public override void ReadFromDisk() { SpectrumList lSpectra = null; FileStream fs = new FileStream(fname, FileMode.Open); try { BinaryFormatter b = new BinaryFormatter(); lSpectra = (SpectrumList)b.Deserialize(fs); spectra = new SpectrumList(lSpectra); } catch (SerializationException e) { Console.WriteLine("Failed to deserialize. Reason: " + e.Message); throw; } finally { fs.Close(); } }
public ParseSpectraFile(string mzmlPath, HashSet <int> scanNumSet, string ext) { int currentScanNum = -1; try { MSDataFile msd = new MSDataFile(mzmlPath); SpectrumList spectrumList = msd.run.spectrumList; for (int i = 0; i < spectrumList.size(); ++i) { Spectrum spectrum = spectrumList.spectrum(i, true); if (int.Parse(spectrum.cvParams[0].value) == 2) { Match match = scanNumPattern.Match(spectrum.id); currentScanNum = int.Parse(match.Groups[1].Value); if (scanNumSet.Contains(currentScanNum)) { MZIntensityPairList mzIntensityPairs = new MZIntensityPairList(); spectrum.getMZIntensityPairs(ref mzIntensityPairs); Dictionary <float, int> originalPeakList = new Dictionary <float, int>(mzIntensityPairs.Count); foreach (MZIntensityPair mzIntensity in mzIntensityPairs) { originalPeakList[(float)mzIntensity.mz] = (int)mzIntensity.intensity; } spectraMap[currentScanNum] = originalPeakList; } } } } catch (Exception ex) { MessageBox.Show(ex.Message + ": " + currentScanNum, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
public MassSpectrum GetMassSpectrum( int index, SpectrumList spectrumList ) { return new MassSpectrum( this, index, spectrumList ); }
public Tuple <List <Point3D>, BoundingBox> Get3dSpectrum() { var result = new Tuple <List <Point3D>, BoundingBox>(new List <Point3D>(), new BoundingBox { MinX = Double.MaxValue, MaxX = Double.MinValue, MinY = Double.MaxValue, MaxY = Double.MinValue }); var bounds = result.Item2; if (StartIndex == EndIndex) { var s = SpectrumList.spectrum(StartIndex, true); var mzArray = s.getMZArray().data.Storage(); var intensityArray = s.getIntensityArray().data.Storage(); var mobilityArray = s.GetIonMobilityArray(); if (mobilityArray == null) { throw new NullReferenceException("mobilityBDA"); } for (int j = 0, end = mzArray.Length; j < end; ++j) { double mz = mzArray[j]; double intensity = intensityArray[j]; double mobility = mobilityArray[j]; bounds.MinX = Math.Min(bounds.MinX, mz); bounds.MinY = Math.Min(bounds.MinY, mobility); bounds.MaxX = Math.Max(bounds.MaxX, mz); bounds.MaxY = Math.Max(bounds.MaxY, mobility); result.Item1.Add(new Point3D(mz, mobility, intensity)); } } else { for (int i = StartIndex, end = EndIndex; i <= end; ++i) { var s = SpectrumList.spectrum(i, true); var mzArray = s.getMZArray().data.Storage(); var intensityArray = s.getIntensityArray().data.Storage(); var mobilityArray = s.GetIonMobilityArray(); for (int j = 0; j < mzArray.Length; ++j) { double mz = mzArray[j]; double intensity = intensityArray[j]; double mobility = mobilityArray?.ElementAt(j) ?? (double)s.scanList.scans[0].cvParamChild(CVID.MS_ion_mobility_attribute).value; bounds.MinX = Math.Min(bounds.MinX, mz); bounds.MinY = Math.Min(bounds.MinY, mobility); bounds.MaxX = Math.Max(bounds.MaxX, mz); bounds.MaxY = Math.Max(bounds.MaxY, mobility); result.Item1.Add(new Point3D(mz, mobility, intensity)); } } } return(result); }
public MassSpectrum GetMassSpectrum(int index, SpectrumList spectrumList) { return(new MassSpectrum(this, index, spectrumList)); }
private static bool HasSrmSpectraInList(SpectrumList spectrumList) { if (spectrumList == null || spectrumList.size() == 0) return false; // If the first spectrum is not SRM, the others will not be either using (var spectrum = spectrumList.spectrum(0, false)) { return IsSrmSpectrum(spectrum); } }
public MassSpectrum GetMassSpectrum( MassSpectrum metaSpectrum, SpectrumList spectrumList ) { MassSpectrum spectrum = new MassSpectrum( this, spectrumList.spectrum( metaSpectrum.Index, true ) ); spectrum.Tag = metaSpectrum.Tag; return spectrum; }
public MassSpectrum GetMassSpectrum( int index, bool getBinaryData, SpectrumList spectrumList ) { return new MassSpectrum( this, spectrumList.spectrum( index, getBinaryData ) ); }
public SpectraDiskIO(SpectrumList specList) { spectra = specList; }
public SpectraDiskIO() { spectra = new SpectrumList(); }
private void init() { spectra = new SpectrumList(); categories = new Hashtable(); keywords = new Hashtable(); imagesSmall = new ImageList(); imagesSmall.ImageSize = imageSizeSmall; imagesLarge = new ImageList(); imagesLarge.ImageSize = imageSizeLarge; specDrawer = new SpectrumPainter(); }
public SpectrumList Category(String category) { SpectrumList sl = null; if (categories.ContainsKey(category)) { sl = new SpectrumList(); sl.Category = category; foreach (int idx in ((ArrayList) categories[category])) { sl.Add(spectra[idx]); } } return sl; }
public SpectraBinIO(SpectrumList specList) : base(specList) { }
private static bool HasDriftTimeSpectraInList(SpectrumList spectrumList) { if (spectrumList == null || spectrumList.size() == 0) return false; // Assume that if any spectra have drift times, all do using (var spectrum = spectrumList.spectrum(0, false)) { return GetDriftTimeMsec(spectrum).HasValue; } }
public void Dispose() { if (_spectrumList != null) _spectrumList.Dispose(); _spectrumList = null; if (_chromatogramList != null) _chromatogramList.Dispose(); _chromatogramList = null; if (_msDataFile != null) _msDataFile.Dispose(); _msDataFile = null; }
public void UpdateRow( int rowIndex, SpectrumList spectrumList ) { SpectrumDataSet.SpectrumTableRow row = ( spectraSource[rowIndex] as DataRowView ).Row as SpectrumDataSet.SpectrumTableRow; if( spectrumList != null ) { this.spectrumList[row.Index].SpectrumList = spectrumList; updateRow( row, this.spectrumList[row.Index] ); //dp = rowSpectrum.DataProcessing; //row.Tag = rowSpectrum = new MassSpectrum( rowSpectrum, s ); //rowSpectrum.DataProcessing = dp; } else { updateRow( row, this.spectrumList[row.Index] ); //s = rowSpectrum.Element; //dp = rowSpectrum.DataProcessing; } }
public SpectraXMLIO(SpectrumList specList) : base(specList) { }
private void init() { collection = new SpectrumList(); specPainter = new SpectrumPainter(); View = View.LargeIcon; Columns.Add("Name"); Columns.Add("Minlambda"); Columns.Add("MaxLambda"); Columns.Add("Points"); Columns.Add("Interpolation"); Columns.Add("BaseIntensity"); Columns.Add("MinIntensity"); Columns.Add("MaxIntensity"); SmallImageList = new ImageList(); LargeImageList = new ImageList(); initImageLists(); AllowDrop = true; }
private void CollectionOpen() { ofDlg.Filter = spectraXMLIO.Extensions + "|" + spectraBinIO.Extensions; SpectraDiskIO Reader = null; if (ofDlg.ShowDialog() == DialogResult.OK) { if (ofDlg.FilterIndex == 1) Reader = spectraXMLIO; if (ofDlg.FilterIndex == 2) Reader = spectraBinIO; if (Reader != null) { Reader.FileName = ofDlg.FileName; Reader.ReadFromDisk(); Collection = Reader.Spectra; collectionFileName = sfDlg.FileName; } } }
//TODO private void SetCollection(SpectrumList specList) { collection = specList; if (collection != null) { collection.OnSpectrumAdded += new SpectrumList.SpectrumAdded(collection_OnSpectrumAdded); collection.OnSpectrumDeleted += new SpectrumList.SpectrumDeleted(collection_OnSpectrumDeleted); } InvalidateCollection(); }
public SpectraTextureIO(SpectrumList specList) : base(specList) { init(); }
public MassSpectrum GetMassSpectrum( MassSpectrum metaSpectrum, SpectrumList spectrumList ) { MassSpectrum spectrum = new MassSpectrum( metaSpectrum, spectrumList.spectrum( metaSpectrum.Index, true ) ); //MassSpectrum realMetaSpectrum = ( metaSpectrum.Tag as DataGridViewRow ).Tag as MassSpectrum; //realMetaSpectrum.Element.dataProcessing = spectrum.Element.dataProcessing; //realMetaSpectrum.Element.defaultArrayLength = spectrum.Element.defaultArrayLength; return spectrum; }
private void CollectionNew() { Collection = new SpectrumList(); }