コード例 #1
0
        protected override bool LoadBackground(IDocumentContainer container, SrmDocument document,
                                               SrmDocument docCurrent)
        {
            if (!FastaImporter.HasWebAccess()) // Do we even have web access?
            {
                EndProcessing(container.Document);
                return(false); // Return silently rather than flashing the progress bar
            }
            SrmDocument docNew, docOrig;

            do
            {
                docOrig = container.Document;
                var loadMonitor = new LoadMonitor(this, container, docOrig);
                docNew = LookupProteinMetadata(docOrig, loadMonitor);
                if (null == docNew)
                {
                    EndProcessing(docOrig);
                    return(false);
                }
            } while (!CompleteProcessing(container, docNew, docOrig));

            CleanupProcessedNodesDict(docNew);  // Drop any completed work, we're done with it

            return(true);
        }
コード例 #2
0
        protected override bool LoadBackground(IDocumentContainer container, SrmDocument document, SrmDocument docCurrent)
        {
            var loadMonitor = new LoadMonitor(this, container, container.Document);

            IPeakScoringModel scoringModel = new MProphetPeakScoringModel(
                Path.GetFileNameWithoutExtension(container.DocumentFilePath), null as LinearModelParams,
                MProphetPeakScoringModel.GetDefaultCalculators(docCurrent), true);

            var targetDecoyGenerator = new TargetDecoyGenerator(docCurrent, scoringModel, this, loadMonitor);

            // Get scores for target and decoy groups.
            List <IList <float[]> > targetTransitionGroups, decoyTransitionGroups;

            targetDecoyGenerator.GetTransitionGroups(out targetTransitionGroups, out decoyTransitionGroups);
            if (!decoyTransitionGroups.Any())
            {
                throw new InvalidDataException();
            }

            // Set intial weights based on previous model (with NaN's reset to 0)
            var initialWeights = new double[scoringModel.PeakFeatureCalculators.Count];

            // But then set to NaN the weights that have unknown values for this dataset
            for (var i = 0; i < initialWeights.Length; ++i)
            {
                if (!targetDecoyGenerator.EligibleScores[i])
                {
                    initialWeights[i] = double.NaN;
                }
            }
            var initialParams = new LinearModelParams(initialWeights);

            // Train the model.
            scoringModel = scoringModel.Train(targetTransitionGroups, decoyTransitionGroups, targetDecoyGenerator, initialParams, null, null, scoringModel.UsesSecondBest, true, loadMonitor);

            SrmDocument docNew;

            do
            {
                docCurrent = container.Document;
                docNew     = docCurrent.ChangeSettings(docCurrent.Settings.ChangePeptideIntegration(i =>
                                                                                                    i.ChangeAutoTrain(false).ChangePeakScoringModel((PeakScoringModelSpec)scoringModel)));

                // Reintegrate peaks
                var resultsHandler = new MProphetResultsHandler(docNew, (PeakScoringModelSpec)scoringModel, _cachedFeatureScores);
                resultsHandler.ScoreFeatures(loadMonitor);
                if (resultsHandler.IsMissingScores())
                {
                    throw new InvalidDataException(Resources.ImportPeptideSearchManager_LoadBackground_The_current_peak_scoring_model_is_incompatible_with_one_or_more_peptides_in_the_document_);
                }
                docNew = resultsHandler.ChangePeaks(loadMonitor);
            }while (!CompleteProcessing(container, docNew, docCurrent));

            return(true);
        }
コード例 #3
0
 protected override bool LoadBackground(IDocumentContainer container, SrmDocument document, SrmDocument docCurrent)
 {
     SrmDocument docNew, docOrig;
     do
     {
         docOrig = container.Document;
         var loadMonitor = new LoadMonitor(this, container, docOrig);
         docNew = DocumentRetentionTimes.RecalculateAlignments(docOrig, loadMonitor);
         if (null == docNew)
         {
             EndProcessing(docOrig);
             return false;
         }
     }
     while (!CompleteProcessing(container, docNew, docOrig));
     return true;
 }
コード例 #4
0
        protected override bool LoadBackground(IDocumentContainer container, SrmDocument document, SrmDocument docCurrent)
        {
            SrmDocument docNew, docOrig;

            do
            {
                docOrig = container.Document;
                var loadMonitor = new LoadMonitor(this, container, docOrig);
                docNew = DocumentRetentionTimes.RecalculateAlignments(docOrig, loadMonitor);
                if (null == docNew)
                {
                    EndProcessing(docOrig);
                    return(false);
                }
            }while (!CompleteProcessing(container, docNew, docOrig));
            return(true);
        }
コード例 #5
0
            public void Load()
            {
                string documentFilePath = _container.DocumentFilePath;

                if (documentFilePath == null)
                {
                    return;
                }

                var results = _docCurrent.Settings.MeasuredResults;

                if (results.IsLoaded)
                {
                    return;
                }

                var loadMonitor = new LoadMonitor(_manager, _container, results)
                {
                    HasUI = _manager.SupportAllGraphs
                };

                results.Load(_docCurrent, documentFilePath, loadMonitor, FinishLoad);
            }
コード例 #6
0
ファイル: Chromatogram.cs プロジェクト: lgatto/proteowizard
            public void Load()
            {
                string documentFilePath = _container.DocumentFilePath;
                if (documentFilePath == null)
                    return;

                var results = _docCurrent.Settings.MeasuredResults;
                if (results.IsLoaded)
                    return;

                var loadMonitor = new LoadMonitor(_manager, _container, results) {HasUI = _manager.SupportAllGraphs};
                results.Load(_docCurrent, documentFilePath, loadMonitor, FinishLoad);
            }
コード例 #7
0
        protected override bool LoadBackground(IDocumentContainer container, SrmDocument document,
            SrmDocument docCurrent)
        {
            if (!FastaImporter.HasWebAccess()) // Do we even have web access?
                return false; // Return silently rather than flashing the progress bar

            SrmDocument docNew, docOrig;
            do
            {
                docOrig = container.Document;
                var loadMonitor = new LoadMonitor(this, container, docOrig);
                docNew = LookupProteinMetadata(docOrig, loadMonitor);
                if (null == docNew)
                {
                    EndProcessing(docOrig);
                    return false;
                }

            } while (!CompleteProcessing(container, docNew, docOrig));

            CleanupProcessedNodesDict(docNew);  // Drop any completed work, we're done with it

            return true;
        }