private ITable CreateReplacementTable() { WriterClass.writeln("Exclusion Table Info:"); // Show possible columns, their names, help and value options ITable replacementTable = m_methods.CreateTable(typeof(IExclusionTable)); foreach (ITableColumnDescription col in replacementTable.ColumnInfo) { log.Info("{0,-12} {1,-25} {2}", col.Name, col.Selection, (col.Help ?? "").Trim().Replace("\r", "").Replace("\n", "; ")); WriterClass.writeln(String.Format("{0,-12} {1,-25} {2}", col.Name, col.Selection, (col.Help ?? "").Trim().Replace("\r", "").Replace("\n", "; "))); if (col.AcceptedHeaderNames.Length > 0) { log.Info("{0,38} alternative names: {1}", "", string.Join(", ", col.AcceptedHeaderNames)); WriterClass.writeln(String.Format("{0,38} alternative names: {1}", "", string.Join(", ", col.AcceptedHeaderNames))); } } WriterClass.Flush(); WriterClass.writeln("======================================\n"); WriterClass.writeln("Now attempting to write default value\n"); foreach (ITableColumnDescription col in replacementTable.ColumnInfo) { log.Info("{0,-12} {1,-25} {2} Default Value: {3}; Optional: {4}", col.Name, col.Selection, (col.Help ?? "").Trim().Replace("\r", "").Replace("\n", "; "), col.DefaultValue, col.Optional.ToString()); WriterClass.writeln(String.Format("{0,-12} {1,-25} {2} Default Value: {3}; Optional: {4}", col.Name, col.Selection, (col.Help ?? "").Trim().Replace("\r", "").Replace("\n", "; "), col.DefaultValue, col.Optional.ToString())); if (col.AcceptedHeaderNames.Length > 0) { log.Info("{0,38} alternative names: {1}", "", string.Join(", ", col.AcceptedHeaderNames)); WriterClass.writeln(String.Format("{0,38} alternative names: {1}", "", string.Join(", ", col.AcceptedHeaderNames))); } } WriterClass.Flush(); if (GlobalVar.SetExclusionTable) { log.Info("Attempting to set exclusio table values"); //// Create a new table with two rows. ITableRow row = replacementTable.CreateRow(); row.ColumnValues["Polarity"] = "Positive"; // must match, PRM has a polarity setting row.ColumnValues["Mass [m/z]"] = "700"; replacementTable.Rows.Add(row); row = replacementTable.CreateRow(); row.ColumnValues["Polarity"] = "Negative"; row.ColumnValues["Mass [m/z]"] = "1600"; replacementTable.Rows.Add(row); } else { replacementTable = null; } return(replacementTable); }
//outputs the scan information, only used for testing , //now pretty much depricated, wouldn't recommend using it private static void DisplayScan(Scan scan, IDs id) { StringBuilder writeOut = new StringBuilder(); writeOut.Append(scan.getDetailedString()); StringBuilder consoleOut = new StringBuilder(); switch (outputLevel) { case 0: consoleOut.Append(scan.getDetailedString()); break; case 1: consoleOut.Append(scan.getSimpleString()); break; case 2: if (scan.GetSpectra().getMSLevel() == 2) { if (id != null) { consoleOut.AppendLine(id.ToString()); writeOut.AppendLine(id.ToString()); } else { consoleOut.Append(String.Format("scanNum {0} cannot be matched to a peptide", id.getScanNum())); } } break; case 3: consoleOut.Append("available info: "); foreach (String name in scan.infoTable.Keys) { consoleOut.Append("\"" + name + "\" "); } break; } writeOut.AppendLine(); consoleOut.AppendLine(); WriterClass.writeln(writeOut.ToString()); if (scan.ID % GlobalVar.ScansPerOutput == 0) { log.Info(consoleOut.ToString()); } }