/* + "\t" + scanStatistics.TIC.ToString() + "\t" + scanStatistics.ScanType.ToString() + "\t" + scanStatistics.CycleNumber.ToString() + "\t" + scanStatistics.Frequency.ToString() + "\t" + scanStatistics.HighMass.ToString() + "\t" + scanFilter.IonizationMode.ToString() + "\t" + scanFilter.MSOrder.ToString() + "\t" + scanFilter.MassAnalyzer.ToString() + "\t" + scanFilter.Detector.ToString() + "\t" + scanFilter.Lock.ToString() + "\t"); + + try + { + var reaction0 = scanEvent.GetReaction(0); + file.Write(reaction0.PrecursorMass + "\t" + reaction0.LastPrecursorMass + "\t" + reaction0.CollisionEnergy + "\t" + reaction0.IsolationWidth + ); + } + catch + { + file.Write("NA\tNA\tNA\tNA"); + } + + */ /// <summary> /// write file header (metainfo) into R code /// </summary> public static void PrintHeaderAsRcode(this IRawDataPlus rawFile, string filename) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(filename)) { file.WriteLine("#R\n\n"); file.WriteLine("e$info <- list()\n"); file.WriteLine("e$info$`RAW file` <- '" + Path.GetFileName(rawFile.FileName) + "'"); file.WriteLine("e$info$`RAW file version` <- '" + rawFile.FileHeader.Revision + "'"); file.WriteLine("e$info$`Creation date` <- '" + rawFile.FileHeader.CreationDate + "'"); file.WriteLine("e$info$Operator <- '" + rawFile.FileHeader.WhoCreatedId + "'"); file.WriteLine("e$info$`Number of instruments` <- {0}", rawFile.InstrumentCount); file.WriteLine("e$info$Description <- '" + rawFile.FileHeader.FileDescription + "'"); file.WriteLine("e$info$`Instrument model` <- '{0}'", rawFile.GetInstrumentData().Model); file.WriteLine("e$info$`Instrument name` <- '{0}'", rawFile.GetInstrumentData().Name); file.WriteLine("e$info$`Instrument method` <- '" + rawFile.SampleInformation.InstrumentMethodFile.Replace("\\", "/") + "'"); //file.WriteLine("e$info$`Instrument method` <- '{0}'", rawFile.GetAllInstrumentFriendlyNamesFromInstrumentMethod().Length); file.WriteLine("e$info$`Serial number` <- '{0}'", rawFile.GetInstrumentData().SerialNumber); file.WriteLine("e$info$`Software version` <- '{0}'", rawFile.GetInstrumentData().SoftwareVersion); file.WriteLine("e$info$`Firmware version` <- '{0}'", rawFile.GetInstrumentData().HardwareVersion); file.WriteLine("e$info$Units <- '{0}'", rawFile.GetInstrumentData().Units); file.WriteLine("e$info$`Mass resolution` <- '{0:F3}'", rawFile.RunHeaderEx.MassResolution); file.WriteLine("e$info$`Number of scans` <- {0}", rawFile.RunHeaderEx.SpectraCount); int firstScanNumber = rawFile.RunHeaderEx.FirstSpectrum; int lastScanNumber = rawFile.RunHeaderEx.LastSpectrum; file.WriteLine("e$info$`Number of ms2 scans` <- {0}", Enumerable.Range(1, lastScanNumber - firstScanNumber).Count(x => rawFile.GetFilterForScanNumber(x).ToString().Contains("Full ms2"))); file.WriteLine("e$info$`Scan range` <- c({0}, {1})", firstScanNumber, lastScanNumber); double startTime = rawFile.RunHeaderEx.StartTime; double endTime = rawFile.RunHeaderEx.EndTime; file.WriteLine("e$info$`Time range` <- c({0:F2}, {1:F2})", startTime, endTime); file.WriteLine("e$info$`Mass range` <- c({0:F4}, {1:F4})", rawFile.RunHeaderEx.LowMass, rawFile.RunHeaderEx.HighMass); var firstFilter = rawFile.GetFilterForScanNumber(firstScanNumber); var lastFilter = rawFile.GetFilterForScanNumber(lastScanNumber); int numberFilters = rawFile.GetFilters().Count; file.WriteLine("e$info$`Scan filter (first scan)` <- '{0}'", firstFilter.ToString()); file.WriteLine("e$info$`Scan filter (last scan)` <- '{0}'", lastFilter.ToString()); file.WriteLine("e$info$`Total number of filters` <- '{0}'", numberFilters); file.WriteLine("e$info$`Sample name` <- '{0}' ", rawFile.SampleInformation.SampleName); file.WriteLine("e$info$`Sample id` <- '{0}' ", rawFile.SampleInformation.SampleId); file.WriteLine("e$info$`Sample type` <- '{0}' ", rawFile.SampleInformation.SampleType); file.WriteLine("e$info$`Sample comment` <- '{0}' ", rawFile.SampleInformation.Comment); file.WriteLine("e$info$`Sample vial` <- '{0}' ", rawFile.SampleInformation.Vial); file.WriteLine("e$info$`Sample volume` <- '{0}' ", rawFile.SampleInformation.SampleVolume); file.WriteLine("e$info$`Sample injection volume` <- '{0}' ", rawFile.SampleInformation.InjectionVolume); file.WriteLine("e$info$`Sample row number` <- '{0}' ", rawFile.SampleInformation.RowNumber); file.WriteLine("e$info$`Sample dilution factor` <- '{0}' ", rawFile.SampleInformation.DilutionFactor); file.WriteLine("e$info$`Sample barcode` <- '{0}' ", rawFile.SampleInformation.Barcode); file.WriteLine("e$info$`User text 0` <- '{0}' ", rawFile.SampleInformation.UserText[0]); file.WriteLine("e$info$`User text 1` <- '{0}' ", rawFile.SampleInformation.UserText[1]); file.WriteLine("e$info$`User text 2` <- '{0}' ", rawFile.SampleInformation.UserText[2]); file.WriteLine("e$info$`User text 3` <- '{0}' ", rawFile.SampleInformation.UserText[3]); file.WriteLine("e$info$`User text 4` <- '{0}' ", rawFile.SampleInformation.UserText[4]); } }