private void AddFastaFile(string fileName, string identifierRule, string descriptionRule, string taxonomyRule, string taxonomyId, string variationRule, string modificationRule) { DataRow2 row = table.NewRow(); row["Fasta file path"] = fileName; row["Exists"] = File.Exists(fileName).ToString(); row["Identifier rule"] = identifierRule; row["Description rule"] = descriptionRule; row["Taxonomy rule"] = taxonomyRule; row["Taxonomy ID"] = taxonomyId; row["Organism"] = ""; bool success = int.TryParse(taxonomyId, out int taxId); if (success && TaxonomyItems.taxId2Item.ContainsKey(taxId)) { string n = TaxonomyItems.taxId2Item[taxId].GetScientificName(); row["Organism"] = n; } if (hasVariationData) { row["Variation rule"] = variationRule; } if (hasModifications) { row["Modification rule"] = modificationRule; } table.AddRow(row); }
private void EditButtonOnClick(object sender, EventArgs eventArgs) { int[] sel = tableView1.GetSelectedRows(); if (sel.Length != 1) { MessageBox.Show("Please select exactly one row."); return; } DataRow2 row = table.GetRow(sel[0]); IsobaricLabelsEditForm f = new IsobaricLabelsEditForm(new IsobaricLabelInfo((string)row[0], (string)row[1], (double)row[2], (double)row[3], (double)row[4], (double)row[5], (bool)row[6])); f.ShowDialog(); if (f.DialogResult != DialogResult.OK) { return; } IsobaricLabelInfo info = f.Info; row[0] = info.internalLabel; row[1] = info.terminalLabel; row[2] = info.correctionFactorM2; row[3] = info.correctionFactorM1; row[4] = info.correctionFactorP1; row[5] = info.correctionFactorP2; row[6] = info.tmtLike; tableView1.Invalidate(true); }
private void ChangeFolderButton_OnClick(object sender, EventArgs e) { int[] sel = tableView1.GetSelectedRows(); if (sel.Length == 0) { MessageBox.Show(Loc.PleaseSelectSomeRows); return; } FolderQueryForm fqw = new FolderQueryForm(Path.GetDirectoryName((string)table.GetRow(sel[0])["Fasta file path"])); if (!Directory.Exists(fqw.Value)) { return; } if (fqw.ShowDialog() == DialogResult.OK) { foreach (int i in sel) { DataRow2 row = table.GetRow(i); string name = (string)row["Fasta file path"]; string newFile = Path.Combine(Path.GetFullPath(fqw.Value), Path.GetFileName(name)); row["Fasta file path"] = newFile; row["Exists"] = File.Exists(newFile).ToString(); } } tableView1.Invalidate(true); }
private void AddButtonOnClick(object sender, EventArgs eventArgs) { DataRow2 row = table.NewRow(); row["Internal label"] = ""; row["Terminal label"] = ""; row["Correction factor -2 [%]"] = 0d; row["Correction factor -1 [%]"] = 0d; row["Correction factor +1 [%]"] = 0d; row["Correction factor +2 [%]"] = 0d; row["TMT like"] = true; table.AddRow(row); tableView1.Invalidate(true); }
private void AddLabel(string internalLabel, string terminalLabel, string correctionFactorM2, string correctionFactorM1, string correctionFactorP1, string correctionFactorP2, string tmtLike) { DataRow2 row = table.NewRow(); row[0] = internalLabel; row[1] = terminalLabel; row[2] = Parser.Double(correctionFactorM2); row[3] = Parser.Double(correctionFactorM1); row[4] = Parser.Double(correctionFactorP1); row[5] = Parser.Double(correctionFactorP2); row[6] = Parser.Bool(tmtLike); table.AddRow(row); }
private ITableModel CreateTable(string[] parseRules, string[] descriptions) { table = new DataTable2("parse rules"); table.AddColumn("Parse rule", 90, ColumnType.Text); table.AddColumn("Description", 170, ColumnType.Text); for (int i = 0; i < parseRules.Length; i++) { DataRow2 row = table.NewRow(); row[0] = parseRules[i]; row[1] = descriptions[i]; table.AddRow(row); } return(table); }
private void SetDefaults(IsobaricLabelingDefault def) { table.Clear(); for (int i = 0; i < def.Count; i++) { DataRow2 row = table.NewRow(); row[0] = def.GetInternalLabel(i); row[1] = def.GetTerminalLabel(i); row[2] = 0d; row[3] = 0d; row[4] = 0d; row[5] = 0d; row[6] = def.IsLikelyTmtLike(i); table.AddRow(row); } tableView1.Invalidate(true); }
private void TestFile(int minEntry, int maxEntry) { Regex nameRegex = !string.IsNullOrEmpty(identifierParseRule) ? new Regex(identifierParseRule) : null; Regex descriptionRegex = !string.IsNullOrEmpty(descriptionParseRule) ? new Regex(descriptionParseRule) : null; Regex taxonomyRegex = !string.IsNullOrEmpty(taxonomyParseRule) ? new Regex(taxonomyParseRule) : null; Regex variationRegex = !string.IsNullOrEmpty(variationParseRule) ? new Regex(variationParseRule) : null; Regex modificationRegex = !string.IsNullOrEmpty(modificationParseRule) ? new Regex(modificationParseRule) : null; string[] headers; string[] sequences; GetDataFromFile(filePath, minEntry, maxEntry, out headers, out sequences); tableModel.Clear(); for (int i = 0; i < headers.Length; i++) { DataRow2 r = tableModel.NewRow(); string header = headers[i]; r["Sequence"] = sequences[i]; r["Header"] = header; if (nameRegex != null) { r["Identifier"] = nameRegex.Match(header).Groups[1].ToString(); } if (descriptionRegex != null) { r["Description"] = descriptionRegex.Match(header).Groups[1].ToString(); } if (taxonomyRegex != null) { r["Taxonomy ID"] = taxonomyRegex.Match(header).Groups[1].ToString(); } if (variationRegex != null) { r["Variation"] = variationRegex.Match(header).Groups[1].ToString(); } if (modificationRegex != null) { r["Modification"] = modificationRegex.Match(header).Groups[1].ToString(); } tableModel.AddRow(r); } mainTable.Invalidate(true); }
private ITableModel CreateSearchResultsTable(IList <int> searchInds, IList <int[]> matchingCols) { DataTable2 table = new DataTable2("Search results", "Search results"); table.AddColumn("Row", 100, ColumnType.Integer, ""); table.AddColumn("Column", 80, ColumnType.Text, ""); for (int index = 0; index < searchInds.Count; index++) { int searchInd = searchInds[index]; for (int i = 0; i < matchingCols[index].Length; i++) { string colName = tableModel.GetColumnName(matchingCols[index][i]); DataRow2 row = table.NewRow(); row["Row"] = searchInd + 1; row["Column"] = colName; table.AddRow(row); } } return(table); }
private ITableModel CreateTable(IList <int> searchInds, IList <int[]> matchingCols) { DataTable2 table = new DataTable2("Search results", "Search results"); table.AddColumn("Row", 100, ColumnType.Integer, ""); table.AddColumn("Columns", 80, ColumnType.Text, ""); for (int index = 0; index < searchInds.Count; index++) { int searchInd = searchInds[index]; DataRow2 row = table.NewRow(); row["Row"] = searchInd + 1; string[] colNames = new string[matchingCols[index].Length]; for (int i = 0; i < matchingCols[index].Length; i++) { colNames[i] = tableModel.GetColumnName(matchingCols[index][i]); } row["Columns"] = StringUtils.Concat(";", colNames); table.AddRow(row); } return(table); }