public static void RefineMonoIsoMassChargeValues(WorkFlows.WorkflowParameters parameters, CentroidStreamCollection centroids, PrecursorMassCollection precursorMasses, TrailerExtraCollection trailerExtras, PrecursorPeakCollection precursorPeaks, PrecursorScanCollection precursorScans) { int ms2Scan, ms1Scan, refinedCharge; double refinedMass; ProgressIndicator P = new ProgressIndicator(precursorPeaks.Count(), "Refining precursor charge and monoisotopic mass"); P.Start(); foreach (var peak in precursorPeaks) { ms2Scan = peak.Value.Ms2Scan; if (peak.Value.PeakFound) { ms1Scan = peak.Value.MaxScan; } else { ms1Scan = precursorScans[ms2Scan].MasterScan; } (refinedCharge, refinedMass) = GetMonoIsotopicMassCharge(centroids[ms1Scan], precursorMasses[ms2Scan].ParentMZ, trailerExtras[ms2Scan].ChargeState, parameters.ConsideredChargeStates.Min, parameters.ConsideredChargeStates.Max); precursorMasses[ms2Scan].MonoisotopicMZ = refinedMass; trailerExtras[ms2Scan].MonoisotopicMZ = refinedMass; trailerExtras[ms2Scan].ChargeState = refinedCharge; P.Update(); } P.Done(); }
public static void WriteToDisk(WorkFlows.WorkflowParameters opts) { List <string> files = new List <string>(); Console.WriteLine(); Console.WriteLine("Writing log files"); foreach (var file in files) { Console.WriteLine(Path.GetFileName(file)); Console.WriteLine("----------------------------------------"); using (IRawDataPlus rawFile = RawFileReaderFactory.ReadFile(file)) { rawFile.SelectMsData(); var numberOfLogs = rawFile.GetStatusLogEntriesCount(); var logInfo = rawFile.GetStatusLogHeaderInformation(); string logName = file + ".INST_LOG.txt"; Dictionary <int, ISingleValueStatusLog> log = new Dictionary <int, ISingleValueStatusLog>(); ProgressIndicator P = new ProgressIndicator(logInfo.Count(), "Preparing log data"); P.Start(); for (int i = 0; i < logInfo.Count(); i++) { log.Add(i, rawFile.GetStatusLogAtPosition(i)); P.Update(); } P.Done(); using (StreamWriter f = new StreamWriter(logName)) { P = new ProgressIndicator(numberOfLogs, $"Writing log"); P.Start(); f.Write("Time\t"); foreach (var x in logInfo) { f.Write(x.Label + "\t"); } f.Write("\n"); for (int i = 0; i < numberOfLogs; i++) { f.Write($"{log[0].Times[i]}\t"); for (int j = 0; j < logInfo.Length; j++) { try { f.Write("{0}\t", log[j].Values[i]); } catch (Exception) { f.Write("\t"); } } f.Write("\n"); P.Update(); } P.Done(); } } Console.WriteLine("\n"); } }