public void EditMapping(DataTable mappingTable, DataTable containerTable, DataTable expressionDataTable) { var tissueLov = _dataHelper.GetDistinctLoV(expressionDataTable.Columns[DatabaseConfiguration.ExpressionDataColumns.COL_TISSUE]); View.SetData(mappingTable, containerTable, tissueLov); View.Display(); }
public void SelectProtein(DataRow selectedRow) { if (selectedRow == null) { return; } var id = (long)selectedRow[DatabaseConfiguration.ProteinColumns.COL_ID]; var expressionDataTable = _geneExpressionQueries.GetExpressionDataByGeneId(id); expressionDataTable.TableName = DatabaseConfiguration.TableNames.EXPRESSION_DATA; var mappingContainerTissue = _geneExpressionQueries.GetContainerTissueMapping(); mappingContainerTissue.TableName = DatabaseConfiguration.TableNames.MAPPING_DATA; //This is required because the code below sets null value in a table that does not allow null value in the database mappingContainerTissue.Columns[DatabaseConfiguration.MappingColumns.COL_CONTAINER].AllowDBNull = true; //add all tissues in expression data which are not mapped to containers var mappedTissues = _dataHelper.GetDistinctLoV(mappingContainerTissue.Columns[DatabaseConfiguration.MappingColumns.COL_TISSUE]); var tissueLov = _dataHelper.GetDistinctLoV(expressionDataTable.Columns[DatabaseConfiguration.ExpressionDataColumns.COL_TISSUE]); mappingContainerTissue.BeginLoadData(); foreach (string expressionTissue in tissueLov) { if (mappedTissues.Contains(expressionTissue)) { continue; } var newRow = mappingContainerTissue.NewRow(); newRow[DatabaseConfiguration.MappingColumns.COL_CONTAINER] = DBNull.Value; newRow[DatabaseConfiguration.MappingColumns.COL_TISSUE] = expressionTissue; mappingContainerTissue.Rows.Add(newRow); } mappingContainerTissue.EndLoadData(); mappingContainerTissue.AcceptChanges(); //build data set _expressionDataSet = new DataSet("ExpressionData"); _expressionDataSet.Tables.Add(expressionDataTable); _expressionDataSet.Tables.Add(mappingContainerTissue); DataColumn parentColumn = expressionDataTable.Columns[DatabaseConfiguration.ExpressionDataColumns.COL_TISSUE]; DataColumn childColumn = mappingContainerTissue.Columns[DatabaseConfiguration.MappingColumns.COL_TISSUE]; _expressionDataSet.Relations.Add("REL_TISSUE", parentColumn, childColumn, false); DataTable expressionData = _dataHelper.CreateDataJoin(_expressionDataSet.Relations[0], JoinType.Inner, "ExpressionData"); // join expression data with containers to have the display name information expressionData = joinExpressionDataWithContainers(expressionData); // determine the name used for identifying the protein. if (selectedRow[DatabaseConfiguration.ProteinColumns.COL_SYMBOL] != DBNull.Value) { _proteinName = (string)selectedRow[DatabaseConfiguration.ProteinColumns.COL_SYMBOL]; } else if (selectedRow[DatabaseConfiguration.ProteinColumns.COL_GENE_NAME] != DBNull.Value) { _proteinName = (string)selectedRow[DatabaseConfiguration.ProteinColumns.COL_GENE_NAME]; } else if (selectedRow[DatabaseConfiguration.ProteinColumns.COL_GENE_ID] != DBNull.Value) { _proteinName = (string)selectedRow[DatabaseConfiguration.ProteinColumns.COL_GENE_ID]; } PresenterAt(ExpressionItems.ExpressionData).SetData(_proteinName, expressionData, String.Empty); _view.ActivateControl(ExpressionItems.ExpressionData); _view.SetControlEnabled(ExpressionItems.Transfer, true); SetWizardButtonEnabled(ExpressionItems.ExpressionData); }