public ConditionSpec(string condName, ImmutableArray <Type> dataTypes, UniquenessType uniqueness, ImmutableArray <SubDispatcherSpec> subDispDefs, bool extension) { this.condName = condName; DataTypes = dataTypes; Uniqueness = uniqueness; this.subDispDefs = subDispDefs; IsExtension = extension; }
public static string UniquenessTypeToString(UniquenessType type) { switch (type) { case UniquenessType.Global: return("global"); case UniquenessType.None: return("none"); case UniquenessType.Path: return("path"); default: throw new InvalidOperationException($"UniquenessType {type} binding not found, this is a client bug"); } }
public Uniqueness(UniquenessType uniqueness) { _uniquenessUserSelected = uniqueness; }
public void SelectUnique(UniquenessType uniquenessType) { SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold(1, uniquenessType); }
private void SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold(int threshold, UniquenessType uniqueBy) { dataGridView1.EndEdit(); var dubious = new HashSet <string>(StringComparer.OrdinalIgnoreCase); for (int rowIndex = 0; rowIndex < dataGridView1.Rows.Count; rowIndex++) { var row = dataGridView1.Rows[rowIndex]; var rowTag = (Tuple <IdentityPath, PeptideDocNode>)row.Tag; int matchCount = _peptidesInBackgroundProteome.Contains(rowTag.Item1) ? 1 : 0; for (int col = 0; col < dataGridView1.ColumnCount; col++) { if (col == PeptideIncludedColumn.Index || col == PeptideColumn.Index) { continue; } if (row.Cells[col].Value is bool && ((bool)row.Cells[col].Value)) { if (uniqueBy == UniquenessType.protein) { matchCount++; } else { var peptide = rowTag.Item2; var parent = PeptideGroupDocNodes.First(p => p.Children.Contains(peptide)); string testValA; string testValB; // ATP5B and atp5b are the same thing, as are "mus musculus" and "MUS MUSCULUS" if (uniqueBy == UniquenessType.gene) { // ReSharper disable once PossibleNullReferenceException testValA = parent.ProteinMetadata.Gene; testValB = ((ProteinColumn)dataGridView1.Columns[col].Tag).Protein.Gene; } else { // ReSharper disable once PossibleNullReferenceException testValA = parent.ProteinMetadata.Species; testValB = ((ProteinColumn)dataGridView1.Columns[col].Tag).Protein.Species; } // Can't filter on something that isn't there - require nonempty values if (!string.IsNullOrEmpty(testValA) && !string.IsNullOrEmpty(testValB) && string.Compare(testValA, testValB, StringComparison.OrdinalIgnoreCase) != 0) { matchCount++; } if (string.IsNullOrEmpty(testValA)) { dubious.Add(parent.Name); } if (string.IsNullOrEmpty(testValB)) { dubious.Add(((ProteinColumn)dataGridView1.Columns[col].Tag).Protein.Name); } } } if (matchCount > threshold) { break; } } row.Cells[PeptideIncludedColumn.Name].Value = (matchCount <= threshold); } SetCheckBoxPeptideIncludedHeaderState(); if (dubious.Any()) { var dubiousValues = TextUtil.LineSeparate(uniqueBy == UniquenessType.gene ? Resources.UniquePeptidesDlg_SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold_Some_background_proteome_proteins_did_not_have_gene_information__this_selection_may_be_suspect_ : Resources.UniquePeptidesDlg_SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold_Some_background_proteome_proteins_did_not_have_species_information__this_selection_may_be_suspect_, Resources.UniquePeptidesDlg_SelectPeptidesWithNumberOfMatchesAtOrBelowThreshold_These_proteins_include_, TextUtil.LineSeparate(dubious)); // Not L10N MessageDlg.Show(this, dubiousValues); } }
public RestTraversal Uniqueness(UniquenessType uniqueness) { return(this.Add(new Uniqueness(uniqueness))); }
public RestTraversal Uniqueness(UniquenessType uniqueness) { return this.Add(new Uniqueness(uniqueness)); }