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 } }
private void ToolStripMenuItem_OperationsTranspose(object sender, EventArgs e) { cTranspose CI = new cTranspose(); CI.SetInputData(this.Input); CI.Run(); cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(CI.GetOutPut()); CDT.Run(); }