public override bool Equals(Object other) { if (other == this) { return(true); } if (!base.Equals(other)) { return(false); } BackgroundProteome that = other as BackgroundProteome; if (that == null) { return(false); } if (DatabaseInvalid != that.DatabaseInvalid || DatabaseValidated != that.DatabaseValidated) { return(false); } lock (_cache) { return(_cache.Equals(that._cache)); } }
private void CompleteProcessing(IDocumentContainer container, BackgroundProteome backgroundProteomeWithDigestions) { SrmDocument docCurrent; SrmDocument docNew; do { docCurrent = container.Document; docNew = ChangeBackgroundProteome(docCurrent, backgroundProteomeWithDigestions); }while (!CompleteProcessing(container, docNew, docCurrent)); }
private void CompleteProcessing(IDocumentContainer container, BackgroundProteome backgroundProteomeWithDigestions) { if (container == null) { return; // We're using this in the PeptideSettingsUI thread } SrmDocument docCurrent; SrmDocument docNew; do { docCurrent = container.Document; docNew = ChangeBackgroundProteome(docCurrent, backgroundProteomeWithDigestions); }while (!CompleteProcessing(container, docNew, docCurrent)); }
public static string IsNotLoadedExplained(PeptideSettings settings, BackgroundProteome backgroundProteome, bool requireResolvedProteinMetadata) { if (backgroundProteome.IsNone) { return(null); } if (!backgroundProteome.DatabaseValidated) { return("BackgroundProteomeManager: !backgroundProteome.DatabaseValidated"); // Not L10N } if (backgroundProteome.DatabaseInvalid) { return(null); } if (!requireResolvedProteinMetadata || !backgroundProteome.NeedsProteinMetadataSearch) { return(null); } return("BackgroundProteomeManager: NeedsProteinMetadataSearch"); // Not L10N }
public override bool Equals(Object other) { if (other == this) { return(true); } if (!base.Equals(other)) { return(false); } BackgroundProteome that = other as BackgroundProteome; if (that == null) { return(false); } if (DatabaseInvalid != that.DatabaseInvalid || DatabaseValidated != that.DatabaseValidated) { return(false); } return(DigestionNames.SetEquals(that.DigestionNames)); }
private static string IsNotLoadedExplained(SrmDocument document, BackgroundProteome backgroundProteome, bool requireResolvedProteinMetadata) { return DocumentHasLoadedBackgroundProteomeOrNoneExplained(document, backgroundProteome, requireResolvedProteinMetadata); }
private void CompleteProcessing(IDocumentContainer container, BackgroundProteome backgroundProteomeWithDigestions) { SrmDocument docCurrent; SrmDocument docNew; do { docCurrent = container.Document; docNew = ChangeBackgroundProteome(docCurrent, backgroundProteomeWithDigestions); } while (!CompleteProcessing(container, docNew, docCurrent)); }
private static SrmDocument ChangeBackgroundProteome(SrmDocument document, BackgroundProteome backgroundProteome) { return document.ChangeSettings( document.Settings.ChangePeptideSettings(setP => setP.ChangeBackgroundProteome(backgroundProteome))); }
private static string DocumentHasLoadedBackgroundProteomeOrNoneExplained(SrmDocument document, BackgroundProteome backgroundProteome, bool requireResolvedProteinMetadata) { if (backgroundProteome.IsNone) { return null; } if (!backgroundProteome.DatabaseValidated) { return "BackgroundProteomeManager: !backgroundProteome.DatabaseValidated"; // Not L10N } if (backgroundProteome.DatabaseInvalid) { return null; } var peptideSettings = document.Settings.PeptideSettings; if (!backgroundProteome.HasDigestion(peptideSettings)) { return "BackgroundProteomeManager: !backgroundProteome.HasDigestion(peptideSettings)"; // Not L10N } if (!requireResolvedProteinMetadata || (!backgroundProteome.NeedsProteinMetadataSearch)) { return null; } if (backgroundProteome.NeedsProteinMetadataSearch) { return "BackgroundProteomeManager: NeedsProteinMetadataSearch"; // Not L10N } return "BackgroundProteomeManager: requireResolvedProteinMetadata"; // Not L10N }
public void SetBackgroundProteome(BackgroundProteome backgroundProteome) { _backgroundProteome = backgroundProteome; }
protected override bool LoadBackground(IDocumentContainer container, SrmDocument document, SrmDocument docCurrent) { // Only allow one background proteome to load at a time. This can // get tricky, if the user performs an undo and then a redo across // a change in background proteome. // Our first priority is doing the digestions, the second is accessing web // services to add missing protein metadata. lock (_lockLoadBackgroundProteome) { BackgroundProteome originalBackgroundProteome = GetBackgroundProteome(docCurrent); // Check to see whether the Digestion already exists but has not been queried yet. BackgroundProteome backgroundProteomeWithDigestions = new BackgroundProteome(originalBackgroundProteome, true); if (IsNotLoadedExplained(docCurrent, backgroundProteomeWithDigestions, true) == null) { // digest is ready, and protein metdata is resolved CompleteProcessing(container, backgroundProteomeWithDigestions); return true; } // are we here to do the digest, or to resolve the protein metadata? bool getMetadata = (IsNotLoadedExplained(docCurrent, backgroundProteomeWithDigestions, false) == null) && backgroundProteomeWithDigestions.NeedsProteinMetadataSearch; string name = originalBackgroundProteome.Name; ProgressStatus progressStatus = new ProgressStatus(string.Format(getMetadata?Resources.BackgroundProteomeManager_LoadBackground_Resolving_protein_details_for__0__proteome:Resources.BackgroundProteomeManager_LoadBackground_Digesting__0__proteome, name)); try { using (FileSaver fs = new FileSaver(originalBackgroundProteome.DatabasePath, StreamManager)) { File.Copy(originalBackgroundProteome.DatabasePath, fs.SafeName, true); var digestHelper = new DigestHelper(this, container, docCurrent, name, fs.SafeName, true); bool success; if (getMetadata) success = digestHelper.LookupProteinMetadata(ref progressStatus); else success = (digestHelper.Digest(ref progressStatus) != null); if (!success) { // Processing was canceled EndProcessing(docCurrent); UpdateProgress(progressStatus.Cancel()); return false; } using (var proteomeDb = ProteomeDb.OpenProteomeDb(originalBackgroundProteome.DatabasePath)) { proteomeDb.DatabaseLock.AcquireWriterLock(int.MaxValue); try { if (!fs.Commit()) { EndProcessing(docCurrent); throw new IOException( string.Format( Resources .BackgroundProteomeManager_LoadBackground_Unable_to_rename_temporary_file_to__0__, fs.RealName)); } } finally { proteomeDb.DatabaseLock.ReleaseWriterLock(); } } CompleteProcessing(container, new BackgroundProteome(originalBackgroundProteome, true)); UpdateProgress(progressStatus.Complete()); return true; } } catch (Exception x) { var message = new StringBuilder(); message.AppendLine( string.Format(Resources.BackgroundProteomeManager_LoadBackground_Failed_updating_background_proteome__0__, name)); message.Append(x.Message); UpdateProgress(progressStatus.ChangeErrorException(new IOException(message.ToString(), x))); return false; } } }
private static SrmDocument ChangeBackgroundProteome(SrmDocument document, BackgroundProteome backgroundProteome) { return(document.ChangeSettings( document.Settings.ChangePeptideSettings(setP => setP.ChangeBackgroundProteome(backgroundProteome)))); }
private BackgroundProteome Load(IDocumentContainer container, PeptideSettings settings, SrmDocument docCurrent, bool isBackgroundLoad) { // Only allow one background proteome to load at a time. This can // get tricky, if the user performs an undo and then a redo across // a change in background proteome. // Our only priority is accessing web services to add missing protein metadata. // There may also be a load initiation by the Peptide Settings dialog as foreground task, // it takes priority over the background task. lock (_lockLoadBackgroundProteome) { BackgroundProteome originalBackgroundProteome = settings.BackgroundProteome; BackgroundProteome validatedBackgroundProtome = originalBackgroundProteome.DatabaseValidated ? originalBackgroundProteome : new BackgroundProteome(originalBackgroundProteome.BackgroundProteomeSpec); if (IsNotLoadedExplained(settings, validatedBackgroundProtome, true) == null) { // protein metadata is resolved CompleteProcessing(container, validatedBackgroundProtome); Helpers.AssignIfEquals(ref validatedBackgroundProtome, originalBackgroundProteome); return(validatedBackgroundProtome); // No change needed } // we are here to resolve the protein metadata string name = originalBackgroundProteome.Name; IProgressStatus progressStatus = new ProgressStatus(string.Format(Resources.BackgroundProteomeManager_LoadBackground_Resolving_protein_details_for__0__proteome, name)); try { // The transaction commit for writing the digestion info can be very lengthy, avoid lock timeouts // by doing that work in a tempfile that no other thread knows aboout using (FileSaver fs = new FileSaver(originalBackgroundProteome.DatabasePath, StreamManager)) { File.Copy(originalBackgroundProteome.DatabasePath, fs.SafeName, true); var digestHelper = new DigestHelper(this, container, docCurrent, name, fs.SafeName, true); bool success = digestHelper.LookupProteinMetadata(ref progressStatus); if (digestHelper.IsCanceled || !success) { // Processing was canceled if (docCurrent != null) { EndProcessing(docCurrent); } UpdateProgress(progressStatus.Cancel()); return(null); } using (var proteomeDb = ProteomeDb.OpenProteomeDb(originalBackgroundProteome.DatabasePath)) { proteomeDb.DatabaseLock.AcquireWriterLock(int.MaxValue); // Wait for any existing readers to complete, prevent any new ones try { if (File.GetLastWriteTime(fs.RealName) <= File.GetLastWriteTime(fs.SafeName)) // Don't overwrite if foreground task has already updated { proteomeDb.CloseDbConnection(); // Get rid of any file handles if (!fs.Commit()) { if (docCurrent != null) { EndProcessing(docCurrent); } throw new IOException(string.Format(Resources.BackgroundProteomeManager_LoadBackground_Unable_to_rename_temporary_file_to__0__, fs.RealName)); } } } finally { proteomeDb.DatabaseLock.ReleaseWriterLock(); } } var updatedProteome = new BackgroundProteome(originalBackgroundProteome); using (var proteomeDb = originalBackgroundProteome.OpenProteomeDb()) { proteomeDb.AnalyzeDb(); // Now it's safe to start this potentially lengthy indexing operation } CompleteProcessing(container, updatedProteome); UpdateProgress(progressStatus.Complete()); return(updatedProteome); } } catch (Exception x) { var message = new StringBuilder(); message.AppendLine( string.Format(Resources.BackgroundProteomeManager_LoadBackground_Failed_updating_background_proteome__0__, name)); message.Append(x.Message); UpdateProgress(progressStatus.ChangeErrorException(new IOException(message.ToString(), x))); return(null); } } }
private PeptideSettings ValidateNewSettings(bool showMessages) { var helper = new MessageBoxHelper(this, showMessages); // Validate and hold digestion settings Enzyme enzyme = Settings.Default.GetEnzymeByName(comboEnzyme.SelectedItem.ToString()); Helpers.AssignIfEquals(ref enzyme, _peptideSettings.Enzyme); int maxMissedCleavages = int.Parse(comboMissedCleavages.SelectedItem.ToString()); bool excludeRaggedEnds = cbRaggedEnds.Checked; DigestSettings digest = new DigestSettings(maxMissedCleavages, excludeRaggedEnds); Helpers.AssignIfEquals(ref digest, Digest); var backgroundProteomeSpec = _driverBackgroundProteome.SelectedItem; BackgroundProteome backgroundProteome = BackgroundProteome.NONE; if (!backgroundProteomeSpec.IsNone) { backgroundProteome = new BackgroundProteome(backgroundProteomeSpec, true); if (backgroundProteome.DatabaseInvalid) { var message = TextUtil.LineSeparate(string.Format(Resources.PeptideSettingsUI_ValidateNewSettings_Failed_to_load_background_proteome__0__, backgroundProteomeSpec.Name), string.Format(Resources.PeptideSettingsUI_ValidateNewSettings_The_file__0__may_not_be_a_valid_proteome_file, backgroundProteomeSpec.DatabasePath)); MessageDlg.Show(this, message); tabControl1.SelectedIndex = 0; _driverBackgroundProteome.Combo.Focus(); return null; } } Helpers.AssignIfEquals(ref backgroundProteome, _peptideSettings.BackgroundProteome); // Validate and hold prediction settings string nameRT = comboRetentionTime.SelectedItem.ToString(); RetentionTimeRegression retentionTime = Settings.Default.GetRetentionTimeByName(nameRT); if (retentionTime != null && retentionTime.Calculator != null) { RetentionScoreCalculatorSpec retentionCalc = Settings.Default.GetCalculatorByName(retentionTime.Calculator.Name); // Just in case the calculator in use in the current documet got removed, // never set the calculator to null. Just keep using the one we have. if (retentionCalc != null && !ReferenceEquals(retentionCalc, retentionTime.Calculator)) retentionTime = retentionTime.ChangeCalculator(retentionCalc); } bool useMeasuredRT = cbUseMeasuredRT.Checked; double? measuredRTWindow = null; if (!string.IsNullOrEmpty(textMeasureRTWindow.Text)) { double measuredRTWindowOut; const double minWindow = PeptidePrediction.MIN_MEASURED_RT_WINDOW; const double maxWindow = PeptidePrediction.MAX_MEASURED_RT_WINDOW; if (!helper.ValidateDecimalTextBox(tabControl1, (int) TABS.Prediction, textMeasureRTWindow, minWindow, maxWindow, out measuredRTWindowOut)) return null; measuredRTWindow = measuredRTWindowOut; } string nameDt = comboDriftTimePredictor.SelectedItem.ToString(); DriftTimePredictor driftTimePredictor = Settings.Default.GetDriftTimePredictorByName(nameDt); if (driftTimePredictor != null && driftTimePredictor.IonMobilityLibrary != null) { IonMobilityLibrarySpec ionMobilityLibrary = Settings.Default.GetIonMobilityLibraryByName(driftTimePredictor.IonMobilityLibrary.Name); // Just in case the library in use in the current documet got removed, // never set the library to null. Just keep using the one we have. if (ionMobilityLibrary != null && !ReferenceEquals(ionMobilityLibrary, driftTimePredictor.IonMobilityLibrary)) driftTimePredictor = driftTimePredictor.ChangeLibrary(ionMobilityLibrary); } bool useLibraryDriftTime = cbUseSpectralLibraryDriftTimes.Checked; double? libraryDTResolvingPower = null; if (useLibraryDriftTime || !string.IsNullOrEmpty(textSpectralLibraryDriftTimesResolvingPower.Text)) { double libraryDTWindowOut; if (!helper.ValidateDecimalTextBox(tabControl1, (int)TABS.Prediction, textSpectralLibraryDriftTimesResolvingPower, null, null, out libraryDTWindowOut)) return null; string errmsg = EditDriftTimePredictorDlg.ValidateResolvingPower(libraryDTWindowOut); if (errmsg != null) { helper.ShowTextBoxError(tabControl1, (int)TABS.Prediction, textSpectralLibraryDriftTimesResolvingPower, errmsg); return null; } libraryDTResolvingPower = libraryDTWindowOut; } var prediction = new PeptidePrediction(retentionTime, driftTimePredictor, useMeasuredRT, measuredRTWindow, useLibraryDriftTime, libraryDTResolvingPower); Helpers.AssignIfEquals(ref prediction, Prediction); // Validate and hold filter settings int excludeNTermAAs; if (!helper.ValidateNumberTextBox(tabControl1, (int) TABS.Filter, textExcludeAAs, PeptideFilter.MIN_EXCLUDE_NTERM_AA, PeptideFilter.MAX_EXCLUDE_NTERM_AA, out excludeNTermAAs)) return null; int minPeptideLength; if (!helper.ValidateNumberTextBox(tabControl1, (int) TABS.Filter, textMinLength, PeptideFilter.MIN_MIN_LENGTH, PeptideFilter.MAX_MIN_LENGTH, out minPeptideLength)) return null; int maxPeptideLength; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Filter, textMaxLength, Math.Max(PeptideFilter.MIN_MAX_LENGTH, minPeptideLength), PeptideFilter.MAX_MAX_LENGTH, out maxPeptideLength)) return null; PeptideExcludeRegex[] exclusions = _driverExclusion.Chosen; bool autoSelect = cbAutoSelect.Checked; PeptideFilter filter; try { filter = new PeptideFilter(excludeNTermAAs, minPeptideLength, maxPeptideLength, exclusions, autoSelect); } catch (InvalidDataException x) { if (showMessages) MessageDlg.ShowException(this, x); return null; } Helpers.AssignIfEquals(ref filter, Filter); // Validate and hold libraries PeptideLibraries libraries; IList<LibrarySpec> librarySpecs = _driverLibrary.Chosen; if (librarySpecs.Count == 0) libraries = new PeptideLibraries(PeptidePick.library, null, null, false, librarySpecs, new Library[0]); else { int? peptideCount = null; if (cbLimitPeptides.Checked) { int peptideCountVal; if (!helper.ValidateNumberTextBox(textPeptideCount, PeptideLibraries.MIN_PEPTIDE_COUNT, PeptideLibraries.MAX_PEPTIDE_COUNT, out peptideCountVal)) return null; peptideCount = peptideCountVal; } PeptidePick pick = (PeptidePick) comboMatching.SelectedIndex; IList<Library> librariesLoaded = new Library[librarySpecs.Count]; bool documentLibrary = false; if (Libraries != null) { // Use existing library spec's, if nothing was changed. // Avoid changing the libraries, just because the the picking // algorithm changed. if (ArrayUtil.EqualsDeep(librarySpecs, Libraries.LibrarySpecs)) { librarySpecs = Libraries.LibrarySpecs; librariesLoaded = Libraries.Libraries; } documentLibrary = Libraries.HasDocumentLibrary; // Otherwise, leave the list of loaded libraries empty, // and let the LibraryManager refill it. This ensures a // clean save of library specs only in the user config, rather // than a mix of library specs and libraries. } PeptideRankId rankId = (PeptideRankId) comboRank.SelectedItem; if (comboRank.SelectedIndex == 0) rankId = null; libraries = new PeptideLibraries(pick, rankId, peptideCount, documentLibrary, librarySpecs, librariesLoaded); } Helpers.AssignIfEquals(ref libraries, Libraries); // Validate and hold modifications int maxVariableMods; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Modifications, textMaxVariableMods, PeptideModifications.MIN_MAX_VARIABLE_MODS, PeptideModifications.MAX_MAX_VARIABLE_MODS, out maxVariableMods)) return null; int maxNeutralLosses; if (!helper.ValidateNumberTextBox(tabControl1, (int)TABS.Modifications, textMaxNeutralLosses, PeptideModifications.MIN_MAX_NEUTRAL_LOSSES, PeptideModifications.MAX_MAX_NEUTRAL_LOSSES, out maxNeutralLosses)) return null; var standardTypes = _driverLabelType.InternalStandardTypes; PeptideModifications modifications = new PeptideModifications( _driverStaticMod.Chosen, maxVariableMods, maxNeutralLosses, _driverLabelType.GetHeavyModifications(), standardTypes); // Should not be possible to change explicit modifications in the background, // so this should be safe. CONSIDER: Document structure because of a library load? modifications = modifications.DeclareExplicitMods(_parent.DocumentUI, Settings.Default.StaticModList, Settings.Default.HeavyModList); Helpers.AssignIfEquals(ref modifications, _peptideSettings.Modifications); PeptideIntegration integration = new PeptideIntegration(_driverPeakScoringModel.SelectedItem); Helpers.AssignIfEquals(ref integration, Integration); QuantificationSettings quantification = QuantificationSettings.DEFAULT .ChangeNormalizationMethod(comboNormalizationMethod.SelectedItem as NormalizationMethod ?? NormalizationMethod.NONE) .ChangeRegressionWeighting(comboWeighting.SelectedItem as RegressionWeighting) .ChangeRegressionFit(comboRegressionFit.SelectedItem as RegressionFit) .ChangeMsLevel(_quantMsLevels[comboQuantMsLevel.SelectedIndex]) .ChangeUnits(tbxQuantUnits.Text); return new PeptideSettings(enzyme, digest, prediction, filter, libraries, modifications, integration, backgroundProteome) .ChangeAbsoluteQuantification(quantification); }
public PeptideSettings ChangeBackgroundProteome(BackgroundProteome prop) { return ChangeProp(ImClone(this), im => im.BackgroundProteome = prop); }
private static void PasteTransitions(PasteDlg pasteDlg, BackgroundProteome.DuplicateProteinsFilter duplicateProteinsFilter, bool addUnmatched, bool addFiltered) { RunUI(() => pasteDlg.IsMolecule = false); // Make sure it's ready for peptides, not small molecules RunDlg<FilterMatchedPeptidesDlg>(pasteDlg.PasteTransitions, filterMatchedPeptidesDlg => { // Make sure we only count each peptide once for the FilterMatchedPeptidesDlg. Assert.AreEqual(NUM_UNMATCHED_EXPECTED, filterMatchedPeptidesDlg.UnmatchedCount); filterMatchedPeptidesDlg.DuplicateProteinsFilter = duplicateProteinsFilter; filterMatchedPeptidesDlg.AddUnmatched = addUnmatched; filterMatchedPeptidesDlg.AddFiltered = addFiltered; filterMatchedPeptidesDlg.OkDialog(); }); }
private static void PastePeptides(PasteDlg pasteDlg, BackgroundProteome.DuplicateProteinsFilter duplicateProteinsFilter, bool addUnmatched, bool addFiltered) { RunDlg<FilterMatchedPeptidesDlg>(pasteDlg.PastePeptides, filterMatchedPeptidesDlg => { filterMatchedPeptidesDlg.DuplicateProteinsFilter = duplicateProteinsFilter; filterMatchedPeptidesDlg.AddUnmatched = addUnmatched; filterMatchedPeptidesDlg.AddFiltered = addFiltered; filterMatchedPeptidesDlg.OkDialog(); }); }
private static string IsNotLoadedExplained(SrmDocument document, BackgroundProteome backgroundProteome, bool requireResolvedProteinMetadata) { return(DocumentHasLoadedBackgroundProteomeOrNoneExplained(document, backgroundProteome, requireResolvedProteinMetadata)); }
private static string DocumentHasLoadedBackgroundProteomeOrNoneExplained(SrmDocument document, BackgroundProteome backgroundProteome, bool requireResolvedProteinMetadata) { if (backgroundProteome.IsNone) { return(null); } if (!backgroundProteome.DatabaseValidated) { return("BackgroundProteomeManager: !backgroundProteome.DatabaseValidated"); // Not L10N } if (backgroundProteome.DatabaseInvalid) { return(null); } var peptideSettings = document.Settings.PeptideSettings; if (!backgroundProteome.HasDigestion(peptideSettings)) { return("BackgroundProteomeManager: !backgroundProteome.HasDigestion(peptideSettings)"); // Not L10N } if (!requireResolvedProteinMetadata || (!backgroundProteome.NeedsProteinMetadataSearch)) { return(null); } if (backgroundProteome.NeedsProteinMetadataSearch) { return("BackgroundProteomeManager: NeedsProteinMetadataSearch"); // Not L10N } return("BackgroundProteomeManager: requireResolvedProteinMetadata"); // Not L10N }
protected override bool LoadBackground(IDocumentContainer container, SrmDocument document, SrmDocument docCurrent) { // Only allow one background proteome to load at a time. This can // get tricky, if the user performs an undo and then a redo across // a change in background proteome. // Our first priority is doing the digestions, the second is accessing web // services to add missing protein metadata. lock (_lockLoadBackgroundProteome) { BackgroundProteome originalBackgroundProteome = GetBackgroundProteome(docCurrent); // Check to see whether the Digestion already exists but has not been queried yet. BackgroundProteome backgroundProteomeWithDigestions = new BackgroundProteome(originalBackgroundProteome, true); if (IsNotLoadedExplained(docCurrent, backgroundProteomeWithDigestions, true) == null) { // digest is ready, and protein metdata is resolved CompleteProcessing(container, backgroundProteomeWithDigestions); return(true); } // are we here to do the digest, or to resolve the protein metadata? bool getMetadata = (IsNotLoadedExplained(docCurrent, backgroundProteomeWithDigestions, false) == null) && backgroundProteomeWithDigestions.NeedsProteinMetadataSearch; string name = originalBackgroundProteome.Name; ProgressStatus progressStatus = new ProgressStatus(string.Format(getMetadata?Resources.BackgroundProteomeManager_LoadBackground_Resolving_protein_details_for__0__proteome:Resources.BackgroundProteomeManager_LoadBackground_Digesting__0__proteome, name)); try { using (FileSaver fs = new FileSaver(originalBackgroundProteome.DatabasePath, StreamManager)) { File.Copy(originalBackgroundProteome.DatabasePath, fs.SafeName, true); var digestHelper = new DigestHelper(this, container, docCurrent, name, fs.SafeName, true); bool success; if (getMetadata) { success = digestHelper.LookupProteinMetadata(ref progressStatus); } else { success = (digestHelper.Digest(ref progressStatus) != null); } if (!success) { // Processing was canceled EndProcessing(docCurrent); UpdateProgress(progressStatus.Cancel()); return(false); } using (var proteomeDb = ProteomeDb.OpenProteomeDb(originalBackgroundProteome.DatabasePath)) { proteomeDb.DatabaseLock.AcquireWriterLock(int.MaxValue); try { if (!fs.Commit()) { EndProcessing(docCurrent); throw new IOException( string.Format( Resources .BackgroundProteomeManager_LoadBackground_Unable_to_rename_temporary_file_to__0__, fs.RealName)); } } finally { proteomeDb.DatabaseLock.ReleaseWriterLock(); } } CompleteProcessing(container, new BackgroundProteome(originalBackgroundProteome, true)); UpdateProgress(progressStatus.Complete()); return(true); } } catch (Exception x) { var message = new StringBuilder(); message.AppendLine( string.Format(Resources.BackgroundProteomeManager_LoadBackground_Failed_updating_background_proteome__0__, name)); message.Append(x.Message); UpdateProgress(progressStatus.ChangeErrorException(new IOException(message.ToString(), x))); return(false); } } }
public BackgroundProteomeMetadataCache(BackgroundProteome b) { _parent = b; _peptideUniquenessDict = new Dictionary <Target, DigestionPeptideStats>(); // Prepare to cache any peptide uniqueness checks we may do }
public PeptideSettings(Enzyme enzyme, DigestSettings digestSettings, PeptidePrediction prediction, PeptideFilter filter, PeptideLibraries libraries, PeptideModifications modifications, PeptideIntegration integration, BackgroundProteome backgroundProteome ) { Enzyme = enzyme; DigestSettings = digestSettings; Prediction = prediction; Filter = filter; Libraries = libraries; Modifications = modifications; Integration = integration; BackgroundProteome = backgroundProteome; Quantification = QuantificationSettings.DEFAULT; }