public string ToXML(FAIMStoMzXMLProcessor processor) { // place scan byte depth into our tracking list var index = new Index(processor.ByteTracking.CurrentScan, processor.ByteTracking.ByteDepth + 3); processor.ByteTracking.ScanOffsets.Add(index); FilterLine = FixFilterLine(); var sb = new StringBuilder(); sb.AppendFormat(" <scan num=\"{0}\"", processor.ByteTracking.CurrentScan).AppendLine(); sb.AppendFormat(" msLevel=\"{0}\"", MsLevel).AppendLine(); sb.AppendFormat(" peaksCount=\"{0}\"", PeaksCount).AppendLine(); sb.AppendFormat(" polarity=\"{0}\"", Polarity).AppendLine(); sb.AppendFormat(" scanType=\"{0}\"", ScanType).AppendLine(); sb.AppendFormat(" filterLine=\"{0}\"", FilterLine).AppendLine(); sb.AppendFormat(" retentionTime=\"{0}\"", RetentionTime).AppendLine(); sb.AppendFormat(" lowMz=\"" + Math.Round(LowMz, 3) + "\"").AppendLine(); sb.AppendFormat(" highMz=\"" + Math.Round(HighMz, 3) + "\"").AppendLine(); sb.AppendFormat(" basePeakMz=\"" + Math.Round(BasePeakMz, 3) + "\"").AppendLine(); sb.AppendFormat(" basePeakIntensity=\"" + FormatSpecialNumber(BasePeakIntensity) + "\"").AppendLine(); sb.AppendFormat(" totIonCurrent=\"" + FormatSpecialNumber(TotIonCurrent) + "\"").AppendLine(); sb.AppendFormat(" collisionEnergy=\"" + CollisionEnergy + "\">").AppendLine(); sb.AppendLine(PrecursorMz.ToXML()); sb.AppendLine(PeakData.ToXML(4)); sb.Append(" </scan>"); processor.ByteTracking.CurrentScan++; return(sb.ToString()); }
// for outputting valid MzXML strings to file public string ToXML(FAIMStoMzXMLProcessor processor) { // place scan byte depth into our tracking list var index = new Index(processor.ByteTracking.CurrentScan, processor.ByteTracking.ByteDepth + 2); processor.ByteTracking.ScanOffsets.Add(index); FilterLine = FixFilterLine(); var sb = new StringBuilder(); sb.AppendFormat(" <scan num=\"{0}\"", processor.ByteTracking.CurrentScan).AppendLine(); sb.AppendFormat(" msLevel=\"{0}\"", MsLevel).AppendLine(); sb.AppendFormat(" peaksCount=\"{0}\"", PeaksCount).AppendLine(); sb.AppendFormat(" polarity=\"{0}\"", Polarity).AppendLine(); sb.AppendFormat(" scanType=\"{0}\"", ScanType).AppendLine(); sb.AppendFormat(" filterLine=\"{0}\"", FilterLine).AppendLine(); sb.AppendFormat(" retentionTime=\"{0}\"", RetentionTime).AppendLine(); sb.AppendFormat(" lowMz=\"" + Math.Round(LowMz, 3) + "\"").AppendLine(); sb.AppendFormat(" highMz=\"" + Math.Round(HighMz, 3) + "\"").AppendLine(); sb.AppendFormat(" basePeakMz=\"" + Math.Round(BasePeakMz, 3) + "\"").AppendLine(); sb.AppendFormat(" basePeakIntensity=\"" + FormatSpecialNumber(BasePeakIntensity) + "\"").AppendLine(); sb.AppendFormat(" totIonCurrent=\"" + FormatSpecialNumber(TotIonCurrent) + "\">").AppendLine(); sb.AppendLine(PeakData.ToXML(3)); // advance the byteTracker for Ms2 Indices processor.ByteTracker(sb.ToString(), true); processor.ByteTracking.CurrentScan++; foreach (var ms2 in Ms2s) { var ms2String = ms2.ToXML(processor); sb.AppendLine(ms2String); // advance byteTracker for the Ms2 Entry processor.ByteTracker(ms2String); } sb.Append(" </scan>"); processor.ByteTracker(" </scan>"); return(sb.ToString()); }
private static void Main(string[] args) { try { if (args.Length == 0) { var exePath = ProcessFilesOrDirectoriesBase.GetAppPath(); Console.WriteLine("WriteFaimsXMLFromRawFile version " + GetAppVersion()); Console.WriteLine(); Console.WriteLine(ConsoleMsgUtils.WrapParagraph( "This program converts a Thermo .raw file with FAIMS scans into a series of .mzXML files, " + "creating one .mzXML file for each FAIMS compensation voltage (CV) value in the .raw file.")); Console.WriteLine(); Console.WriteLine("Syntax:"); Console.WriteLine("{0} InstrumentFile.raw [Output_Directory_Path]", Path.GetFileName(exePath)); Console.WriteLine(); Console.WriteLine("Wild cards are supported, e.g. *.raw"); Console.WriteLine(); // ReSharper disable StringLiteralTypo Console.WriteLine("Program written by Dain Brademan for the Joshua Coon Research Group (University of Wisconsin) in 2018"); Console.WriteLine("Converted to use ThermoFisher.CommonCore DLLs by Matthew Monroe for PNNL (Richland, WA) in 2020"); Console.WriteLine("E-mail: [email protected] or [email protected] or [email protected]"); Console.WriteLine("Website: https://github.com/PNNL-Comp-Mass-Spec/FAIMS-MzXML-Generator/releases or"); Console.WriteLine(" https://github.com/coongroup/FAIMS-MzXML-Generator"); // ReSharper restore StringLiteralTypo return; } var inputFilePathSpec = args[0]; string outputDirectoryPath; if (args.Length > 1) { outputDirectoryPath = args[1]; } else { outputDirectoryPath = string.Empty; } var processor = new FAIMStoMzXMLProcessor(); RegisterEvents(processor); processor.QuickCVLookup = false; var success = processor.ProcessFiles(inputFilePathSpec, outputDirectoryPath); if (success) { Console.WriteLine("Processing completed"); } System.Threading.Thread.Sleep(750); } catch (Exception ex) { ConsoleMsgUtils.ShowError("Error in Program.Main", ex); } }