private static void AddAnnotations(Configuration configuration, SrmSettings settings, AnnotationDef.AnnotationTarget annotationTarget, Type persistentClass) { var mapping = configuration.GetClassMapping(persistentClass); foreach (var annotationDef in settings.DataSettings.AnnotationDefs) { if (!annotationDef.AnnotationTargets.Contains(annotationTarget)) { continue; } string columnName = AnnotationDef.GetColumnName(annotationDef.Name); Type accessorType; switch (annotationDef.Type) { case AnnotationDef.AnnotationType.number: accessorType = typeof(NumberAnnotationPropertyAccessor); break; case AnnotationDef.AnnotationType.true_false: accessorType = typeof(BoolAnnotationPropertyAccessor); break; default: accessorType = typeof(AnnotationPropertyAccessor); break; } AddColumn(mapping, columnName, accessorType); } }
private void CreateBaseView(DocumentGridForm documentGrid) { RunUI(() => documentGrid.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Peptides)); var viewEditor = ShowDialog <ViewEditor>(documentGrid.DataboundGridControl.NavBar.CustomizeView); var columnsToKeep = new[] { PropertyPath.Root.Property("Proteins").LookupAllItems(), PropertyPath.Root.Property("Proteins").LookupAllItems().Property("Peptides").LookupAllItems() }; RunUI(() => { foreach (var column in viewEditor.ChooseColumnsTab.ViewSpec.Columns) { if (!columnsToKeep.Contains(column.PropertyPath)) { viewEditor.ChooseColumnsTab.RemoveColumn(column.PropertyPath); } } }); Assert.AreEqual(columnsToKeep.Length, viewEditor.ChooseColumnsTab.ColumnCount); PropertyPath pathNormalizedArea = PropertyPath.Root.Property("Proteins").LookupAllItems() .Property("Peptides").LookupAllItems() .Property("Results").LookupAllItems().Property("Value").Property("Quantification") .Property("NormalizedArea"); var columnsToAdd = new[] { PropertyPath.Root.Property("Replicates").LookupAllItems() .Property(AnnotationDef.GetColumnName("BioReplicate")), PropertyPath.Root.Property("Replicates").LookupAllItems() .Property(AnnotationDef.GetColumnName("ConditionNumber")), pathNormalizedArea }; RunUI(() => { foreach (var column in columnsToAdd) { viewEditor.ChooseColumnsTab.AddColumn(column); } }); RunUI(() => { viewEditor.ViewName = pivotTestViewName; }); OkDialog(viewEditor, viewEditor.OkDialog); }