private void simpleTestToolStripMenuItem_Click(object sender, EventArgs e) { Random RNd = new Random(); int NumRow = 8; double InitialValue = 10; int NumCol = 12; cExtendedTable FinalTable = null; for (int Col = 1; Col <= NumCol; Col++) { for (int Repeat = 1; Repeat <= NumRow; Repeat++) { cExtendedTable GeneratedTable = new cExtendedTable(1, 1000, InitialValue); cAddNoise AN = new cAddNoise(); AN.DistributionType = eRandDistributionType.GAUSSIAN; AN.Mean = 20;// Col*1.2; AN.Stdv = 0.5 * Col; AN.SetInputData(GeneratedTable); AN.Run(); GeneratedTable = AN.GetOutPut(); //for (int i = 0; i < GeneratedTable[0].Count; i++) //{ // GeneratedTable[0][i] = Col; // GeneratedTable[1][i] = Repeat; //} GeneratedTable.ListRowNames = new List<string>(); for (int i = 0; i < GeneratedTable[0].Count; i++) { GeneratedTable.ListRowNames.Add(ConvertPosition(Col, Repeat)); } if (FinalTable == null) FinalTable = new cExtendedTable(GeneratedTable); else { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(FinalTable, GeneratedTable); M.Run(); FinalTable = M.GetOutPut(); } } } FinalTable.Name = "generated screen"; FinalTable[0].Name = "Volume"; // FinalTable[1].Name = "Row"; // FinalTable[2].Name = "Volume"; cDisplayExtendedTable DET = new cDisplayExtendedTable(); //DET.SetInputData(FinalTable); //DET.Run(); cTableToFile TTF = new cTableToFile(); TTF.SetInputData(FinalTable); TTF.IsDisplayUIForFilePath = true; TTF.IsRunEXCEL = true; TTF.IsAppend = false; TTF.Run(); }
void Process() { // here is the core of the meta component ... // just a list of Component steps foreach (cWell item in Input) { item.AssociatedPlate.DBConnection = new cDBConnection(item.AssociatedPlate, item.SQLTableName); cListSingleBiologicalObjects ListPhenotypes = item.AssociatedPlate.DBConnection.GetBiologicalPhenotypes(item); cExtendedTable ET = item.AssociatedPlate.DBConnection.GetWellValues(item, cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors()); item.AssociatedPlate.DBConnection.CloseConnection(); ET.ListTags = new List<object>(); for (int i = 0; i < ET.Count; i++) { ET[i].ListTags = new List<object>(); for (int j = 0; j < ListPhenotypes.Count; j++) ET[i].ListTags.Add(ListPhenotypes[j]); } for (int j = 0; j < ListPhenotypes.Count; j++) ET.ListTags.Add(ListPhenotypes[j]); if (Output == null) Output = new cExtendedTable(ET); else { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(Output, ET); M.Run(); Output = M.GetOutPut(); } } }
private void drawSingleDRCToolStripMenuItem_Click(object sender, EventArgs e) { int NumberOfReplicate = 4; int DRCNumberofPoints = 20; cExtendedTable FullResults = new cExtendedTable(); FullResults.ListRowNames = new List<string>(); cExtendedList ListPValues = new cExtendedList("DRC"); cDataGeneratorTitration GT = new cDataGeneratorTitration(); GT.NumberOfPoint = DRCNumberofPoints; GT.Start = 100; GT.DilutionFactor = 3; GT.Run(); Random RND = new Random(); cExtendedTable FinalTable = new cExtendedTable(); cDataGeneratorSigmoid DGS = null; DGS = new cDataGeneratorSigmoid(); DGS.SetInputData(GT.GetOutPut()[0]); DGS.EC50 = 0.01; DGS.Bottom = 10; DGS.Top = 110; DGS.Slope = 1; DGS.Run(); // cAddNoise AN = new cAddNoise(); // AN.DistributionType = eRandDistributionType.GAUSSIAN; double NoiseLevel = 10; // EXT[0].Add(NoiseLevel); // EXT[1].Add(DGS.EC50); #region loop over the replicates for (int NumReplic = 0; NumReplic < NumberOfReplicate; NumReplic++) { cExtendedList NewL = DGS.GetOutPut()[1]; for (int k = 0; k < NewL.Count; k++) { NewL[k] += RND.NextDouble() * NoiseLevel; } cExtendedTable TmpTable = new cExtendedTable(); TmpTable.Add(GT.GetOutPut()[0]); TmpTable.Add(NewL); if (NumReplic >= 1) { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(TmpTable, FinalTable); M.Run(); FinalTable = M.GetOutPut(); } else FinalTable = new cExtendedTable(TmpTable); } #endregion cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(FinalTable); SF.Run(); cGlobalInfo.ConsoleWriteLine("Slope :" + DGS.Slope + " - Evaluated:" + SF.GetOutPut()[0][3]); cGlobalInfo.ConsoleWriteLine("Top :" + DGS.Top + " - Evaluated:" + SF.GetOutPut()[0][1]); cGlobalInfo.ConsoleWriteLine("Bottom :" + DGS.Bottom + " - Evaluated:" + SF.GetOutPut()[0][0]); cGlobalInfo.ConsoleWriteLine("EC50 :" + DGS.EC50 + " - Evaluated:" + SF.GetOutPut()[0][2]); // return; cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(FinalTable); CFG.Run(); cExtendedTable Sigmoid = SF.GetFittedRawValues(GT.GetOutPut()[0]); FinalTable[0] = Sigmoid[1]; cViewerGraph1D VS1 = new cViewerGraph1D(); VS1.SetInputData(new cExtendedTable(Sigmoid[1])); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0];//DGS.GetOutPut()[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = true; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = "Readout"; VS1.Chart.XAxisFormatDigitNumber = -1; VS1.Chart.IsZoomableX = true; VS1.Chart.IsZoomableY = true; VS1.Run(); cDesignerSinglePanel CD = new cDesignerSinglePanel(); CD.SetInputData(VS1.GetOutPut()); CD.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(CD.GetOutPut());//DS.GetOutPut()); DTW.Run(); DTW.Display(); }
private void sigmoidFittToolStripMenuItem_Click(object sender, EventArgs e) { int NumberOfReplicate = 4; int NumberOfCurves = 30; int DRCNumberofPoints = 12; cExtendedTable FullResults = new cExtendedTable(); FullResults.ListRowNames = new List<string>(); double RealEC50 = 0.0001; int NumberOfDiffEC50 = 20; int NumberOfSlopes = 100; // for (int EC50 = 0; EC50 < NumberOfDiffEC50; EC50++) { //double TmpSlopeValue = 0.0; for (int EC50 = 0; EC50 < NumberOfDiffEC50; EC50++) //for (int SlopeTmp = 0; SlopeTmp < NumberOfSlopes; SlopeTmp++) { RealEC50 *= 2; //TmpSlopeValue += 0.1; cExtendedList ListPValues = new cExtendedList("EC50 - " + RealEC50/*TmpSlopeValue*/); cDesignerTab DT = new cDesignerTab(); DT.IsMultiline = false; cDataGeneratorTitration GT = new cDataGeneratorTitration(); GT.NumberOfPoint = DRCNumberofPoints; GT.Start = 5; GT.DilutionFactor = 2; GT.Run(); Random RND = new Random(); //cExtendedTable EXT = new cExtendedTable(); //EXT.ListRowNames = new List<string>(); //EXT.Name = "Quality fitting Report"; //EXT.Add(new cExtendedList("Noise Level")); //EXT.Add(new cExtendedList("Original EC50")); //EXT.Add(new cExtendedList("Estimated EC50")); //EXT.Add(new cExtendedList("p-Value")); for (int i = 0; i < NumberOfCurves; i++) { cExtendedTable FinalTable = new cExtendedTable(); cDataGeneratorSigmoid DGS = null; DGS = new cDataGeneratorSigmoid(); DGS.SetInputData(GT.GetOutPut()[0]); DGS.EC50 = RealEC50;// 0.01;// 1;// 0.1;// Math.Pow((double)10, -2); DGS.Bottom = 0; DGS.Top = 100; DGS.Slope = 2;// TmpSlopeValue;//1; DGS.Run(); cAddNoise AN = new cAddNoise(); AN.DistributionType = eRandDistributionType.GAUSSIAN; double NoiseLevel = (i + 1) * 5; // EXT[0].Add(NoiseLevel); // EXT[1].Add(DGS.EC50); #region loop over the replicates for (int NumReplic = 0; NumReplic < NumberOfReplicate; NumReplic++) { //AN.Mean = 0; //AN.Stdv = 10; //AN.SetInputData(DGS.GetOutPut()); //AN.Run(); cExtendedList NewL = DGS.GetOutPut()[1]; for (int k = 0; k < NewL.Count; k++) { NewL[k] += RND.NextDouble() * NoiseLevel; } cExtendedTable TmpTable = new cExtendedTable(); TmpTable.Add(GT.GetOutPut()[0]); TmpTable.Add(/*AN.GetOutPut()[1]*/NewL); if (NumReplic >= 1) { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(TmpTable, FinalTable); M.Run(); FinalTable = M.GetOutPut(); } else FinalTable = new cExtendedTable(TmpTable); } #endregion //cListWell LW = new cListWell(null); //foreach (cWell item in CompleteScreening.GetCurrentDisplayPlate().ListActiveWells) //{ // if (item.GetClassIdx() == 0) // LW.Add(item); //} //cExtendedTable ET = LW.GetDescriptorValues(CompleteScreening.ListDescriptors.GetActiveDescriptors(), true); cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(FinalTable); CFG.Run(); // compute ANOVA cANOVA S = new cANOVA(); cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1); S.SignificanceThreshold = 1E-11; S.SetInputData(NewTable); S.Run(); //cLinearRegression LR = new cLinearRegression(); //LR.SetInputData(FinalTable); //LR.Run(); cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(FinalTable); if (SF.Run().IsSucceed == false) continue; // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1]; cExtendedTable Sigmoid = SF.GetFittedRawValues(GT.GetOutPut()[0]); FinalTable[0] = Sigmoid[1]; cDesignerSplitter DS = new cDesignerSplitter(); ////cViewerTableAsRichText VT = new cViewerTableAsRichText(); cViewerTable VT = new cViewerTable(); cExtendedTable TableResults = SF.GetOutPut(); TableResults[0].Add(S.GetOutPut()[0][0]); ListPValues.Add(S.GetOutPut()[0][0]); TableResults[0].Add(S.GetOutPut()[0][1]); TableResults.ListRowNames.Add("p-Value"); TableResults.ListRowNames.Add("Null hyp. rejected?"); VT.SetInputData(TableResults); VT.DigitNumber = -1; VT.Run(); cViewerGraph1D VS1 = new cViewerGraph1D(); VS1.SetInputData(new cExtendedTable(Sigmoid[1])); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0];//DGS.GetOutPut()[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = true; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = "Readout"; VS1.Chart.XAxisFormatDigitNumber = -1; VS1.Chart.IsZoomableX = true; //Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]); //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/); //VS1.Chart.ListVerticalLines.Add(VLForEC50); //VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[FinalTable.Count]; //EXT[2].Add(SF.GetOutPut()[0][2]); //EXT[3].Add(S.GetOutPut()[0][0]); //for (int IdxCurve = 0; IdxCurve < FinalTable.Count; IdxCurve++) //{ // cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign(); // TmpSerieInfo.color = Color.FromArgb(100, GlobalInfo.ListCellularPhenotypes[IdxCurve % GlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay); // TmpSerieInfo.markerStyle = MarkerStyle.Circle; // VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo; //} VS1.Run(); DS.SetInputData(VS1.GetOutPut()); DS.SetInputData(VT.GetOutPut()); DS.Orientation = Orientation.Horizontal; DS.Title = "Noise Stdev " + NoiseLevel; DS.Run(); DT.SetInputData(DS.GetOutPut()); // EXT.ListRowNames.Add(DS.Title); } DT.Run(); //cDisplayToWindow DTW = new cDisplayToWindow(); //DTW.SetInputData(DT.GetOutPut()); //DTW.Run(); //DTW.Display(); //cDisplayExtendedTable DET = new cDisplayExtendedTable(); //DET.SetInputData(EXT); //DET.DigitNumber = -1; //DET.Run(); FullResults.Add(ListPValues); } } cDisplayExtendedTable DET = new cDisplayExtendedTable(); DET.SetInputData(FullResults); DET.DigitNumber = -1; DET.Run(); }
private void aNOVAToolStripMenuItem1_Click(object sender, EventArgs e) { cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses(); GUI_ListClasses.IsCheckBoxes = true; GUI_ListClasses.IsSelectAll = true; if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); string SubTitle = "ANOVA (One-Way)"; #region single plate and plate by plate cDesignerTab DT = new cDesignerTab(); if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); if ((ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); } else ListPlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); foreach (cPlate TmpPlate in ListPlatesToProcess) { cExtendedTable NewTable1 = new cExtendedTable(); List<cListWells> ListListWells = new List<cListWells>(); int NumWells = 0; for (int IdxClassWell = 0; IdxClassWell < ListClassSelected[0].Count; IdxClassWell++) { if (ListClassSelected[0][IdxClassWell] >= 1) { List<cWellClassType> LCT = new List<cWellClassType>(); LCT.Add(cGlobalInfo.ListWellClasses[IdxClassWell]); cListWells TmpList = TmpPlate.ListWells.Filter(LCT); if (TmpList.Count >= 3) { ListListWells.Add(TmpList); NumWells += TmpList.Count; } } } if (ListListWells.Count <= 1) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedTable CompleteReport = null; cExtendedList ListZ = new cExtendedList(); List<cDescriptorType> ListDescForZFactor = new List<cDescriptorType>(); List<string> ListNames = new List<string>(); int RealIdx = 0; for (int IDxDesc = 0; IDxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IDxDesc++) { if (!cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].IsActive()) continue; cExtendedTable TableForZ = new cExtendedTable(); foreach (var item in ListListWells) { List<cDescriptorType> LType = new List<cDescriptorType>(); LType.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); cExtendedTable TTable = item.GetAverageDescriptorValues(LType, false, false); TableForZ.Add(TTable[0]); } RealIdx++; cANOVA ZF = new cANOVA(); ZF.SetInputData(TableForZ); ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][0]); ZF.GetOutPut()[0].Name = cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc].GetName(); if (CompleteReport == null) CompleteReport = new cExtendedTable(ZF.GetOutPut()); else { cMerge M = new cMerge(); M.IsHorizontal = true; M.SetInputData(CompleteReport, ZF.GetOutPut()); M.Run(); CompleteReport = M.GetOutPut(); } ListDescForZFactor.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListDescForZFactor); ET.Name = TmpPlate.GetName() + "\n" + SubTitle + " - " + NumWells + " wells";// +" - " +cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " +cGlobalInfo.ListWellClasses[IdxClassPos].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); S.IsAscending = false; S.ColumnIndexForSorting = 0; S.Run(); //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(S.GetOutPut()); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Descriptor"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; //VG1.Chart.Max VG1.Title = TmpPlate.GetName(); // Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.05); // VLZ05.IsAllowMoving = true; // VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cTranspose T = new cTranspose(); T.SetInputData(CompleteReport); T.Run(); CompleteReport = T.GetOutPut(); CompleteReport[0].Name = "P-Value"; CompleteReport[1].Name = "Is significant ?"; cSort S1 = new cSort(); S1.SetInputData(CompleteReport); S1.ColumnIndexForSorting = 0; S1.IsAscending = true; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.DigitNumber = -1; VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = TmpPlate.GetName(); DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) CDW.Title = SubTitle + " - " + ListPlatesToProcess[0].GetName(); else CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); } #endregion #region entire screening else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) ListPlatesToProcess.Add(TmpPlate); cExtendedList ListZ = new cExtendedList(); List<cPlate> ListPlatesForZFactor = new List<cPlate>(); foreach (cPlate TmpPlate in ListPlatesToProcess) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (ListClassSelected[1][item.GetCurrentClassIdx()] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor())); //cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, false); if ((NewTable1.Count == 0) || (NewTable1[0].Count < 2) || (NewTable2.Count == 0) || (NewTable2[0].Count < 2)) { if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else continue; } cExtendedTable TableForZ = new cExtendedTable(); TableForZ.Add(NewTable1[0]); TableForZ.Add(NewTable2[0]); cStudent_tTest ZF = new cStudent_tTest(); ZF.SetInputData(TableForZ); ZF.Run(); double Zfactor = ZF.GetOutPut()[0][1]; ListZ.Add(Zfactor); // update plate quality //TmpPlate.ListProperties.UpdateValueByName("Quality", Math.Exp(Zfactor - 1)); //cProperty Prop = TmpPlate.ListProperties.FindByName("Quality"); //Prop.Info = ZF.GetInfo(); ListPlatesForZFactor.Add(TmpPlate); } cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ)); ET[0].ListTags = new List<object>(); ET[0].ListTags.AddRange(ListPlatesForZFactor); ET.Name = SubTitle + " - " + cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();// +" - " +cGlobalInfo.ListWellClasses[IdxClassNeg].Name + /*" (" + NewTable1[0].Count + " wells)*/ " vs. " +cGlobalInfo.ListWellClasses[IdxClassPos].Name;// +" (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cViewerGraph1D VG1 = new cViewerGraph1D(); VG1.SetInputData(ET); VG1.Chart.LabelAxisY = SubTitle; VG1.Chart.LabelAxisX = "Plate"; VG1.Chart.IsZoomableX = true; VG1.Chart.IsBar = true; VG1.Chart.IsBorder = true; VG1.Chart.IsDisplayValues = true; VG1.Chart.IsShadow = true; VG1.Chart.MarkerSize = 4; VG1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(); VG1.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(VG1.GetOutPut()); CDW.Title = SubTitle + " - " + ListPlatesToProcess.Count + " plates"; CDW.Run(); CDW.Display(); #endregion } }
/// <summary> /// This function displays the evolution of the average value of a certain descriptor through the plates, for a specified class /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void descriptorEvolutionToolStripMenuItem_Click(object sender, EventArgs e) { // if (CompleteScreening == null) return; #region extract classes of interest cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses(); GUI_ListClasses.IsCheckBoxes = !_DescEvolCellByCellItem.Checked; GUI_ListClasses.IsSelectAll = false; if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); if (ListClassSelected.Sum() < 1) { MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } #endregion cDescriptorType DT = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(); cGUI_ListPlates GUI_ListPlates = new cGUI_ListPlates(); GUI_ListPlates.IsCheckBoxes = true; GUI_ListPlates.ListInitialPlates = cGlobalInfo.CurrentScreening.ListPlatesActive; // GUI_ListClasses.ListInitialPlates = null; cFeedBackMessage FBM = GUI_ListPlates.Run(); richTextBoxConsole.AppendText(FBM.Message); if (!FBM.IsSucceed) return; cListPlates LP = GUI_ListPlates.GetOutPut(); if (_DescEvolCellByCellItem.Checked) { cExtendedTable FinalTable = new cExtendedTable(); foreach (cPlate CurrentPlate in LP) { cExtendedTable TmpFinalTable = new cExtendedTable(); int NumberOfWells = 0; foreach (cWell item in CurrentPlate.ListActiveWells) { if (item.GetCurrentClassIdx() == -1) continue; if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) { cExtendedTable TmpET = item.GetValuesList(DT); if (TmpFinalTable.Count == 0) { TmpFinalTable = new cExtendedTable(TmpET); } else { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(TmpFinalTable, TmpET); M.Run(); TmpFinalTable = M.GetOutPut(); } NumberOfWells++; } } if (NumberOfWells == 0) continue; if (FinalTable.Count == 0) { FinalTable = new cExtendedTable(TmpFinalTable); FinalTable[0].Name = CurrentPlate.GetName() + " (" + NumberOfWells + " wells)"; } else { cMerge M = new cMerge(); M.IsHorizontal = true; TmpFinalTable[0].Name = CurrentPlate.GetName() + " (" + NumberOfWells + " wells)"; M.SetInputData(FinalTable, TmpFinalTable); M.Run(); FinalTable = M.GetOutPut(); } } cViewerHistogram VH = new cViewerHistogram(); FinalTable.Name = DT.GetName(); VH.Chart.LabelAxisX = DT.GetName(); VH.Chart.IsArea = true; VH.Chart.IsPoint = false; //VH.Chart.IsBar = false; //VH.Chart.IsShadow = true; VH.Chart.IsXGrid = VH.Chart.IsYGrid = false; VH.Chart.Opacity = 200; VH.Chart.IsLegend = true; VH.SetInputData(FinalTable); VH.Chart.CurrentTitle.Text = cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates"; VH.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.SetInputData(VH.GetOutPut()); DTW.Title = "Cell-by-Cell Descriptor Evolution"; DTW.Run(); DTW.Display(); //cExtendedTable ET = CompleteScreening.GetCurrentDisplayPlate().DBConnection.GetWellValues( // this.AssociatedPlate.DBConnection.GetWellValues(this, // LCDT, // ListCellularPhenotypesToBeSelected); } else { cDisplayDescriptorEvolutions DEV = new cDisplayDescriptorEvolutions(); DEV.ListPlates = LP; DEV.SetInputData(ListClassSelected); DEV.Run(cGlobalInfo.CurrentScreening); } }
public cFeedBackMessage Run(bool IsDisplayResults) { cMachineLearning MachineLearning = new cMachineLearning(/*cWell.GlobalInfo*/null); ParamAlgoForClustering = MachineLearning.AskAndGetClusteringAlgo(); if (MinObjectsNumber == -1) MinObjectsNumber = (cGlobalInfo.CurrentScreening.Columns * cGlobalInfo.CurrentScreening.Rows * (int)cGlobalInfo.OptionsWindow.numericUpDownSystemMinWellRatio.Value) / 100; foreach (cPlate CurrentPlate in PlatesToProcess) { cExtendedTable CurrentPlateResult = null; foreach (var item in this.DescriptorsToProcess) { cExtendedTable ET = CurrentPlate.GetAverageValueList(item, false); ET.Name = item.GetName(); cExtendedTable ResultTable = this.GenerateArtifactMessage(ET, CurrentPlate); ResultTable.ListRowNames = new List<string>(); ResultTable.ListRowNames.Add(item.GetName()); if (CurrentPlateResult == null) CurrentPlateResult = new cExtendedTable(ResultTable); else { cMerge M = new cMerge(); M.IsHorizontal = false; M.SetInputData(CurrentPlateResult, ResultTable); M.Run(); CurrentPlateResult = M.GetOutPut(); } } CurrentPlateResult.Name = CurrentPlate.GetName(); CurrentPlateResult.Tag = CurrentPlate; this.Output.Add(CurrentPlateResult); } this.Output.Name = "Systematic Errors (" + PlatesToProcess.Count + " plate(s))"; if (IsDisplayResults) { cDisplayToWindow DTW = new cDisplayToWindow(); cDesignerMultiChoices DMC = new cDesignerMultiChoices(); foreach (var item in this.Output) { cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = System.Windows.Forms.Orientation.Horizontal; DS.Title = item.Name; cViewerTable VT = new cViewerTable(); VT.SetInputData(item); VT.DigitNumber = 0; VT.Run(); DS.SetInputData(VT.GetOutPut()); cViewerHeatMap VHM = new cViewerHeatMap(); VHM.SetInputData(item); VHM.IsAutomatedMinMax = false; VHM.Min = 0; VHM.Max = 1; VHM.Run(); DS.SetInputData(VHM.GetOutPut()); DS.Run(); cExtendedControl TmpXCtrl = DS.GetOutPut(); TmpXCtrl.Tag = item.Tag; DMC.SetInputData(TmpXCtrl); } DMC.Run(); DTW.SetInputData(DMC.GetOutPut()); DTW.Title = "Systematic Errors [" + PlatesToProcess.Count + " plate(s)]"; DTW.Run(); DTW.Display(); //cDisplayListExtendedTable DLET = new cDisplayListExtendedTable(); //DLET.SetInputData(this.Output); //return DLET.Run(); } return FeedBackMessage; }