private void zScoreToolStripMenuItem_Click(object sender, EventArgs e) { #region obsolete //List<double> Pos = new List<double>(); //List<double> Neg = new List<double>(); //List<cSimpleSignature> ZFactorList = new List<cSimpleSignature>(); //int NumDesc = CompleteScreening.ListDescriptors.Count; //cWell TempWell; //// loop on all the desciptors //for (int Desc = 0; Desc < NumDesc; Desc++) //{ // Pos.Clear(); // Neg.Clear(); // if (CompleteScreening.ListDescriptors[Desc].IsActive() == false) continue; // for (int row = 0; row < CompleteScreening.Rows; row++) // for (int col = 0; col < CompleteScreening.Columns; col++) // { // TempWell = CompleteScreening.GetCurrentDisplayPlate().GetWell(col, row, true); // if (TempWell == null) continue; // else // { // if (TempWell.GetClassIdx() == 0) // Pos.Add(TempWell.ListDescriptors[Desc].GetValue()); // if (TempWell.GetClassIdx() == 1) // Neg.Add(TempWell.ListDescriptors[Desc].GetValue()); // } // } // if (Pos.Count < 3) // { // MessageBox.Show("No or not enough positive controls !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; // } // if (Neg.Count < 3) // { // MessageBox.Show("No or not enough negative controls !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); // return; // } // double ZScore = 1 - 3 * (std(Pos.ToArray()) + std(Neg.ToArray())) / (Math.Abs(Mean(Pos.ToArray()) - Mean(Neg.ToArray()))); // GlobalInfo.ConsoleWriteLine(CompleteScreening.ListDescriptors[Desc].GetName() + ", Z-Score = " + ZScore); // cSimpleSignature TmpDesc = new cSimpleSignature(CompleteScreening.ListDescriptors[Desc].GetName(), ZScore); // ZFactorList.Add(TmpDesc); //} //ZFactorList.Sort(delegate(cSimpleSignature p1, cSimpleSignature p2) { return p1.AverageValue.CompareTo(p2.AverageValue); }); //Series CurrentSeries = new Series(); //CurrentSeries.ChartType = SeriesChartType.Column; //CurrentSeries.ShadowOffset = 1; //Series SeriesLine = new Series(); //SeriesLine.Name = "SeriesLine"; //SeriesLine.ShadowOffset = 1; //SeriesLine.ChartType = SeriesChartType.Line; //int RealIdx = 0; //for (int IdxValue = 0; IdxValue < ZFactorList.Count; IdxValue++) //{ // if (double.IsNaN(ZFactorList[IdxValue].AverageValue)) continue; // if (double.IsInfinity(ZFactorList[IdxValue].AverageValue)) continue; // CurrentSeries.Points.Add(ZFactorList[IdxValue].AverageValue); // CurrentSeries.Points[RealIdx].Label = ZFactorList[IdxValue].AverageValue.ToString("N2"); // CurrentSeries.Points[RealIdx].Font = new Font("Arial", 10); // CurrentSeries.Points[RealIdx].ToolTip = ZFactorList[IdxValue].Name; // CurrentSeries.Points[RealIdx].AxisLabel = ZFactorList[IdxValue].Name; // SeriesLine.Points.Add(ZFactorList[IdxValue].AverageValue); // SeriesLine.Points[RealIdx].BorderColor = Color.Black; // SeriesLine.Points[RealIdx].MarkerStyle = MarkerStyle.Circle; // SeriesLine.Points[RealIdx].MarkerSize = 4; // RealIdx++; //} //SimpleForm NewWindow = new SimpleForm(CompleteScreening); //int thisWidth = 200 * RealIdx; //if (thisWidth > (int)GlobalInfo.OptionsWindow.numericUpDownMaximumWidth.Value) thisWidth = (int)GlobalInfo.OptionsWindow.numericUpDownMaximumWidth.Value; //NewWindow.Width = thisWidth; //NewWindow.Height = 400; //NewWindow.Text = "Z-factors"; //ChartArea CurrentChartArea = new ChartArea(); //CurrentChartArea.BorderColor = Color.Black; //CurrentChartArea.AxisX.Interval = 1; //NewWindow.chartForSimpleForm.Series.Add(CurrentSeries); //NewWindow.chartForSimpleForm.Series.Add(SeriesLine); //CurrentChartArea.AxisX.IsLabelAutoFit = true; //NewWindow.chartForSimpleForm.ChartAreas.Add(CurrentChartArea); //CurrentChartArea.Axes[1].Maximum = 2; //CurrentChartArea.Axes[1].IsMarksNextToAxis = true; //CurrentChartArea.Axes[0].MajorGrid.Enabled = false; //CurrentChartArea.Axes[1].MajorGrid.Enabled = false; //NewWindow.chartForSimpleForm.TextAntiAliasingQuality = TextAntiAliasingQuality.High; //CurrentChartArea.BackGradientStyle = GradientStyle.TopBottom; //CurrentChartArea.BackColor = CompleteScreening.GlobalInfo.OptionsWindow.panel1.BackColor; //CurrentChartArea.BackSecondaryColor = Color.White; //CurrentChartArea.AxisX.ScaleView.Zoomable = true; //CurrentChartArea.AxisY.ScaleView.Zoomable = true; //Title CurrentTitle = new Title(CompleteScreening.GetCurrentDisplayPlate().Name + " Z-factors"); //CurrentTitle.Font = new System.Drawing.Font("Arial", 11, FontStyle.Bold); //NewWindow.chartForSimpleForm.Titles.Add(CurrentTitle); //NewWindow.Show(); //NewWindow.chartForSimpleForm.Update(); //NewWindow.chartForSimpleForm.Show(); //NewWindow.AutoScroll = true; //NewWindow.Controls.AddRange(new System.Windows.Forms.Control[] { NewWindow.chartForSimpleForm }); #endregion cGUI_2ClassesSelection GUI_ListClasses = new cGUI_2ClassesSelection(); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { GUI_ListClasses.PanelRight_IsCheckBoxes = true; } if (GUI_ListClasses.Run(this.GlobalInfo).IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); int IdxClassNeg = -1; int IdxClassPos = -1; for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++) { if (ListClassSelected[0][IdxC] == 1) IdxClassNeg = IdxC; if (ListClassSelected[1][IdxC] == 1) IdxClassPos = IdxC; } string SubTitle = "Z-Factor"; if (_QCZRobustItem.Checked) SubTitle += " (Robust)"; #region Single plate cDesignerTab DT = new cDesignerTab(); // cDesignerMultiChoices DT = new cDesignerMultiChoices(); if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/) { List<cPlate> ListPlatesToProcess = new List<cPlate>(); cPlate TmpPlate = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate(); // foreach (cPlate TmpPlate in ListPlatesToProcess) // GUI_ListClasses.Get // ListClassSelected List<int> ListCheckBoxes = new List<int>(); for (int i = 0; i < ListClassSelected[1].Count; i++) { if (ListClassSelected[1][i] > 0) ListCheckBoxes.Add(i); } for (int IdxClassSelected = 0; IdxClassSelected < ListCheckBoxes.Count; IdxClassSelected++) { cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); int CurrentClassTobeProcessed = ListCheckBoxes[IdxClassSelected]; foreach (cWell item in TmpPlate.ListActiveWells) { if (item.GetCurrentClassIdx() != -1) { if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1) ListWellsToProcess1.Add(item); if (item.GetCurrentClassIdx() == CurrentClassTobeProcessed) // if (ListClassSelected[1][ListCheckBoxes[IdxClassSelected]] == 1) ListWellsToProcess2.Add(item); } } cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); 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; } 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(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cZFactor ZF = new cZFactor(); ZF.SetInputData(TableForZ); ZF.IsRobust = _QCZRobustItem.Checked; ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); 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 + " - " + cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " (" + NewTable1[0].Count + " wells) vs. " + cGlobalInfo.ListWellClasses[CurrentClassTobeProcessed].Name + " (" + NewTable2[0].Count + " wells)"; ET[0].Name = ET.Name; cSort S = new cSort(); S.SetInputData(ET); 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.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); if (!cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxZscoreMinValueAutomated.Checked) { VG1.Chart.DefaultAxisYMin = new cExtendedList(); VG1.Chart.DefaultAxisYMin.Add((double)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownZscoreMinValue.Value); } VG1.Title = TmpPlate.GetName(); Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Title = cGlobalInfo.ListWellClasses[IdxClassNeg].Name + " vs. " + cGlobalInfo.ListWellClasses[CurrentClassTobeProcessed].Name; DS.Run(); DT.SetInputData(DS.GetOutPut()); } DT.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut()); CDW.Title = SubTitle + " - " + TmpPlate.GetName(); CDW.Run(); CDW.Display(); } #endregion #region plate by plate DT = new cDesignerTab(); // cDesignerMultiChoices DT = new cDesignerMultiChoices(); if ((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); } 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, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); 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; } 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(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cZFactor ZF = new cZFactor(); ZF.SetInputData(TableForZ); ZF.IsRobust = _QCZRobustItem.Checked; ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); 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 + " - " + 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.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.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); if (!cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxZscoreMinValueAutomated.Checked) { VG1.Chart.DefaultAxisYMin = new cExtendedList(); VG1.Chart.DefaultAxisYMin.Add((double)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownZscoreMinValue.Value); } VG1.Title = TmpPlate.GetName(); Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); 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()); 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]); cZFactor ZF = new cZFactor(); ZF.IsRobust = _QCZRobustItem.Checked; 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.Chart.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); if (!cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxZscoreMinValueAutomated.Checked) { VG1.Chart.DefaultAxisYMin = new cExtendedList(); VG1.Chart.DefaultAxisYMin.Add((double)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownZscoreMinValue.Value); } Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); 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_CrossZFactor(object sender, EventArgs e) { cGUI_ListSingleClasse GUI_ListClasses = new cGUI_ListSingleClasse(); GUI_ListClasses.IsCheckBoxes = true; if (GUI_ListClasses.Run().IsSucceed == false) return; cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut(); int ClassId = 0; //int NumActiveDesc = 0; //foreach (cDescriptorType DescType in this.GlobalInfo.CurrentScreening.ListDescriptors) //{ // if (DescType.IsActive() == false) continue; // NumActiveDesc++; //} cExtendedTable FinalListValues = new cExtendedTable(); cExtendedTable TmpTable = new cExtendedTable(); TmpTable.Add(new cExtendedList("Sorted Z'")); TmpTable.ListRowNames = new List<string>(); TmpTable[0].ListTags = new List<object>(); // TmpTable.ListTags = new List<object>(); for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++) { cDescriptorType CurrentDescType = cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc]; if (CurrentDescType.IsActive() == false) continue; cExtendedTable ListSource = new cExtendedTable(); // int IdxClasse =0; foreach (var item in cGlobalInfo.ListWellClasses) { // if (ListClassSelected[0][IdxClasse] == 1) ListSource.Add(new cExtendedList(item.Name)); // if (ListClassSelected[1][IdxClasse] == 1) //ListDestination.Add(new cExtendedList(item.Name)); // IdxClasse++; } foreach (cWell TmpWell in cGlobalInfo.ListSelectedWell) { ClassId = TmpWell.GetCurrentClassIdx(); if (ClassId > -1) { if (GUI_ListClasses.GetOutPut()[ClassId] == 1) ListSource[ClassId].Add(TmpWell.GetAverageValue(CurrentDescType)); //if (GUI_ListClasses.GetOutPut()[1][ClassId] == 1) //ListDestination[ClassId].Add(TmpWell.GetAverageValue(CurrentDescType)); } } int InitCount = ListSource.Count; for (int i = 0; i < ListSource.Count; i++) { if (ListSource[i].Count < 2) { ListSource.RemoveAt(i); i--; } } // if (ListSource.Count == 0) return; cZFactor ZF = new cZFactor(); ZF.SetInputData(ListSource); cFeedBackMessage FM = ZF.Run(); richTextBoxConsole.AppendText(FM.Message); if (!FM.IsSucceed) return; cExtendedTable ListValues = ZF.GetOutPut(); for (int i = 0; i < ListValues.Count; i++) { for (int j = 0; j < i; j++) { TmpTable[0].Add(ListValues[i][j]); TmpTable.ListRowNames.Add(ListValues[i].Name + " vs. " + ListValues[j].Name + " - [" + CurrentDescType.GetName() + "]"); TmpTable[0].ListTags.Add(CurrentDescType); } } } cSort S = new cSort(); S.SetInputData(TmpTable); S.IsAscending = false; S.Run(); //cViewerTable VT1 = new cViewerTable(); //VT1.SetInputData(ListValues); //VT1.Run(); cViewerTable VT2 = new cViewerTable(); VT2.SetInputData(S.GetOutPut()); VT2.Run(); //cDesignerSplitter DS = new cDesignerSplitter(); //DS.Orientation = Orientation.Vertical; //DS.SetInputData(VT2.GetOutPut()); //DS.SetInputData(VT1.GetOutPut()); //DS.Run(); cDisplayToWindow DTW = new cDisplayToWindow(); DTW.Title = "Cross Classes Z'"; DTW.SetInputData(VT2.GetOutPut()); DTW.Run(); DTW.Display(); }
private void ToolStripMenuItem_ZFactor(object sender, EventArgs e) { cGUI_2ClassesSelection GUI_ListClasses = new cGUI_2ClassesSelection(); if (GUI_ListClasses.Run(this.GlobalInfo).IsSucceed == false) return; cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut(); int IdxClassNeg = -1; int IdxClassPos = -1; for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++) { if (ListClassSelected[0][IdxC] == 1) IdxClassNeg = IdxC; if (ListClassSelected[1][IdxC] == 1) IdxClassPos = IdxC; } string SubTitle = "Z-Factor"; cListWells ListWellsToProcess1 = new cListWells(null); cListWells ListWellsToProcess2 = new cListWells(null); foreach (cWell item in cGlobalInfo.ListSelectedWell) { 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, true); cExtendedTable NewTable2 = new cExtendedTable(ListWellsToProcess2, true); 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; } } 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(); TableForZ.Add(NewTable1[RealIdx]); TableForZ.Add(NewTable2[RealIdx]); RealIdx++; cZFactor ZF = new cZFactor(); ZF.SetInputData(TableForZ); ZF.IsRobust = _QCZRobustItem.Checked; ZF.Run(); ListZ.Add(ZF.GetOutPut()[0][1]); 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 = SubTitle + " - " + 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.ColumnIndexForSorting = 0; S.Run(); 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.DefaultAxisYMax = new cExtendedList(); VG1.Chart.DefaultAxisYMax.Add(1); //VG1.Title = TmpPlate.Name; Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.5); VLZ05.IsAllowMoving = true; VG1.Chart.ListHorizontalLines.Add(VLZ05); VG1.Run(); cDesignerSplitter DS = new cDesignerSplitter(); DS.Orientation = Orientation.Vertical; DS.SetInputData(VG1.GetOutPut()); cSort S1 = new cSort(); S1.SetInputData(ET); S1.ColumnIndexForSorting = 0; S1.IsAscending = false; S1.Run(); cViewerTable VT = new cViewerTable(); VT.SetInputData(S1.GetOutPut()); VT.Run(); DS.SetInputData(VT.GetOutPut()); DS.Run(); cDisplayToWindow CDW = new cDisplayToWindow(); CDW.SetInputData(DS.GetOutPut());//VG1.GetOutPut()); CDW.Title = "List Wells - Z Factor"; CDW.Run(); CDW.Display(); }
private void ToolStripMenuItem_ZFactor(object sender, EventArgs e) { cExtendedTable CET = new cExtendedTable(); foreach (DataGridViewColumn item in GridView.SelectedColumns) CET.Add(Input[item.Index]); cZFactor S = new cZFactor(); S.SetInputData(CET); S.Run(); cDisplayExtendedTable CDT = new cDisplayExtendedTable(); CDT.SetInputData(S.GetOutPut()); CDT.Run(); }