Esempio n. 1
0
        /// <summary>
        /// Returns the ReplicateGroupOp based on the current value of Settings.Default.GroupByReplicateAnnotation,
        /// and the specified AggregateOp.  Note that if the ReplicateGroupOp is not grouping on an annotation,
        /// the AggregateOp will be override with the value MEAN.
        /// </summary>
        public static ReplicateGroupOp FromCurrentSettings(SrmDocument document, GraphValues.AggregateOp aggregateOp)
        {
            ReplicateValue replicateValue = null;
            string         annotationName = Settings.Default.GroupByReplicateAnnotation;

            if (null != annotationName)
            {
                replicateValue = ReplicateValue.GetGroupableReplicateValues(document)
                                 .FirstOrDefault(value => value.ToPersistedString() == annotationName);
            }
            if (null == replicateValue)
            {
                aggregateOp = GraphValues.AggregateOp.MEAN;
            }
            return(new ReplicateGroupOp(replicateValue, aggregateOp));
        }
Esempio n. 2
0
        public void OnDocumentChanged(SrmDocument oldDocument, SrmDocument newDocument)
        {
            var settingsNew = newDocument.Settings;
            var settingsOld = oldDocument.Settings;

            if (GraphSummary.Type == GraphTypeSummary.histogram || GraphSummary.Type == GraphTypeSummary.histogram2d)
            {
                if (GroupByGroup != null && !ReferenceEquals(settingsNew.DataSettings.AnnotationDefs, settingsOld.DataSettings.AnnotationDefs))
                {
                    var groups = ReplicateValue.GetGroupableReplicateValues(newDocument);
                    // The group we were grouping by has been removed
                    if (groups.All(group => group.ToPersistedString() != GroupByGroup))
                    {
                        GroupByAnnotation = GroupByGroup = null;
                    }
                }

                if (GroupByAnnotation != null && settingsNew.HasResults && settingsOld.HasResults &&
                    !ReferenceEquals(settingsNew.MeasuredResults.Chromatograms, settingsOld.MeasuredResults.Chromatograms))
                {
                    var annotations = AnnotationHelper.GetPossibleAnnotations(newDocument, ReplicateValue.FromPersistedString(settingsNew, GroupByGroup));

                    // The annotation we were grouping by has been removed
                    if (!annotations.Contains(GroupByAnnotation))
                    {
                        GroupByAnnotation = null;
                    }

                    var paneInfo = GraphSummary.GraphPanes.FirstOrDefault() as IAreaCVHistogramInfo;
                    if (paneInfo != null)
                    {
                        paneInfo.Cache.Cancel();
                    }
                }
            }
        }