/// <summary> /// Matches library peptides to the current document settings and adds them to the document. /// This needs to be one function so that we can use one LongWaitDlg. /// </summary> public void AddAllPeptidesToDocument(ILongWaitBroker broker, AuditLogEntryCreatorList entryCreators) { MatchAllPeptides(broker); if (broker.IsCanceled) { return; } if (MatchedPeptideCount == 0) { return; } if (broker.ShowDialog(wnd => EnsureDuplicateProteinFilter(wnd, entryCreators)) == DialogResult.Cancel) { return; } IdentityPath selectedPath; IdentityPath toPath = AddAllPeptidesSelectedPath; DocAllPeptides = AddPeptides(_document, broker, toPath, out selectedPath); AddAllPeptidesSelectedPath = selectedPath; }
/// <summary> /// If peptides match to multiple proteins, ask the user what they want to do with these /// peptides. /// </summary> public DialogResult EnsureDuplicateProteinFilter(IWin32Window parent, bool single, AuditLogEntryCreatorList entryCreators) { var result = DialogResult.OK; var multipleProteinsPerPeptideCount = PeptideMatches.Values.Count( pepMatch => pepMatch.Proteins != null && pepMatch.Proteins.Count > 1); var unmatchedPeptidesCount = PeptideMatches.Values.Count(pepMatch => pepMatch.Proteins != null && pepMatch.Proteins.Count == 0); var filteredPeptidesCount = PeptideMatches.Values.Count(pepMatch => !pepMatch.MatchesFilterSettings); if (multipleProteinsPerPeptideCount > 0 || unmatchedPeptidesCount > 0 || filteredPeptidesCount > 0) { var hasSmallMolecules = PeptideMatches.Any(p => !p.Key.IsProteomic); using (var peptideProteinsDlg = new FilterMatchedPeptidesDlg(multipleProteinsPerPeptideCount, unmatchedPeptidesCount, filteredPeptidesCount, single, hasSmallMolecules)) { result = peptideProteinsDlg.ShowDialog(parent); if (entryCreators != null) { entryCreators.Add(peptideProteinsDlg.FormSettings.EntryCreator); } } } return(result); }
public DialogResult EnsureDuplicateProteinFilter(IWin32Window parent, AuditLogEntryCreatorList entryCreators) { return(EnsureDuplicateProteinFilter(parent, false, entryCreators)); }