Beispiel #1
0
        public void SetData(WorkspaceData data, WorkspaceData savedData)
        {
            if (Equals(Data, data) && Equals(SavedData, savedData))
            {
                return;
            }
            var workspaceChange = new WorkspaceChangeArgs(Data, SavedData);

            _data = data;
            _savedWorkspaceData = savedData;
            _tracerDefList      = null;
            RetentionTimeAlignments.SetData(Data);
            Settings.Update(workspaceChange);
            Modifications.Update(workspaceChange);
            TracerDefs.Update(workspaceChange);
            Peptides.Update(workspaceChange);
            MsDataFiles.Update(workspaceChange);
            PeptideAnalyses.Update(workspaceChange);
            var changeHandlers = Change;

            if (null != changeHandlers)
            {
                changeHandlers(this, workspaceChange);
            }
        }
Beispiel #2
0
 protected override void Diff(WorkspaceChangeArgs workspaceChange, ImmutableSortedList <string, double> newValues, ImmutableSortedList <string, double> oldValues)
 {
     if (!Equals(newValues, oldValues))
     {
         workspaceChange.AddChromatogramMassChange();
     }
 }
Beispiel #3
0
        public WorkspaceChangeArgs CompareSettings(Workspace workspace)
        {
            WorkspaceChangeArgs workspaceChange = new WorkspaceChangeArgs(workspace);

            DiffSettings(workspaceChange);
            return(workspaceChange);
        }
Beispiel #4
0
 protected override void Diff(WorkspaceChangeArgs workspaceChange, ImmutableSortedList <string, TracerDefData> newValues, ImmutableSortedList <string, TracerDefData> oldValues)
 {
     if (!Equals(newValues.Keys, oldValues.Keys))
     {
         workspaceChange.AddChromatogramMassChange();
         return;
     }
     for (int i = 0; i < newValues.Count; i++)
     {
         var newValue = newValues.Values[i];
         var oldValue = oldValues.Values[i];
         if (!newValue.EqualMasses(oldValue))
         {
             workspaceChange.AddChromatogramMassChange();
         }
         if (!newValue.EqualPeakPicking(oldValue))
         {
             workspaceChange.AddPeakPickingChange();
         }
     }
     if (!Equals(newValues, oldValues))
     {
         workspaceChange.AddSettingChange();
     }
 }
 private void BtnRecalculateResultsOnClick(object sender, EventArgs e)
 {
     var change = new WorkspaceChangeArgs(Workspace.Data, Workspace.SavedData);
     change.AddPeakPickingChange();
     UpdateWorkspaceVersion(change);
     Workspace.ResultCalculator.SetRequeryPending();
     RefreshStats();
 }
Beispiel #6
0
        public void Diff(WorkspaceChangeArgs workspaceChange)
        {
            var oldData = GetData(workspaceChange.OriginalData);
            var newData = Data;

            if (null != oldData && null != newData && !Equals(oldData, newData))
            {
                Diff(workspaceChange, oldData, newData);
            }
        }
Beispiel #7
0
        public override void Update(WorkspaceChangeArgs workspaceChange, PeptideAnalysisData data)
        {
            bool invalidatePeaks = workspaceChange.HasPeakPickingChange || data.CheckRecalculatePeaks(Data);

            base.Update(workspaceChange, data);
            FileAnalyses.Update(workspaceChange);
            if (invalidatePeaks)
            {
                InvalidatePeaks();
            }
        }
        private void BtnRegenerateChromatogramsOnClick(object sender, EventArgs e)
        {
            if (MessageBox.Show(this, "Are you sure you want to delete all of the chromatograms in this workspace?  Regenerating chromatograms can take a really long time.", Program.AppName, MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }

            var change = new WorkspaceChangeArgs(Workspace.Data, Workspace.SavedData);
            change.AddChromatogramMassChange();

            UpdateWorkspaceVersion(change);
            Workspace.ChromatogramGenerator.SetRequeryPending();
            RefreshStats();
        }
Beispiel #9
0
        public virtual void Update(WorkspaceChangeArgs workspaceChange)
        {
            if (null == _entityList)
            {
                return;
            }
            var  newData = GetData(Workspace.Data) ?? ImmutableSortedList <TKey, TData> .EMPTY;
            var  newKeys = new HashSet <TKey>(newData.Keys);
            bool changed = !Equals(newData.Keys, _entityList.Keys);

            if (changed)
            {
                var entities = new Dictionary <TKey, TEntity>(_entityList.AsDictionary());
                foreach (var key in newKeys)
                {
                    TEntity entity;
                    if (!entities.TryGetValue(key, out entity))
                    {
                        TData itemData;
                        newData.TryGetValue(key, out itemData);
                        entities.Add(key, CreateEntityForKey(key, itemData));
                    }
                }
                _entityList = ImmutableSortedList.FromValues(entities, _entityList.KeyComparer);
            }
            foreach (var entity in _entityList.Values)
            {
                TData itemData;
                var   key = GetKey(entity);
                newData.TryGetValue(key, out itemData);
                entity.Update(workspaceChange, itemData);
            }
            if (changed)
            {
                var listChanged = ListChanged;
                if (listChanged != null)
                {
                    listChanged(this, new ListChangedEventArgs(ListChangedType.Reset, -1));
                }
            }
        }
Beispiel #10
0
        protected override void Diff(WorkspaceChangeArgs workspaceChange, ImmutableSortedList <string, string> newValues, ImmutableSortedList <string, string> oldValues)
        {
            var differences = new HashSet <KeyValuePair <string, string> >(newValues);

            differences.SymmetricExceptWith(oldValues);
            var diffKeys = new HashSet <string>(differences.Select(pair => pair.Key));

            if (diffKeys.Contains(SettingEnum.mass_accuracy.ToString()))
            {
                workspaceChange.AddPeakPickingChange();
            }
            if (diffKeys.Contains(SettingEnum.max_isotope_retention_time_shift.ToString()))
            {
                workspaceChange.AddTurnoverChange();
            }
            if (diffKeys.Contains(SettingEnum.err_on_side_of_lower_abundance.ToString()))
            {
                workspaceChange.AddTurnoverChange();
            }
            if (diffKeys.Any())
            {
                workspaceChange.AddSettingChange();
            }
        }
Beispiel #11
0
 protected virtual void WorkspaceOnChange(object sender, WorkspaceChangeArgs args)
 {
 }
Beispiel #12
0
 public void UpdateWorkspaceVersion(LongOperationBroker longOperationBroker, ISession session, WorkspaceChangeArgs savedWorkspaceChange)
 {
     if (savedWorkspaceChange.HasChromatogramMassChange)
     {
         longOperationBroker.UpdateStatusMessage("Deleting chromatograms");
         session.CreateSQLQuery("DELETE FROM DbChromatogram")
         .ExecuteUpdate();
         session.CreateSQLQuery("UPDATE DbPeptideFileAnalysis SET ChromatogramSet = NULL, PeakCount = 0")
         .ExecuteUpdate();
         session.CreateSQLQuery("DELETE FROM DbChromatogramSet").ExecuteUpdate();
         session.CreateSQLQuery("DELETE FROM DbLock").ExecuteUpdate();
     }
     if (savedWorkspaceChange.HasTurnoverChange)
     {
         session.CreateSQLQuery("UPDATE DbPeptideFileAnalysis SET TracerPercent = NULL")
         .ExecuteUpdate();
         if (savedWorkspaceChange.HasPeakPickingChange)
         {
             if (!savedWorkspaceChange.HasChromatogramMassChange)
             {
                 session.CreateSQLQuery("UPDATE DbPeptideFileAnalysis SET PeakCount = 0")
                 .ExecuteUpdate();
             }
             longOperationBroker.UpdateStatusMessage("Deleting peaks");
             session.CreateSQLQuery("DELETE FROM DbPeak").ExecuteUpdate();
         }
         if (!savedWorkspaceChange.HasChromatogramMassChange)
         {
             session.CreateSQLQuery("DELETE FROM DbLock WHERE LockType = " + (int)LockType.results).ExecuteUpdate();
         }
     }
 }
Beispiel #13
0
 protected override void WorkspaceOnChange(object sender, WorkspaceChangeArgs args)
 {
     UpdateRows(true);
 }
Beispiel #14
0
 public void Update(WorkspaceChangeArgs workspaceChange)
 {
     Diff(workspaceChange);
 }
Beispiel #15
0
 public void DiffSettings(WorkspaceChangeArgs workspaceChange)
 {
     Settings.Diff(workspaceChange);
     Modifications.Diff(workspaceChange);
     TracerDefs.Diff(workspaceChange);
 }
Beispiel #16
0
 protected abstract void Diff(WorkspaceChangeArgs workspaceChange,
                              ImmutableSortedList <TKey, TValue> newValues,
                              ImmutableSortedList <TKey, TValue> oldValues);
 protected override void WorkspaceOnChange(object sender, WorkspaceChangeArgs args)
 {
     base.WorkspaceOnChange(sender, args);
     if (args.HasSettingChange)
     {
         UpdateUi();
     }
 }
 protected override void WorkspaceOnChange(object sender, WorkspaceChangeArgs change)
 {
     base.WorkspaceOnChange(sender, change);
     RefreshUi(true);
 }
Beispiel #19
0
 private void WorkspaceOnChange(object sender, WorkspaceChangeArgs args)
 {
     UpdateAll();
 }
 public void WorkspaceOnChange(object sender, WorkspaceChangeArgs args)
 {
     _eventWaitHandle.Set();
 }
 // ReSharper disable AccessToDisposedClosure
 private void UpdateWorkspaceVersion(WorkspaceChangeArgs v)
 {
     using (var session = Workspace.OpenSession())
     {
         using (var longWaitDialog = new LongWaitDialog(TopLevelControl, "Updating Workspace"))
         {
             var broker = new LongOperationBroker(b =>
             {
                 session.BeginTransaction();
                 Workspace.UpdateWorkspaceVersion(b, session, v);
                 session.Transaction.Commit();
             }, longWaitDialog, session);
             broker.LaunchJob();
         }
     }
 }
Beispiel #22
0
 protected virtual void WorkspaceOnChange(object sender, WorkspaceChangeArgs change)
 {
     UpdateStepStatus();
 }
Beispiel #23
0
 public void CompareValues(WorkspaceChangeArgs workspaceChange, ImmutableSortedList <TKey, TValue> newValues)
 {
     Diff(workspaceChange, newValues, Data);
 }
 protected override void WorkspaceOnChange(object sender, WorkspaceChangeArgs args)
 {
     base.WorkspaceOnChange(sender, args);
     if (null == Workspace.PeptideAnalyses.FindByKey(PeptideAnalysis.Id))
     {
         Close();
     }
 }