Ejemplo n.º 1
0
        /// <summary>
        /// Конструктор
        /// </summary>
        public ViewNode(ViewSettings.ViewItem viewItem, ViewSpec viewSpec)
        {
            if (viewItem == null)
            {
                throw new ArgumentNullException("viewItem");
            }

            ViewID      = viewItem.ViewID;
            Text        = viewItem.Text ?? "";
            AlarmCnlNum = viewItem.AlarmCnlNum;
            ViewSpec    = viewSpec;

            if (ViewSpec == null)
            {
                ViewUrl = "";
                Url     = "";
                Script  = "";
                IconUrl = "";
            }
            else
            {
                ViewUrl = VirtualPathUtility.ToAbsolute(ViewSpec.GetUrl(ViewID));
                Url     = VirtualPathUtility.ToAbsolute(string.Format(UrlTemplates.View, ViewID));
                Script  = string.Format(ScriptTemplate, ViewID, ViewUrl);
                IconUrl = VirtualPathUtility.ToAbsolute(ViewSpec.IconUrl);
            }

            Level      = -1;
            ChildNodes = new List <ViewNode>();
            InitDataAttrs();
        }
Ejemplo n.º 2
0
        void CommitFilterOpCombo()
        {
            var dataGridViewComboBoxEditingControl = dataGridViewFilter.EditingControl as DataGridViewComboBoxEditingControl;

            if (dataGridViewComboBoxEditingControl == null || dataGridViewFilter.CurrentRow == null)
            {
                return;
            }
            var rowIndex        = dataGridViewFilter.CurrentRow.Index;
            var filterOperation = FilterOperationFromDisplayName(dataGridViewComboBoxEditingControl.Text);

            if (filterOperation == null)
            {
                return;
            }
            if (filterOperation == ViewInfo.Filters[rowIndex].FilterSpec.Operation)
            {
                return;
            }
            var newFilters       = ViewSpec.Filters.ToArray();
            var columnDescriptor = ViewInfo.Filters[rowIndex].ColumnDescriptor;

            newFilters[rowIndex] = newFilters[rowIndex].SetPredicate(
                FilterPredicate.CreateFilterPredicate(columnDescriptor.DataSchema, columnDescriptor.PropertyType, filterOperation,
                                                      dataGridViewFilter.CurrentRow.Cells[colFilterOperand.Index].Value as string));
            ViewSpec = ViewSpec.SetFilters(newFilters);
        }
Ejemplo n.º 3
0
        public void ShowPreview()
        {
            Debug.Assert(PreviewButtonVisible);
            var viewInfo = new ViewInfo(ViewInfo.ParentColumn, ViewSpec.SetName(ViewName));

            ViewContext.Preview(this, viewInfo);
        }
Ejemplo n.º 4
0
        private ViewInfo GetTestReport(SkylineDataSchema dataSchema)
        {
            var      serializer = new XmlSerializer(typeof(ViewSpecList));
            ViewSpec viewSpec   = ((ViewSpecList)serializer.Deserialize(new StringReader(TestReport))).ViewSpecs.First();

            return(new ViewInfo(dataSchema, typeof(Skyline.Model.Databinding.Entities.Transition), viewSpec));
        }
Ejemplo n.º 5
0
        private ViewSpec GetClusteredViewSpec(ViewSpec defaultViewSpec)
        {
            var clusteredViewSpec = defaultViewSpec.SetName(CLUSTERED_VIEW_NAME).SetRowType(typeof(FoldChangeDetailRow));

            PropertyPath ppRunAbundance = PropertyPath.Root.Property(nameof(FoldChangeDetailRow.ReplicateAbundances)).DictionaryValues();
            PropertyPath ppFoldChange   = PropertyPath.Root.Property(nameof(FoldChangeDetailRow.FoldChangeResults))
                                          .DictionaryValues();
            var columnsToAdd           = new List <PropertyPath>();
            var columnPrefixesToRemove = new List <PropertyPath>()
            {
                PropertyPath.Root.Property(nameof(FoldChangeRow.FoldChangeResult)),
                PropertyPath.Root.Property(nameof(FoldChangeRow.Group))
            };

            columnsToAdd.Add(ppFoldChange);
            columnsToAdd.Add(ppFoldChange.Property(nameof(FoldChangeResult.AdjustedPValue)));
            if (!string.IsNullOrEmpty(GroupComparisonModel.GroupComparisonDef.IdentityAnnotation))
            {
                columnsToAdd.Add(ppRunAbundance.Property(nameof(ReplicateRow.ReplicateSampleIdentity)));
            }
            columnsToAdd.Add(ppRunAbundance.Property(nameof(ReplicateRow.ReplicateGroup)));
            columnsToAdd.Add(ppRunAbundance.Property(nameof(ReplicateRow.Abundance)));
            clusteredViewSpec = clusteredViewSpec.SetColumns(clusteredViewSpec.Columns
                                                             .Where(col => !columnPrefixesToRemove.Any(prefix => col.PropertyPath.StartsWith(prefix)))
                                                             .Concat(columnsToAdd.Select(col => new ColumnSpec(col))));
            return(clusteredViewSpec);
        }
Ejemplo n.º 6
0
        public void TestDataBindingSubList()
        {
            var boundDataGridView = new BoundDataGridView
            {
                BindingContext = new BindingContext(),
                DataSource     = new BindingListSource(),
            };

            using (boundDataGridView)
            {
                var columnIds = new[]
                {
                    PropertyPath.Root,
                    PropertyPath.Parse("Sequence"),
                    PropertyPath.Parse("AminoAcidsList!*.Code"),
                    PropertyPath.Parse("Molecule!*"),
                };
                var viewSpec = new ViewSpec()
                               .SetColumns(columnIds.Select(id => new ColumnSpec().SetPropertyPath(id)))
                               .SetSublistId(PropertyPath.Parse("AminoAcidsList!*"));
                var viewInfo = new ViewInfo(new DataSchema(), typeof(LinkValue <Peptide>), viewSpec);
                // ReSharper disable once UseObjectOrCollectionInitializer
                var innerList = new BindingList <LinkValue <Peptide> >();
                innerList.Add(new LinkValue <Peptide>(new Peptide("AD"), null));
                ((BindingListSource)boundDataGridView.DataSource).SetViewContext(new TestViewContext(viewInfo.DataSchema, new[] { new RowSourceInfo(BindingListRowSource.Create(innerList), viewInfo) }));
                Assert.AreEqual(2, boundDataGridView.Rows.Count);
                innerList.Add(new LinkValue <Peptide>(new Peptide("TISE"), null));
                Assert.AreEqual(6, boundDataGridView.Rows.Count);
            }
        }
Ejemplo n.º 7
0
        public PeptideAnalysesForm(Workspace workspace) : base(workspace)
        {
            InitializeComponent();
            TabText          = Name = Title;
            _peptideAnalyses = new PeptideAnalysisRows(Workspace.PeptideAnalyses);
            var viewContext = new TopographViewContext(Workspace, typeof(PeptideAnalysisRow), _peptideAnalyses)
            {
                DeleteHandler = new PeptideAnalysisDeleteHandler(this),
            };
            var idPathPeptideAnalysis = PropertyPath.Root.Property("PeptideAnalysis");
            var idPathPeptide         = idPathPeptideAnalysis.Property("Peptide");
            var viewSpec = new ViewSpec()
                           .SetName(AbstractViewContext.DefaultViewName)
                           .SetColumns(
                new[]
            {
                new ColumnSpec(PropertyPath.Root.Property("Peptide")),
                new ColumnSpec(PropertyPath.Root.Property("ValidationStatus")),
                new ColumnSpec(idPathPeptideAnalysis.Property("Note")),
                new ColumnSpec(idPathPeptide.Property("ProteinName")),
                new ColumnSpec(idPathPeptide.Property("ProteinDescription")),
                new ColumnSpec(idPathPeptide.Property("MaxTracerCount")),
                new ColumnSpec(PropertyPath.Root.Property("FileAnalysisCount")),
                new ColumnSpec(PropertyPath.Root.Property("MinScore")),
                new ColumnSpec(PropertyPath.Root.Property("MaxScore")),
            });

            bindingListSource1.SetViewContext(viewContext);
            bindingListSource1.RowSource = _peptideAnalyses;
        }
Ejemplo n.º 8
0
        private static IList <ViewFactory> MakeFactories(EventType parentEventType, IList <ViewSpec> viewSpecs)
        {
            ViewServiceImpl  svc           = new ViewServiceImpl();
            ViewFactoryChain viewFactories = svc.CreateFactories(1, parentEventType, ViewSpec.ToArray(viewSpecs), new StreamSpecOptions(), SupportStatementContextFactory.MakeContext());

            return(viewFactories.FactoryChain);
        }
Ejemplo n.º 9
0
 public void TestDataBindingSubList()
 {
     var boundDataGridView = new BoundDataGridView
                                 {
                                     BindingContext = new BindingContext(),
                                     DataSource = new BindingListSource(),
                                 };
     using (boundDataGridView)
     {
         var columnIds = new[]
                             {
                                 PropertyPath.Root,
                                 PropertyPath.Parse("Sequence"),
                                 PropertyPath.Parse("AminoAcidsList!*.Code"),
                                 PropertyPath.Parse("Molecule!*"),
                             };
         var viewSpec = new ViewSpec()
             .SetColumns(columnIds.Select(id => new ColumnSpec().SetPropertyPath(id)))
             .SetSublistId(PropertyPath.Parse("AminoAcidsList!*"));
         var viewInfo = new ViewInfo(new DataSchema(), typeof (LinkValue<Peptide>), viewSpec);
         // ReSharper disable once UseObjectOrCollectionInitializer
         var innerList = new BindingList<LinkValue<Peptide>>();
         innerList.Add(new LinkValue<Peptide>(new Peptide("AD"), null));
         ((BindingListSource)boundDataGridView.DataSource).SetViewContext(new TestViewContext(viewInfo.DataSchema, new[]{new RowSourceInfo(innerList, viewInfo)}));
         Assert.AreEqual(2, boundDataGridView.Rows.Count);
         innerList.Add(new LinkValue<Peptide>(new Peptide("TISE"), null));
         Assert.AreEqual(6, boundDataGridView.Rows.Count);
     }
 }
Ejemplo n.º 10
0
        public void ApplyView(ViewGroup viewGroup, ViewSpec viewSpec)
        {
            var viewInfo = ViewContext.GetViewInfo(viewGroup, viewSpec);

            BindingListSource.SetViewContext(ViewContext, viewInfo);
            RefreshUi();
        }
Ejemplo n.º 11
0
        private ColumnDescriptor GetColumnDescriptor(DatabindingTableAttribute databindingTable, PropertyPath identifierPath)
        {
            identifierPath = PropertyPath.Parse(databindingTable.Property).Concat(identifierPath);
            var viewSpec = new ViewSpec().SetColumns(new[] { new ColumnSpec(identifierPath) });
            var viewInfo = new ViewInfo(DataSchema, databindingTable.RootTable, viewSpec);

            return(viewInfo.DisplayColumns.First().ColumnDescriptor);
        }
Ejemplo n.º 12
0
        public ResultsPerReplicateForm(Workspace workspace) : base(workspace)
        {
            InitializeComponent();
            bool hasTimePoints   = Workspace.MsDataFiles.Count(f => f.TimePoint != null) != 0;
            bool hasCohorts      = Workspace.MsDataFiles.Count(f => f.Cohort != null) != 0;
            bool hasSamples      = Workspace.MsDataFiles.Count(f => f.Sample != null) != 0;
            bool hasTracerDefs   = Workspace.GetTracerDefs().Count != 0;
            bool hasOneTracerDef = Workspace.GetTracerDefs().Count == 1;
            var  defaultColumns  = new List <ColumnSpec>
            {
                new ColumnSpec().SetName("Accept"),
                new ColumnSpec().SetName("Peptide"),
                new ColumnSpec().SetName("DataFile.Name").SetCaption("DataFile"),
                new ColumnSpec().SetName("Area"),
            };

            if (hasTracerDefs)
            {
                defaultColumns.Add(new ColumnSpec().SetName("TracerPercent"));
            }
            defaultColumns.Add(new ColumnSpec().SetName("DeconvolutionScore"));
            if (hasCohorts)
            {
                defaultColumns.Add(new ColumnSpec().SetName("DataFile.Cohort"));
            }
            if (hasTimePoints)
            {
                defaultColumns.Add(new ColumnSpec().SetName("DataFile.TimePoint"));
            }
            if (hasSamples)
            {
                defaultColumns.Add(new ColumnSpec().SetName("DataFile.Sample"));
            }
            if (hasTracerDefs)
            {
                defaultColumns.AddRange(new[] { new ColumnSpec().SetName("IndividualTurnover.PrecursorEnrichment").SetCaption("Ind Precursor Enrichment"),
                                                new ColumnSpec().SetName("IndividualTurnover.Turnover").SetCaption("Ind Turnover"),
                                                new ColumnSpec().SetName("IndividualTurnover.Score").SetCaption("Ind Turnover Score"), });
            }
            defaultColumns.AddRange(new[] { new ColumnSpec().SetName("Peptide.ProteinName").SetCaption("Protein"),
                                            new ColumnSpec().SetName("Peptide.ProteinDescription"), });
            if (hasOneTracerDef)
            {
                defaultColumns.AddRange(new[] { new ColumnSpec().SetName("AverageTurnover.PrecursorEnrichment").SetCaption("Avg Precursor Enrichment"),
                                                new ColumnSpec().SetName("AverageTurnover.Turnover").SetCaption("Avg Turnover"),
                                                new ColumnSpec().SetName("AverageTurnover.Score").SetCaption("Avg Turnover Score"), });
            }
            defaultColumns.AddRange(new[] { new ColumnSpec().SetName("Status"),
                                            new ColumnSpec().SetName("PsmCount"),
                                            new ColumnSpec().SetName("PeakIntegrationNote"), });
            var defaultViewSpec = new ViewSpec()
                                  .SetName("default")
                                  .SetColumns(defaultColumns);

            bindingSourceResults.SetViewContext(new TopographViewContext(workspace, typeof(PerReplicateResult), new PerReplicateResult[0], new[] { defaultViewSpec }));
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Gets a specification of the specified view.
        /// </summary>
        public bool GetViewSpec(int viewID, out ViewSpec viewSpec, out string errMsg)
        {
            if (!ValidateView(viewID, out View viewEntity, out errMsg))
            {
                viewSpec = null;
                return(false);
            }

            return(GetViewSpec(viewEntity, out viewSpec, out errMsg));
        }
Ejemplo n.º 14
0
        public override int GetImageIndex(ViewSpec viewSpec)
        {
            int imageIndex;

            if (_imageIndexes.TryGetValue(viewSpec.RowSource, out imageIndex))
            {
                return(imageIndex);
            }
            return(-1);
        }
Ejemplo n.º 15
0
        private void AddFilter(ColumnDescriptor columnDescriptor)
        {
            var newFilters = new List <FilterSpec>(ViewSpec.Filters)
            {
                new FilterSpec(columnDescriptor.PropertyPath, FilterPredicate.HAS_ANY_VALUE)
            };

            SetViewSpec(ViewSpec.SetFilters(newFilters), null);
            dataGridViewFilter.CurrentCell = dataGridViewFilter.Rows[dataGridViewFilter.Rows.Count - 1].Cells[colFilterOperation.Index];
        }
Ejemplo n.º 16
0
        private void RemoveColumns(IEnumerable <IdentifierPath> identifierPaths)
        {
            var hashSet  = new HashSet <IdentifierPath>(identifierPaths);
            var newItems = ViewSpec.Columns.Where(columnSpec => !hashSet.Contains(columnSpec.IdentifierPath)).ToArray();

            if (newItems.Count() == ViewSpec.Columns.Count)
            {
                return;
            }
            ViewSpec = ViewSpec.SetColumns(newItems);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Add merge views for any views in the chain requiring a merge (group view).
        /// Appends to the list of view specifications passed in one ore more
        /// new view specifications that represent merge views.
        /// Merge views have the same parameter list as the (group) view they merge data for.
        /// </summary>
        /// <param name="specifications">is a list of view definitions defining the chain of views.</param>
        /// <exception cref="ViewProcessingException">indicating that the view chain configuration is invalid</exception>
        internal static void AddMergeViews(IList <ViewSpec> specifications)
        {
            if (Log.IsDebugEnabled)
            {
                Log.Debug(".addMergeViews Incoming specifications=" + specifications.Render());
            }

            // A grouping view requires a merge view and cannot be last since it would not group sub-views
            if (specifications.Count > 0)
            {
                var lastView = specifications[specifications.Count - 1];
                var viewEnum = ViewEnumExtensions.ForName(lastView.ObjectNamespace, lastView.ObjectName);
                if ((viewEnum != null) && (viewEnum.Value.GetMergeView() != null))
                {
                    throw new ViewProcessingException(
                              "Invalid use of the '" +
                              lastView.ObjectName +
                              "' view, the view requires one or more child views to group, or consider using the group-by clause");
                }
            }

            var mergeViewSpecs = new LinkedList <ViewSpec>();

            foreach (var spec in specifications)
            {
                var viewEnum = ViewEnumExtensions.ForName(spec.ObjectNamespace, spec.ObjectName);
                if (viewEnum == null)
                {
                    continue;
                }

                var mergeView = viewEnum.Value.GetMergeView();
                if (mergeView == null)
                {
                    continue;
                }

                // The merge view gets the same parameters as the view that requires the merge
                var mergeViewSpec = new ViewSpec(
                    mergeView.Value.GetNamespace(), mergeView.Value.GetName(),
                    spec.ObjectParameters);

                // The merge views are added to the beginning of the list.
                // This enables group views to stagger ie. Marketdata.Group("symbol").Group("feed").xxx.Merge(...).Merge(...)
                mergeViewSpecs.AddFirst(mergeViewSpec);
            }

            specifications.AddAll(mergeViewSpecs);

            if (Log.IsDebugEnabled)
            {
                Log.Debug(".addMergeViews Outgoing specifications=" + specifications.Render());
            }
        }
Ejemplo n.º 18
0
        private ViewSpec GetDefaultViewSpec(IList <FoldChangeRow> foldChangeRows)
        {
            bool showPeptide;
            bool showLabelType;
            bool showMsLevel;
            bool showGroup;

            if (foldChangeRows.Any())
            {
                showPeptide   = foldChangeRows.Any(row => null != row.Peptide);
                showLabelType = foldChangeRows.Select(row => row.IsotopeLabelType).Distinct().Count() > 1;
                showMsLevel   = foldChangeRows.Select(row => row.MsLevel).Distinct().Count() > 1;
                showGroup     = foldChangeRows.Select(row => row.Group).Distinct().Count() > 1;
            }
            else
            {
                showPeptide   = !GroupComparisonModel.GroupComparisonDef.PerProtein;
                showLabelType = false;
                showMsLevel   = false;
                showGroup     = false;
            }
            // ReSharper disable NonLocalizedString
            var columns = new List <PropertyPath>
            {
                PropertyPath.Root.Property("Protein")
            };

            if (showPeptide)
            {
                columns.Add(PropertyPath.Root.Property("Peptide"));
            }
            if (showMsLevel)
            {
                columns.Add(PropertyPath.Root.Property("MsLevel"));
            }
            if (showLabelType)
            {
                columns.Add(PropertyPath.Root.Property("IsotopeLabelType"));
            }
            if (showGroup)
            {
                columns.Add(PropertyPath.Root.Property("Group"));
            }
            columns.Add(PropertyPath.Root.Property("FoldChangeResult"));
            columns.Add(PropertyPath.Root.Property("FoldChangeResult").Property("AdjustedPValue"));
            // ReSharper restore NonLocalizedString

            var viewSpec = new ViewSpec()
                           .SetName(AbstractViewContext.DefaultViewName)
                           .SetRowType(typeof(FoldChangeRow))
                           .SetColumns(columns.Select(col => new ColumnSpec(col)));

            return(viewSpec);
        }
 public void SetPivotReplicate(bool pivot)
 {
     if (pivot)
     {
         ViewSpec = ViewSpec.SetSublistId(PropertyPath.Root);
     }
     else
     {
         ViewSpec = ViewSpec.SetSublistId(SkylineViewContext.GetReplicateSublist(ViewInfo.ParentColumn.PropertyType));
     }
 }
Ejemplo n.º 20
0
        public static IList <ViewSpec> MakeSpecListFive()
        {
            List <ViewSpec> specifications = new List <ViewSpec>();

            ViewSpec specOne = MakeSpec("win", "time",
                                        new Type[] { typeof(int) }, new String[] { "10000" });

            specifications.Add(specOne);

            return(specifications);
        }
Ejemplo n.º 21
0
        private static ViewInfo CreateAuditLogViewInfo(SkylineDataSchema dataSchema, string name, params string[] columnNames)
        {
            var columnDescriptor = ColumnDescriptor.RootColumn(dataSchema, typeof(AuditLogRow));
            var viewSpec         = new ViewSpec().SetName(name).SetRowType(columnDescriptor.PropertyType);
            var columns          = columnNames.Select(c => new ColumnSpec(PropertyPath.Parse(c)));

            viewSpec = viewSpec.SetSublistId(PropertyPath.Root.Property(@"Details").LookupAllItems());
            viewSpec = viewSpec.SetColumns(columns);

            return(new ViewInfo(columnDescriptor, viewSpec).ChangeViewGroup(ViewGroup.BUILT_IN));
        }
Ejemplo n.º 22
0
        private static IList <ViewFactory> MakeFactories(EventType parentEventType, IList <ViewSpec> viewSpecs)
        {
            ViewServiceImpl  svc           = new ViewServiceImpl();
            ViewFactoryChain viewFactories = svc.CreateFactories(
                1, parentEventType,
                ViewSpec.ToArray(viewSpecs),
                StreamSpecOptions.DEFAULT,
                SupportStatementContextFactory.MakeContext(SupportContainer.Instance),
                false, -1);

            return(viewFactories.FactoryChain);
        }
Ejemplo n.º 23
0
        public void ApplyView(ViewSpec viewSpec)
        {
            var bindingListView = BindingSource.DataSource as BindingListView;

            if (bindingListView == null)
            {
                return;
            }
            var newBindingListView = new BindingListView(new ViewInfo(ViewContext.ParentColumn, viewSpec), bindingListView.InnerList);

            BindingSource.DataSource = newBindingListView;
        }
Ejemplo n.º 24
0
        private FilterSpec RoundTripToXml(FilterSpec filterSpec)
        {
            var viewSpec      = new ViewSpec().SetFilters(new[] { filterSpec });
            var xmlSerializer = new XmlSerializer(typeof(ViewSpecList));
            var memoryStream  = new MemoryStream();

            xmlSerializer.Serialize(memoryStream, new ViewSpecList(new [] { viewSpec }));
            memoryStream.Seek(0, SeekOrigin.Begin);
            var roundTripViewSpecList = (ViewSpecList)xmlSerializer.Deserialize(memoryStream);

            return(roundTripViewSpecList.ViewSpecs.First().Filters.First());
        }
Ejemplo n.º 25
0
 public override void ReadXml(XmlReader reader)
 {
     base.ReadXml(reader);
     if (null != reader.GetAttribute("rowsource") || null != reader.GetAttribute("sublist")) // Not L10N
     {
         ViewSpec = ViewSpec.ReadXml(reader);
     }
     else
     {
         ReportSpec = ReportSpec.Deserialize(reader);
     }
 }
Ejemplo n.º 26
0
 public void TestDataBindingIsSulfur()
 {
     var dataSchema = new DataSchema();
     var viewSpec =
         new ViewSpec().SetColumns(new[]
         {new ColumnSpec(PropertyPath.Parse("Code")), new ColumnSpec(PropertyPath.Parse("Molecule!*.Key")),})
             .SetFilters(new[]
             {new FilterSpec(PropertyPath.Parse("Molecule!*.Key"), FilterOperations.OP_EQUALS, "S")});
     var bindingListSource = new BindingListSource();
     bindingListSource.SetView(new ViewInfo(dataSchema, typeof(AminoAcid), viewSpec), AminoAcid.AMINO_ACIDS);
     Assert.AreEqual(2, bindingListSource.Count);
 }
Ejemplo n.º 27
0
 public override void ReadXml(XmlReader reader)
 {
     base.ReadXml(reader);
     if (null != reader.GetAttribute(@"rowsource") || null != reader.GetAttribute(@"sublist"))
     {
         ViewSpecLayout = new ViewSpecLayout(ViewSpec.ReadXml(reader), ViewLayoutList.EMPTY);
     }
     else
     {
         ReportSpec = ReportSpec.Deserialize(reader);
     }
 }
Ejemplo n.º 28
0
        public void TestDataBindingIsSulfur()
        {
            var dataSchema = new DataSchema();
            var viewSpec   =
                new ViewSpec().SetColumns(new[]
                                          { new ColumnSpec(PropertyPath.Parse("Code")), new ColumnSpec(PropertyPath.Parse("Molecule!*.Key")), })
                .SetFilters(new[]
                            { new FilterSpec(PropertyPath.Parse("Molecule!*.Key"), FilterPredicate.CreateFilterPredicate(dataSchema, typeof(string), FilterOperations.OP_EQUALS, "S")) });
            var bindingListSource = new BindingListSource();

            bindingListSource.SetView(new ViewInfo(dataSchema, typeof(AminoAcid), viewSpec), AminoAcid.AMINO_ACIDS);
            Assert.AreEqual(2, bindingListSource.Count);
        }
Ejemplo n.º 29
0
        private void comboSublist_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_inChangeView)
            {
                return;
            }
            var sublistItem = comboSublist.SelectedItem as SublistItem;

            if (sublistItem != null)
            {
                ViewSpec = _viewSpec.SetSublistId(sublistItem.IdentifierPath);
            }
        }
Ejemplo n.º 30
0
 public CustomizeViewForm(IViewContext viewContext, ViewSpec viewSpec)
 {
     InitializeComponent();
     ViewContext        = viewContext;
     ParentColumn       = viewContext.ParentColumn;
     _strikeThroughFont = new Font(listViewColumns.Font, FontStyle.Strikeout);
     availableFieldsTreeColumns.RootColumn = ParentColumn;
     ViewSpec               = OriginalViewSpec = viewSpec;
     tbxViewName.Text       = viewSpec.Name;
     ExistingCustomViewSpec =
         viewContext.CustomViewSpecs.FirstOrDefault(customViewSpec => viewSpec.Name == customViewSpec.Name);
     listViewColumns.SmallImageList = AggregateFunctions.GetSmallIcons();
 }
Ejemplo n.º 31
0
        public static List <ViewSpec> MakeSpecListThree()
        {
            List <ViewSpec> specifications = new List <ViewSpec>();

            ViewSpec specOne = SupportViewSpecFactory.MakeSpec("win", "length",
                                                               new Type[] { typeof(int) }, new String[] { "1000" });
            ViewSpec specTwo = SupportViewSpecFactory.MakeSpec("std", "unique",
                                                               new Type[] { typeof(String) }, new String[] { "TheString" });

            specifications.Add(specOne);
            specifications.Add(specTwo);

            return(specifications);
        }
Ejemplo n.º 32
0
        public static IList <ViewSpec> MakeSpecListTwo()
        {
            List <ViewSpec> specifications = new List <ViewSpec>();

            ViewSpec specOne = MakeSpec("std", "groupwin",
                                        new Type[] { typeof(String) }, new String[] { "TheString" });
            ViewSpec specTwo = MakeSpec("win", "length",
                                        new Type[] { typeof(int) }, new String[] { "100" });

            specifications.Add(specOne);
            specifications.Add(specTwo);

            return(specifications);
        }
Ejemplo n.º 33
0
        public ViewInfo(ColumnDescriptor parentColumn, ViewSpec viewSpec)
        {
            ParentColumn = parentColumn;
            DataSchema = parentColumn.DataSchema;
            Name = viewSpec.Name;
            RowSourceName = viewSpec.RowSource;

            _columnDescriptors.Add(parentColumn.PropertyPath, parentColumn);
            var displayColumns = new List<DisplayColumn>();
            foreach (var column in viewSpec.Columns)
            {
                var columnDescriptor = GetColumnDescriptor(column.PropertyPath);
                displayColumns.Add(new DisplayColumn(this, column, columnDescriptor));
            }
            DisplayColumns = Array.AsReadOnly(displayColumns.ToArray());
            SublistId = viewSpec.SublistId;
            var filters = new List<FilterInfo>();
            foreach (var filterSpec in viewSpec.Filters)
            {
                var columnDescriptor = GetColumnDescriptor(filterSpec.ColumnId);
                ColumnDescriptor collectionColumn = null;
                if (columnDescriptor != null)
                {
                    collectionColumn = columnDescriptor.CollectionAncestor() ?? ParentColumn;
                }
                filters.Add(new FilterInfo(filterSpec, columnDescriptor, collectionColumn));
            }
            
            Filters = Array.AsReadOnly(filters.ToArray());
            var sorts = new List<KeyValuePair<int, DisplayColumn>>();
            for (int i = 0; i < DisplayColumns.Count; i++)
            {
                if (DisplayColumns[i].ColumnSpec.SortDirection != null)
                {
                    sorts.Add(new KeyValuePair<int, DisplayColumn>(i, DisplayColumns[i]));
                }
            }
            if (sorts.Count > 0)
            {
                sorts.Sort(CompareSortEntries);
                SortColumns = Array.AsReadOnly(sorts.Select(kvp => kvp.Value).ToArray());
            }
            else
            {
                SortColumns = new DisplayColumn[0];
            }
        }
Ejemplo n.º 34
0
 public void TestDataBindingIsNotNullFilter()
 {
     var dataSchema = new DataSchema();
     var viewSpec = new ViewSpec().SetColumns(new[] {new ColumnSpec(PropertyPath.Parse("AminoAcidsDict!*.Value")),})
         .SetSublistId(PropertyPath.Parse("AminoAcidsDict!*"));
     var viewSpecWithFilter = viewSpec.SetFilters(new[]
         {
             new FilterSpec(PropertyPath.Parse("AminoAcidsDict!*.Value"),
                            FilterOperations.OP_IS_NOT_BLANK, null),
         });
     var bindingListSource = new BindingListSource();
     var bindingListSourceWithFilter = new BindingListSource();
     bindingListSource.SetView(new ViewInfo(dataSchema, typeof(Peptide), viewSpec), null);
     bindingListSourceWithFilter.SetView(new ViewInfo(dataSchema, typeof(Peptide), viewSpecWithFilter), new[] {new Peptide("")});
     Assert.AreEqual(0, bindingListSourceWithFilter.Count);
     bindingListSource.RowSource = bindingListSourceWithFilter.RowSource;
     Assert.AreEqual(1, bindingListSource.Count);
 }
Ejemplo n.º 35
0
 public void TestWriteReadXml()
 {
     var stringBuilder = new StringBuilder();
     var viewSpec = new ViewSpec();
     var xmlSerializer = new XmlSerializer(typeof (ViewSpecList));
     xmlSerializer.Serialize(XmlWriter.Create(stringBuilder), new ViewSpecList(new[] {viewSpec}));
     var viewSpecCompare = ((ViewSpecList) xmlSerializer.Deserialize(new StringReader(stringBuilder.ToString()))).ViewSpecs[0];
     Assert.AreEqual(viewSpec, viewSpecCompare);
     var viewSpecEmpty = ((ViewSpecList) xmlSerializer.Deserialize(new StringReader("<views><view /></views>"))).ViewSpecs[0];
     Assert.AreEqual(viewSpec, viewSpecEmpty);
     viewSpec = viewSpec
         .SetName("ViewName")
         .SetColumns(new[] {new ColumnSpec().SetName("foo"), new ColumnSpec().SetName("bar"),});
     Assert.AreNotEqual(viewSpecCompare, viewSpec);
     stringBuilder.Length = 0;
     xmlSerializer.Serialize(XmlWriter.Create(stringBuilder), new ViewSpecList(new[] {viewSpec}));
     viewSpecCompare = ((ViewSpecList) xmlSerializer.Deserialize(new StringReader(stringBuilder.ToString()))).ViewSpecs[0];
     Assert.AreEqual(viewSpec, viewSpecCompare);
 }
Ejemplo n.º 36
0
 public PeptidesForm(Workspace workspace)
     : base(workspace)
 {
     InitializeComponent();
     TabText = Name = "Peptides";
     btnAnalyzePeptides.Enabled = Workspace.Peptides.Count > 0;
     var defaultColumns = new[]
                              {
                                  new ColumnSpec().SetPropertyPath(PropertyPath.Root),
                                  new ColumnSpec().SetName("ProteinName").SetCaption("Protein"),
                                  new ColumnSpec().SetName("ProteinDescription"),
                                  new ColumnSpec().SetName("MaxTracerCount"),
                                  new ColumnSpec().SetName("SearchResultCount"),
                              };
     var defaultViewSpec = new ViewSpec()
         .SetName("default")
         .SetColumns(defaultColumns);
     peptidesBindingSource.SetViewContext(new TopographViewContext(workspace, typeof(LinkValue<Peptide>), new LinkValue<Peptide>[0], new[] { defaultViewSpec }));
 }
Ejemplo n.º 37
0
 /// <summary>
 /// In old custom reports, if the report was showing rows from a Results table,
 /// the report would not include any DocNode's which did not have any results.
 /// To preserve this behavior we add a filter that only DocNode's which have at
 /// least one Result get included.
 /// </summary>
 public static ViewSpec AddFilter(ViewSpec viewSpec, ReportSpec reportSpec)
 {
     var propertyPaths = new HashSet<PropertyPath>();
     IEnumerable<ReportColumn> columns = reportSpec.Select;
     if (reportSpec.CrossTabValues != null)
     {
         columns = columns.Concat(reportSpec.CrossTabValues);
     }
     foreach (var reportColumn in columns)
     {
         var databindingTableAttribute = GetDatabindingTableAttribute(reportColumn);
         if (null != databindingTableAttribute.Property && !databindingTableAttribute.Property.EndsWith("Summary")) // Not L10N
         {
             propertyPaths.Add(PropertyPath.Parse(databindingTableAttribute.Property));
         }
     }
     var newFilters =
         propertyPaths.Select(
             propertyPath => new FilterSpec(propertyPath, FilterOperations.OP_IS_NOT_BLANK, null));
     viewSpec = viewSpec.SetFilters(viewSpec.Filters.Concat(newFilters));
     return viewSpec;
 }
Ejemplo n.º 38
0
 public ViewSpecList ReplaceView(string oldName, ViewSpec newView)
 {
     List<ViewSpec> items = new List<ViewSpec>();
     bool found = false;
     foreach (var item in ViewSpecs)
     {
         if (item.Name != oldName)
         {
             items.Add(item);
             continue;
         }
         found = true;
         if (newView != null)
         {
             items.Add(newView);
         }
     }
     if (!found && null != newView)
     {
         items.Add(newView);
     }
     return new ViewSpecList(items);
 }
 public static ViewSpec PivotIsotopeLabel(ViewSpec viewSpec, bool pivot)
 {
     PropertyPath pivotKey;
     IList<PropertyPath> groupBy;
     IList<PropertyPath> crossTabExclude;
     IList<PropertyPath> crosstabValues;
     if (viewSpec.RowSource == typeof (Precursor).FullName)
     {
         pivotKey = PropertyPath.Root.Property("IsotopeLabelType");
         groupBy = new[]
         {
             PropertyPath.Root.Property("Peptide"),
             PropertyPath.Root.Property("Charge"),
         };
         crosstabValues = PrecursorCrosstabValues;
         crossTabExclude = new []{PropertyPath.Parse("Results!*.Value.PeptideResult")};
     }
     else if (viewSpec.RowSource == typeof (Transition).FullName)
     {
         pivotKey = PropertyPath.Root.Property("Precursor").Property("IsotopeLabelType");
         groupBy = new[]
         {
             PropertyPath.Root.Property("ProductCharge"),
             PropertyPath.Root.Property("FragmentIon"),
             PropertyPath.Root.Property("Losses"),
             PropertyPath.Root.Property("Precursor").Property("Peptide"),
             PropertyPath.Root.Property("Precursor").Property("Charge"),
         };
         crosstabValues = new[]
         {
             PropertyPath.Root.Property("ProductNeutralMass"),
             PropertyPath.Root.Property("ProductMz"),
             PropertyPath.Root.Property("Note"),
             PropertyPath.Root.Property("Results").LookupAllItems(),
             PropertyPath.Root.Property("ResultSummary"),
         }.Concat(PrecursorCrosstabValues.Select(
             propertyPath => PropertyPath.Root.Property("Precursor").Concat(propertyPath)))
             .ToArray();
         crossTabExclude = new[] {PropertyPath.Parse("Results!*.Value.PrecursorResult.PeptideResult")};
     }
     else
     {
         return viewSpec;
     }
     var newColumns = new List<ColumnSpec>();
     if (!pivot)
     {
         foreach (var column in viewSpec.Columns)
         {
             if (!column.Hidden)
             {
                 newColumns.Add(column.SetTotal(TotalOperation.GroupBy));
             }
         }
     }
     else
     {
         bool pivotKeyHandled = false;
         var missingGroupBy = new HashSet<PropertyPath>(groupBy);
         foreach (var column in viewSpec.Columns)
         {
             if (pivotKey.Equals(column.PropertyPath))
             {
                 pivotKeyHandled = true;
                 newColumns.Add(column.SetTotal(TotalOperation.PivotKey));
             }
             else if (crossTabExclude.Any(propertyPath => column.PropertyPath.StartsWith(propertyPath)))
             {
                 newColumns.Add(column.SetTotal(TotalOperation.GroupBy));
             }
             else if (crosstabValues.Any(propertyPath => column.PropertyPath.StartsWith(propertyPath)))
             {
                 newColumns.Add(column.SetTotal(TotalOperation.PivotValue));
             }
             else
             {
                 missingGroupBy.Remove(column.PropertyPath);
                 newColumns.Add(column.SetTotal(TotalOperation.GroupBy));
             }
         }
         if (!pivotKeyHandled)
         {
             newColumns.Add(new ColumnSpec(pivotKey).SetTotal(TotalOperation.PivotKey).SetHidden(true));
         }
         if (missingGroupBy.Count > 0)
         {
             foreach (var propertyPath in groupBy)
             {
                 if (!missingGroupBy.Contains(propertyPath))
                 {
                     continue;
                 }
                 newColumns.Add(new ColumnSpec(propertyPath).SetTotal(TotalOperation.GroupBy).SetHidden(true));
             }
         }
     }
     return viewSpec.SetColumns(newColumns);
 }
Ejemplo n.º 40
0
 public ViewInfo Convert(ReportSpec reportSpec)
 {
     var rootTable = GetRootTable(reportSpec);
     if (null == rootTable)
     {
         return null;
     }
     var columns = new List<ColumnSpec>();
     var columnNames = new HashSet<PropertyPath>();
     var sublistId = PropertyPath.Root;
     foreach (var reportColumn in reportSpec.Select)
     {
         var columnSpec = ConvertReportColumn(reportColumn);
         var collectionProperty = columnSpec.PropertyPath;
         while (!collectionProperty.IsRoot && !collectionProperty.IsUnboundLookup)
         {
             collectionProperty = collectionProperty.Parent;
         }
         if (collectionProperty.StartsWith(sublistId))
         {
             sublistId = collectionProperty;
         }
         if (columnNames.Add(columnSpec.PropertyPath))
         {
             columns.Add(columnSpec);
         }
     }
     if (null != reportSpec.GroupBy)
     {
         foreach (var reportColumn in reportSpec.GroupBy)
         {
             var columnSpec = ConvertReportColumn(reportColumn);
             if (!columns.Any(col => Equals(col.PropertyPath, columnSpec.PropertyPath)))
             {
                 columns.Add(columnSpec.SetHidden(true));
             }
         }
     }
     bool pivotIsotopeLabel = false;
     if (null != reportSpec.CrossTabHeaders)
     {
         pivotIsotopeLabel =
             reportSpec.CrossTabHeaders.Any(reportColumn => !reportColumn.Column.ToString().EndsWith("Replicate")); // Not L10N
         if (pivotIsotopeLabel)
         {
             sublistId = PropertyPath.Root.Property("Results").LookupAllItems(); // Not L10N
         }
         foreach (var reportColumn in reportSpec.CrossTabHeaders)
         {
             if (pivotIsotopeLabel || !reportColumn.Column.ToString().EndsWith("Replicate")) // Not L10N
             {
                 var columnSpec = ConvertReportColumn(reportColumn).SetTotal(TotalOperation.PivotKey).SetHidden(true);
                 columns.Add(columnSpec);
             }
         }
     }
     if (null != reportSpec.CrossTabValues)
     {
         foreach (var reportColumn in reportSpec.CrossTabValues)
         {
             var convertedColumn = ConvertReportColumn(reportColumn);
             if (pivotIsotopeLabel)
             {
                 convertedColumn = convertedColumn.SetTotal(TotalOperation.PivotValue);
             }
             if (columnNames.Add(convertedColumn.PropertyPath))
             {
                 columns.Add(convertedColumn);
             }
         }
     }
     var viewSpec = new ViewSpec()
         .SetName(reportSpec.Name)
         .SetSublistId(sublistId)
         .SetColumns(columns)
         .SetRowType(rootTable);
     viewSpec = AddFilter(viewSpec, reportSpec);
     return new ViewInfo(DataSchema, rootTable, viewSpec);
 }
Ejemplo n.º 41
0
 public ViewInfo(DataSchema dataSchema, Type rootType, ViewSpec viewSpec) : this(ColumnDescriptor.RootColumn(dataSchema, rootType), viewSpec)
 {
 }
Ejemplo n.º 42
0
 public ResultsPerReplicateForm(Workspace workspace)
     : base(workspace)
 {
     InitializeComponent();
     bool hasTimePoints = Workspace.MsDataFiles.Count(f => f.TimePoint != null) != 0;
     bool hasCohorts = Workspace.MsDataFiles.Count(f => f.Cohort != null) != 0;
     bool hasSamples = Workspace.MsDataFiles.Count(f => f.Sample != null) != 0;
     bool hasTracerDefs = Workspace.GetTracerDefs().Count != 0;
     bool hasOneTracerDef = Workspace.GetTracerDefs().Count == 1;
     var defaultColumns = new List<ColumnSpec>
                              {
                                  new ColumnSpec().SetName("Accept"),
                                  new ColumnSpec().SetName("Peptide"),
                                  new ColumnSpec().SetName("DataFile.Name").SetCaption("DataFile"),
                                  new ColumnSpec().SetName("Area"),
                              };
     if (hasTracerDefs)
     {
         defaultColumns.Add(new ColumnSpec().SetName("TracerPercent"));
     }
     defaultColumns.Add(new ColumnSpec().SetName("DeconvolutionScore"));
     if (hasCohorts)
     {
         defaultColumns.Add(new ColumnSpec().SetName("DataFile.Cohort"));
     }
     if (hasTimePoints)
     {
         defaultColumns.Add(new ColumnSpec().SetName("DataFile.TimePoint"));
     }
     if (hasSamples)
     {
         defaultColumns.Add(new ColumnSpec().SetName("DataFile.Sample"));
     }
     if (hasTracerDefs)
     {
         defaultColumns.AddRange(new[]{new ColumnSpec().SetName("IndividualTurnover.PrecursorEnrichment").SetCaption("Ind Precursor Enrichment"),
                                      new ColumnSpec().SetName("IndividualTurnover.Turnover").SetCaption("Ind Turnover"),
                                      new ColumnSpec().SetName("IndividualTurnover.Score").SetCaption("Ind Turnover Score"),
         });
     }
     defaultColumns.AddRange(new[]{new ColumnSpec().SetName("Peptide.ProteinName").SetCaption("Protein"),
                                      new ColumnSpec().SetName("Peptide.ProteinDescription"),
                                      });
     if (hasOneTracerDef)
     {
         defaultColumns.AddRange(new[]{new ColumnSpec().SetName("AverageTurnover.PrecursorEnrichment").SetCaption("Avg Precursor Enrichment"),
                                      new ColumnSpec().SetName("AverageTurnover.Turnover").SetCaption("Avg Turnover"),
                                      new ColumnSpec().SetName("AverageTurnover.Score").SetCaption("Avg Turnover Score"),
     });
     }
     defaultColumns.AddRange(new[]{                                             new ColumnSpec().SetName("Status"),
                                      new ColumnSpec().SetName("PsmCount"),
                                      new ColumnSpec().SetName("PeakIntegrationNote"),});
     var defaultViewSpec = new ViewSpec()
         .SetName("default")
         .SetColumns(defaultColumns);
     bindingSourceResults.SetViewContext(new TopographViewContext(workspace, typeof (PerReplicateResult), new PerReplicateResult[0], new[] {defaultViewSpec}));
 }
Ejemplo n.º 43
0
 ToolStripItem NewChooseViewItem(ViewSpec viewSpec, FontStyle fontStyle)
 {
     var item = new ToolStripMenuItem(viewSpec.Name, null,
         (sender, args) => ApplyView(viewSpec));
     if (GetCurrentViewName() == viewSpec.Name)
     {
         fontStyle |= FontStyle.Bold;
     }
     if (fontStyle != item.Font.Style)
     {
         item.Font = new Font(item.Font, fontStyle);
     }
     return item;
 }
Ejemplo n.º 44
0
 protected void SetViewSpec(ViewSpec viewSpec, IEnumerable<PropertyPath> selectedPaths)
 {
     SetViewInfo(new ViewInfo(ViewInfo.ParentColumn, viewSpec), selectedPaths);
 }
Ejemplo n.º 45
0
 private string GetReportRows(SrmDocument document, ViewSpec viewSpec, IProgressMonitor progressMonitor)
 {
     var container = new MemoryDocumentContainer();
     container.SetDocument(document, container.Document);
     var dataSchema = new SkylineDataSchema(container, DataSchemaLocalizer.INVARIANT);
     var viewContext = new DocumentGridViewContext(dataSchema);
     var status = new ProgressStatus(string.Format(Resources.ReportSpec_ReportToCsvString_Exporting__0__report,
         viewSpec.Name));
     var writer = new StringWriter();
     if (viewContext.Export(progressMonitor, ref status, viewContext.GetViewInfo(null, viewSpec), writer,
         new DsvWriter(CultureInfo.InvariantCulture, TextUtil.SEPARATOR_CSV)))
     {
         return writer.ToString();
     }
     return null;
 }
Ejemplo n.º 46
0
 protected override ViewEditor CreateViewEditor(ViewGroup viewGroup, ViewSpec viewSpec)
 {
     var viewEditor = base.CreateViewEditor(viewGroup, viewSpec);
     viewEditor.SetViewTransformer(new DocumentViewTransformer());
     viewEditor.AddViewEditorWidget(new PivotReplicateAndIsotopeLabelWidget {Dock = DockStyle.Left});
     #if DEBUG
     viewEditor.ShowSourceTab = true;
     #else
     viewEditor.ShowSourceTab = false;
     #endif
     if (EnablePreview)
     {
         viewEditor.PreviewButtonVisible = true;
         viewEditor.Text = Resources.DocumentGridViewContext_CreateViewEditor_Edit_Report;
     }
     return viewEditor;
 }
Ejemplo n.º 47
0
 private ColumnDescriptor GetColumnDescriptor(DatabindingTableAttribute databindingTable, PropertyPath identifierPath)
 {
     identifierPath = PropertyPath.Parse(databindingTable.Property).Concat(identifierPath);
     var viewSpec = new ViewSpec().SetColumns(new[] { new ColumnSpec(identifierPath) });
     var viewInfo = new ViewInfo(DataSchema, databindingTable.RootTable, viewSpec);
     return viewInfo.DisplayColumns.First().ColumnDescriptor;
 }
Ejemplo n.º 48
0
 public void ApplyView(ViewGroup viewGroup, ViewSpec viewSpec)
 {
     var viewInfo = ViewContext.GetViewInfo(viewGroup, viewSpec);
     BindingListSource.SetViewContext(ViewContext, viewInfo);
     RefreshUi();
 }
Ejemplo n.º 49
0
        ToolStripItem NewChooseViewItem(ViewGroup viewGroup, ViewSpec viewSpec)
        {
            var viewInfo = ViewContext.GetViewInfo(new ViewName(viewGroup.Id, viewSpec.Name));
            if (null == viewInfo)
            {
                return null;
            }
            Image image = null;
            int imageIndex = ViewContext.GetImageIndex(viewSpec);
            if (imageIndex >= 0)
            {
                image = ViewContext.GetImageList()[imageIndex];
            }
            ToolStripMenuItem item = new ToolStripMenuItem(viewSpec.Name, image) { ImageTransparentColor = Color.Magenta};

            item.Click += (sender, args) => ApplyView(viewGroup, viewSpec);
            var currentView = BindingListSource.ViewInfo;
            var fontStyle = FontStyle.Regular;
            if (null != currentView && Equals(viewGroup, currentView.ViewGroup) &&
                Equals(viewSpec.Name, currentView.Name))
            {
                fontStyle |= FontStyle.Bold;
                item.Checked = true;
            }
            if (!ViewGroup.BUILT_IN.Equals(viewGroup))
            {
                fontStyle |= FontStyle.Italic;
            }
            item.Font = new Font(item.Font, fontStyle);
            return item;
        }
Ejemplo n.º 50
0
 public static ViewGroupId GetGroupId(ViewSpec viewSpec)
 {
     return new ViewGroupId(viewSpec.RowSource);
 }
Ejemplo n.º 51
0
        private ViewSpec GetDefaultViewSpec(IList<FoldChangeRow> foldChangeRows)
        {
            bool showPeptide;
            bool showLabelType;
            bool showMsLevel;
            bool showGroup;
            if (foldChangeRows.Any())
            {
                showPeptide = foldChangeRows.Any(row => null != row.Peptide);
                showLabelType = foldChangeRows.Select(row => row.IsotopeLabelType).Distinct().Count() > 1;
                showMsLevel = foldChangeRows.Select(row => row.MsLevel).Distinct().Count() > 1;
                showGroup = foldChangeRows.Select(row => row.Group).Distinct().Count() > 1;
            }
            else
            {
                showPeptide = !GroupComparisonModel.GroupComparisonDef.PerProtein;
                showLabelType = false;
                showMsLevel = false;
                showGroup = false;
            }
            // ReSharper disable NonLocalizedString
            var columns = new List<PropertyPath>
            {
                PropertyPath.Root.Property("Protein")
            };
            if (showPeptide)
            {
                columns.Add(PropertyPath.Root.Property("Peptide"));
            }
            if (showMsLevel)
            {
                columns.Add(PropertyPath.Root.Property("MsLevel"));
            }
            if (showLabelType)
            {
                columns.Add(PropertyPath.Root.Property("IsotopeLabelType"));
            }
            if (showGroup)
            {
                columns.Add(PropertyPath.Root.Property("Group"));
            }
            columns.Add(PropertyPath.Root.Property("FoldChangeResult"));
            columns.Add(PropertyPath.Root.Property("FoldChangeResult").Property("AdjustedPValue"));
            // ReSharper restore NonLocalizedString

            var viewSpec = new ViewSpec()
                .SetName(AbstractViewContext.DefaultViewName)
                .SetRowType(typeof (FoldChangeRow))
                .SetColumns(columns.Select(col => new ColumnSpec(col)));
            return viewSpec;
        }
Ejemplo n.º 52
0
 public void SetViewSpec(ViewSpec viewSpec)
 {
     SetViewContext(ViewContext, ViewContext.GetViewInfo(viewSpec));
 }