Exemple #1
0
        public static SrmDocument RecalculateAlignments(SrmDocument document, IProgressMonitor progressMonitor)
        {
            var             newSources               = ListAvailableRetentionTimeSources(document.Settings);
            var             newResultsSources        = ListSourcesForResults(document.Settings.MeasuredResults, newSources);
            var             allLibraryRetentionTimes = ReadAllRetentionTimes(document, newSources);
            var             newFileAlignments        = new List <FileRetentionTimeAlignments>();
            IProgressStatus progressStatus           = new ProgressStatus(@"Aligning retention times"); // CONSIDER: localize?  Will users see this?

            foreach (var retentionTimeSource in newResultsSources.Values)
            {
                progressStatus = progressStatus.ChangePercentComplete(100 * newFileAlignments.Count / newResultsSources.Count);
                progressMonitor.UpdateProgress(progressStatus);
                try
                {
                    var fileAlignments = CalculateFileRetentionTimeAlignments(retentionTimeSource.Name, allLibraryRetentionTimes, progressMonitor);
                    newFileAlignments.Add(fileAlignments);
                }
                catch (OperationCanceledException)
                {
                    progressMonitor.UpdateProgress(progressStatus.Cancel());
                    return(null);
                }
            }
            var newDocRt    = new DocumentRetentionTimes(newSources.Values, newFileAlignments);
            var newDocument = document.ChangeSettings(document.Settings.ChangeDocumentRetentionTimes(newDocRt));

            Debug.Assert(IsLoaded(newDocument));
            progressMonitor.UpdateProgress(progressStatus.Complete());
            return(newDocument);
        }
Exemple #2
0
 public bool Equals(DocumentRetentionTimes other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other.RetentionTimeSources, RetentionTimeSources) &&
            Equals(other.FileAlignments, FileAlignments));
 }
 public void TestSettings()
 {
     var settings = SrmSettingsList.GetDefault();
     var documentRetentionTimes =
         new DocumentRetentionTimes(
             new[] {new RetentionTimeSource("foo", "fooLibrary"), },
             new[] {new FileRetentionTimeAlignments("foo", new RetentionTimeAlignment[0])}
         );
     var settings2 = settings.ChangeDocumentRetentionTimes(documentRetentionTimes);
     Assert.AreNotEqual(settings, settings2);
     Assert.AreEqual(documentRetentionTimes, settings2.DocumentRetentionTimes);
     var settings3 =
         settings2.ChangeDataSettings(new DataSettings(new[]{new AnnotationDef("foo", AnnotationDef.AnnotationTargetSet.Singleton(AnnotationDef.AnnotationTarget.transition_result), AnnotationDef.AnnotationType.true_false, new string[0])}));
     Assert.AreNotEqual(settings2, settings3);
     Assert.AreEqual(settings2.DocumentRetentionTimes, settings3.DocumentRetentionTimes);
     Assert.AreNotEqual(settings.DocumentRetentionTimes, settings3.DocumentRetentionTimes);
 }
Exemple #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);
        }
Exemple #5
0
 public SrmSettings ChangeDocumentRetentionTimes(DocumentRetentionTimes prop)
 {
     return ChangeProp(ImClone(this), im => im.DocumentRetentionTimes = prop);
 }
Exemple #6
0
        public SrmSettings(string name, PeptideSettings peptideSettings, TransitionSettings transitionSettings, DataSettings dataSettings, DocumentRetentionTimes documentRetentionTimes)
            : base(name)
        {
            PeptideSettings = peptideSettings;
            TransitionSettings = transitionSettings;
            DataSettings = dataSettings;
            DocumentRetentionTimes = documentRetentionTimes;

            // Create cached calculator instances
            CreatePrecursorMassCalcs();
            CreateFragmentMassCalcs();
        }
Exemple #7
0
 protected override string IsNotLoadedExplained(SrmDocument document)
 {
     return(DocumentRetentionTimes.IsNotLoadedExplained(document));
 }
 public bool Equals(DocumentRetentionTimes other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other.RetentionTimeSources, RetentionTimeSources) &&
            Equals(other.FileAlignments, FileAlignments);
 }
 public static SrmDocument RecalculateAlignments(SrmDocument document, IProgressMonitor progressMonitor)
 {
     var newSources = ListAvailableRetentionTimeSources(document.Settings);
     var newResultsSources = ListSourcesForResults(document.Settings.MeasuredResults, newSources);
     var allLibraryRetentionTimes = ReadAllRetentionTimes(document, newSources);
     var newFileAlignments = new List<FileRetentionTimeAlignments>();
     var progressStatus = new ProgressStatus("Aligning retention times"); // Not L10N?  Will users see this?
     foreach (var retentionTimeSource in newResultsSources.Values)
     {
         progressStatus = progressStatus.ChangePercentComplete(100*newFileAlignments.Count/newResultsSources.Count);
         progressMonitor.UpdateProgress(progressStatus);
         try
         {
             var fileAlignments = CalculateFileRetentionTimeAlignments(retentionTimeSource.Name, allLibraryRetentionTimes, progressMonitor);
             newFileAlignments.Add(fileAlignments);
         }
         catch (OperationCanceledException)
         {
             progressMonitor.UpdateProgress(progressStatus.Cancel());
             return null;
         }
     }
     var newDocRt = new DocumentRetentionTimes(newSources.Values, newFileAlignments);
     var newDocument = document.ChangeSettings(document.Settings.ChangeDocumentRetentionTimes(newDocRt));
     Debug.Assert(IsLoaded(newDocument));
     progressMonitor.UpdateProgress(progressStatus.Complete());
     return newDocument;
 }