Beispiel #1
0
        private void ToolStripMenuItem_DisplayDataTable(object sender, EventArgs e)
        {
            if (GlobalInfo == null) return;
            cListWells ListWellsToProcess = new cListWells(null);

            for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++)
            {
                if (cGlobalInfo.ListWellClasses[i].Name == this.Name)
                {
                    Idx = i;
                    break;
                }
            }

            if (Idx == -1) return;

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() == Idx) ListWellsToProcess.Add(item);

            cExtendedTable DataFromPlate = new cExtendedTable(ListWellsToProcess, true);
            DataFromPlate.Name = this.Name + " : " + ListWellsToProcess.Count + " wells";
            DataFromPlate.ListRowNames.Clear();

            foreach (var item in ListWellsToProcess)
            {
                DataFromPlate.ListRowNames.Add(item.GetShortInfo());
            }

            cDisplayExtendedTable DEXT = new cDisplayExtendedTable();
            DEXT.SetInputData(DataFromPlate);
            DEXT.Run();
        }
Beispiel #2
0
        private void ToolStripMenuItem_DisplaySingleCellHistogram(object sender, EventArgs e)
        {
            cListWells ListWells = new cListWells();
            List<cDescriptorType> LCDT = new List<cDescriptorType>();
            LCDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor());

            List<cWellClassType> ListForCurrentClass = new List<cWellClassType>();
            ListForCurrentClass.Add(this);

            cGUI_ListClasses GUIClasses = new cGUI_ListClasses();
            GUIClasses.IsCheckBoxes = true;
            GUIClasses.IsSelectAll = true;
            GUIClasses.ClassType = eClassType.PHENOTYPE;
            if (!GUIClasses.Run().IsSucceed) return;

            cDesignerTab DT = new cDesignerTab();

            if (cGlobalInfo.WindowHCSAnalyzer.ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    ListWells.AddRange(CurrentPlate.ListWells.Filter(ListForCurrentClass));
                }
                    cExtendedTable FinalTable = new cExtendedTable();
                    FinalTable.Name = "Stacked Histogram: " + ListWells.Count + " wells";

                    int Idx = 0;
                    foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                    {
                        FinalTable.Add(new cExtendedList());
                        FinalTable[Idx].Name = item.Name;
                        FinalTable[Idx].Tag = item;

                        Idx++;
                    }

                    foreach (cWell TmpWell in ListWells)
                    {
                        TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName);

                        int IDx = 0;
                        foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                        {
                            if (GUIClasses.GetOutPut()[0][IDx] == 0) { IDx++; continue; }
                            List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>();
                            ListCellularPhenotypesToBeSelected.Add(item);

                            cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell,
                                                     LCDT, ListCellularPhenotypesToBeSelected);

                            if (TmpET.Count > 0) FinalTable[IDx].AddRange(TmpET[0]);
                            IDx++;
                        }
                        TmpWell.AssociatedPlate.DBConnection.CloseConnection();
                    }

                    cViewerStackedHistogram VSH = new cViewerStackedHistogram();
                    VSH.SetInputData(FinalTable);
                    VSH.Chart.BinNumber = LCDT[0].GetBinNumber();
                    VSH.Chart.IsShadow = false;
                    VSH.Chart.IsBorder = false;
                    VSH.Chart.IsXGrid = true;
                    VSH.Chart.IsYGrid = true;
                    VSH.Chart.LabelAxisX = LCDT[0].GetName();

                    VSH.Run();
                    VSH.Chart.Width = 0;
                    VSH.Chart.Height = 0;
                    VSH.GetOutPut().Title = cGlobalInfo.CurrentScreening.GetName();
                    DT.SetInputData(VSH.GetOutPut());
            }
            else
            {
                cListPlates ListPlates = new cListPlates();
                if (cGlobalInfo.WindowHCSAnalyzer.ProcessModeplateByPlateToolStripMenuItem.Checked)
                    ListPlates = cGlobalInfo.CurrentScreening.ListPlatesActive;
                else
                    ListPlates.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());

                foreach (cPlate CurrentPlate in ListPlates)
                {
                    ListWells = CurrentPlate.ListWells.Filter(ListForCurrentClass);

                    cExtendedTable FinalTable = new cExtendedTable();
                    FinalTable.Name = "Stacked Histogram: " + ListWells.Count + " wells - " + CurrentPlate.GetName();

                    int Idx = 0;
                    foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                    {
                        FinalTable.Add(new cExtendedList());
                        FinalTable[Idx].Name = item.Name;
                        FinalTable[Idx].Tag = item;

                        if (GUIClasses.GetOutPut()[0][Idx] == 0)
                        {
                            Idx++;
                            continue;
                        }

                        Idx++;
                    }

                    foreach (cWell TmpWell in ListWells)
                    {
                        TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName);

                        int IDx = 0;
                        foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                        {
                            if (GUIClasses.GetOutPut()[0][IDx] == 0) { IDx++; continue; }
                            List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>();
                            ListCellularPhenotypesToBeSelected.Add(item);

                            cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell,
                                                     LCDT, ListCellularPhenotypesToBeSelected);

                            if (TmpET.Count > 0) FinalTable[IDx].AddRange(TmpET[0]);
                            IDx++;
                        }
                        TmpWell.AssociatedPlate.DBConnection.CloseConnection();
                    }

                    cViewerStackedHistogram VSH = new cViewerStackedHistogram();
                    VSH.SetInputData(FinalTable);
                    VSH.Chart.BinNumber = LCDT[0].GetBinNumber();
                    VSH.Chart.IsShadow = false;
                    VSH.Chart.IsBorder = false;
                    VSH.Chart.IsXGrid = true;
                    VSH.Chart.IsYGrid = true;
                    VSH.Chart.LabelAxisX = LCDT[0].GetName();

                    VSH.Run();
                    VSH.Chart.Width = 0;
                    VSH.Chart.Height = 0;
                    VSH.GetOutPut().Title = CurrentPlate.GetName();
                    DT.SetInputData(VSH.GetOutPut());
                }
            }
            DT.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(DT.GetOutPut());
            DTW.Title = "Single Cell Histograms";
            DTW.Run();
            DTW.Display();
        }
Beispiel #3
0
        private void dToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            cFeedBackMessage MessageReturned;

            cViewer2DScatterPoint V1D = new cViewer2DScatterPoint();
            V1D.Chart.IsSelectable = true;
            //V1D.Chart.LabelAxisX = "Well Index";
            //V1D.Chart.LabelAxisY = CompleteScreening.ListDescriptors[CompleteScreening.ListDescriptors.CurrentSelectedDescriptor].GetName();
            //V1D.Chart.BackgroundColor = Color.LightYellow;
            //V1D.Chart.IsXAxis = true;


            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //cDisplayToWindow CDW1 = new cDisplayToWindow();
            // cListWell ListWellsToProcess = new cListWell();

            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                //cExtendedTable DataFromPlate = new cExtendedTable(CompleteScreening.GetCurrentDisplayPlate().ListActiveWells,
                //                                CompleteScreening.ListDescriptors.CurrentSelectedDescriptor);
                cListWells ListWellsToProcess = new cListWells(null);


                //foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive)
                foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                    if (item.GetCurrentClassIdx() != -1)
                        if (ListClassSelected[item.GetCurrentClassIdx()] == 1) ListWellsToProcess.Add(item);

                cExtendedTable DataFromPlate = new cExtendedTable(ListWellsToProcess, true);
                DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName();

                V1D.Chart.IsShadow = true;
                V1D.Chart.IsBorder = true;
                V1D.Chart.IsSelectable = true;
                V1D.Chart.CurrentTitle.Tag = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                V1D.SetInputData(DataFromPlate);
                MessageReturned = V1D.Run();
                if (MessageReturned.IsSucceed == false)
                {
                    MessageBox.Show(MessageReturned.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                cDesignerSinglePanel Designer0 = new cDesignerSinglePanel();
                Designer0.SetInputData(V1D.GetOutPut());
                Designer0.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(Designer0.GetOutPut());
                Disp0.Title = "2D Scatter points graph - " + DataFromPlate[0].Count + " wells.";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                V1D.Chart.MarkerSize = 5;
                V1D.Chart.IsBorder = false;

                //List<cWell> ListWell = new List<cWell>();
                //foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive)
                //    foreach (cWell TmpWell in TmpPlate.ListActiveWells)
                //        ListWell.Add(TmpWell);

                //cExtendedTable DataFromPlate = new cExtendedTable(ListWell,
                //                                CompleteScreening.ListDescriptors.CurrentSelectedDescriptor);

                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if (item.GetCurrentClassIdx() != -1)
                            if (ListClassSelected[item.GetCurrentClassIdx()] == 1) ListWellsToProcess.Add(item);

                cExtendedTable DataFromPlate = new cExtendedTable(ListWellsToProcess, true);

                DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetName() + " - " + cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";

                V1D.SetInputData(DataFromPlate);
                V1D.Run();

                cDesignerSinglePanel Designer0 = new cDesignerSinglePanel();
                Designer0.SetInputData(V1D.GetOutPut());
                Designer0.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(Designer0.GetOutPut());
                Disp0.Title = "2D Scatter points graph - " + DataFromPlate[0].Count + " wells.";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();

               
                //dislin.metafl("xwin");

                
                //dislin.disini();
                
                

                //dislin.name("X-axis", "X");
                //dislin.name("Y-axis", "Y");
                

                
                //dislin.title();

                
                //dislin.axslen(1000, 1000);


                ////dislin.graf(0.0, 1.0, 0.0, 0.1, 0.0, 1.0, 0.0, 0.1);

                
                ////dislin.crvmat(func, n, n, 1, 1);

               
                //dislin.disfin();

            }
            else if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab CDT = new cDesignerTab();

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    //cExtendedTable DataFromPlate = new cExtendedTable(TmpPlate.ListActiveWells,
                    //                            CompleteScreening.ListDescriptors.CurrentSelectedDescriptor);

                    cListWells ListWellsToProcess = new cListWells(null);

                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if (item.GetCurrentClassIdx() != -1)
                            if (ListClassSelected[item.GetCurrentClassIdx()] == 1) ListWellsToProcess.Add(item);

                    cExtendedTable DataFromPlate = new cExtendedTable(ListWellsToProcess, true);

                    DataFromPlate.Name = TmpPlate.GetName();

                    V1D = new cViewer2DScatterPoint();
                    V1D.Chart.IsSelectable = true;
                    V1D.Chart.LabelAxisX = "Well Index";
                    V1D.Chart.LabelAxisY = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    V1D.Chart.BackgroundColor = Color.LightYellow;
                    V1D.Chart.IsXGrid = true;
                    V1D.Chart.CurrentTitle.Tag = TmpPlate;
                    V1D.SetInputData(DataFromPlate);
                    V1D.Title = TmpPlate.GetName();
                    V1D.Run();

                    CDT.SetInputData(V1D.GetOutPut());
                }

                CDT.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(CDT.GetOutPut());
                Disp0.Title = "2D Scatter points graphs";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();

               
            }


            //if (CompleteScreening == null) return;

            //SimpleFormForXY FormToDisplayXY = new SimpleFormForXY(false);
            //FormToDisplayXY.CompleteScreening = CompleteScreening;

            //for (int i = 0; i < (int)CompleteScreening.ListDescriptors.Count; i++)
            //{
            //    FormToDisplayXY.comboBoxDescriptorX.Items.Add(CompleteScreening.ListDescriptors[i].GetName());
            //    FormToDisplayXY.comboBoxDescriptorY.Items.Add(CompleteScreening.ListDescriptors[i].GetName());
            //}

            //FormToDisplayXY.comboBoxDescriptorX.SelectedIndex = 0;
            //FormToDisplayXY.comboBoxDescriptorY.SelectedIndex = 0;


            //FormToDisplayXY.DisplayXY();
            //FormToDisplayXY.ShowDialog();

            //return;
        }
Beispiel #4
0
        private void wellsMergingToolsToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            cListWells ListWellsToProcess = new cListWells();

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                foreach (cWell TmpWell in TmpPlate.ListActiveWells)
                {

                    if (TmpWell.GetCurrentClassIdx() == -1) continue;
                    ListWellsToProcess.Add(TmpWell);
                }

            ListWellsToProcess.MergeWells();

        }
Beispiel #5
0
        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
            }

        }
Beispiel #6
0
        private void PerformTestType(eTestType TestType)
        {

            #region extract classes of interest
            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = !_DescEvolCellByCellItem.Checked;
            GUI_ListClasses.IsSelectAll = true;

            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

            cDesignerTab DT = new cDesignerTab();

            for (int i = 0; i < cGlobalInfo.CurrentScreening.ListDescriptors.Count; i++)
            {

                if (cGlobalInfo.CurrentScreening.ListDescriptors[i].IsActive() == false) continue;

                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = Orientation.Vertical;
                cViewerTable VTable = new cViewerTable();

                cViewertext VT = new cViewertext();

                cExtendedTable FinalTable = new cExtendedTable(cGlobalInfo.ListWellClasses.Count, 0, 0);
                for (int j = 0; j < cGlobalInfo.ListWellClasses.Count; j++)
                {
                    FinalTable[j].Tag = cGlobalInfo.ListWellClasses[j];
                    FinalTable[j].Name = cGlobalInfo.ListWellClasses[j].Name;
                }

                cListWells ListWellsToProcess = new cListWells(null);
                cDescriptorType CurrentDesc = cGlobalInfo.CurrentScreening.ListDescriptors[i];
                // build the table
                foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell CurrentWell in CurrentPlate.ListActiveWells)
                    {
                        if ((CurrentWell.GetCurrentClassIdx() < 0) || (ListClassSelected[0][CurrentWell.GetCurrentClassIdx()] == 0)) continue;
                        {
                            FinalTable[CurrentWell.GetCurrentClassIdx()].Add(CurrentWell.GetAverageValue(CurrentDesc));
                            ListWellsToProcess.Add(CurrentWell);
                        }
                    }
                }

                cClean C = new cClean();
                C.SetInputData(FinalTable);
                C.Run();
                cExtendedTable NewTable = C.GetOutPut();

                cTwoSampleFTest TSFTest = null;
                cANOVA Anova = null;
                cTwoSampleUnpooledTTest TwoSampleTTest = null;
                cStudent_tTest StudentTTest = null;

                if (TestType == eTestType.F_TEST)
                {
                    TSFTest = new cTwoSampleFTest();
                    TSFTest.SetInputData(NewTable);
                    TSFTest.Run();
                    VTable.SetInputData(TSFTest.GetOutPut());
                    VT.SetInputData(TSFTest.GetInfo());
                }
                else if (TestType == eTestType.ANOVA)
                {
                    Anova = new cANOVA();
                    Anova.SetInputData(NewTable);
                    Anova.Run();
                    VTable.SetInputData(Anova.GetOutPut());
                    VT.SetInputData(Anova.GetInfo());
                }
                else if (TestType == eTestType.TWO_SAMPLES_T_TEST)
                {
                    TwoSampleTTest = new cTwoSampleUnpooledTTest();
                    TwoSampleTTest.SetInputData(NewTable);
                    TwoSampleTTest.Run();
                    VTable.SetInputData(TwoSampleTTest.GetOutPut());
                    VT.SetInputData(TwoSampleTTest.GetInfo());
                }
                else if (TestType == eTestType.STUDENT_T_TEST)
                {
                    StudentTTest = new cStudent_tTest();
                    StudentTTest.SetInputData(NewTable);
                    StudentTTest.Run();
                    VTable.SetInputData(StudentTTest.GetOutPut());
                    VT.SetInputData(StudentTTest.GetInfo());
                }
                VTable.DigitNumber = -1;
                VTable.Run();
                DS.SetInputData(VTable.GetOutPut());

                VT.Run();
                DS.SetInputData(VT.GetOutPut());
                DS.Run();
                DS.Title = cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName();

                cDesignerSplitter DSMain = new cDesignerSplitter();
                DSMain.Orientation = Orientation.Horizontal;
                DSMain.SetInputData(DS.GetOutPut());

                // Compute and display associated Stacked histogram

                //CDW1.Title = CompleteScreening.ListDescriptors[CompleteScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram - " + PlateList.Count + " plates";

                cExtendedTable TableForHisto = ListWellsToProcess.GetAverageDescriptorValues(i);
                TableForHisto.Name = "";

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(TableForHisto);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName();
                CV1.Chart.IsLegend = true;
                CV1.Run();

                DSMain.SetInputData(CV1.GetOutPut());
                DSMain.Title = cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName();
                DSMain.Run();
                DT.SetInputData(DSMain.GetOutPut());
            }

            DT.Run();
            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(DT.GetOutPut());
            DTW.Title = "Classification Significance - " + TestType.ToString();
            DTW.Run();
            DTW.Display();

        }
Beispiel #7
0
        private void testMultiScatterToolStripMenuItem_Click(object sender, EventArgs e)
        {

            //V1D.Chart.LabelAxisX = "Well Index";
            //V1D.Chart.LabelAxisY = CompleteScreening.ListDescriptors[CompleteScreening.ListDescriptors.CurrentSelectedDescriptor].GetName();
            //V1D.Chart.BackgroundColor = Color.LightYellow;
            //V1D.Chart.IsXAxis = true;


            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            cDesignerSplitter CDC = new cDesignerSplitter();
            cListWells ListWellsToProcess = new cListWells(null);

            //foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive)
            foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                if (item.GetCurrentClassIdx() != -1)
                    if (ListClassSelected[item.GetCurrentClassIdx()] == 1) ListWellsToProcess.Add(item);

            cExtendedTable DataFromPlate = new cExtendedTable(ListWellsToProcess, true);
            DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName();

            //if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {


                for (int IdxDesc0 = 0; IdxDesc0 < DataFromPlate.Count; IdxDesc0++)
                    for (int IdxDesc1 = 1; IdxDesc1 < DataFromPlate.Count; IdxDesc1++)
                    {


                        cViewer2DScatterPoint V1D = new cViewer2DScatterPoint();
                        V1D.Chart.CurrentTitle.Tag = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                        V1D.Chart.IdxDesc0 = IdxDesc0;
                        V1D.Chart.IdxDesc1 = IdxDesc1;
                        V1D.SetInputData(DataFromPlate);
                        V1D.Run();
                        V1D.Chart.Width = 0;
                        V1D.Chart.Height = 0;

                        cDesignerSinglePanel Designer0 = new cDesignerSinglePanel();
                        Designer0.SetInputData(V1D.GetOutPut());
                        Designer0.Run();

                        CDC.SetInputData(Designer0.GetOutPut());
                    }
            }

            CDC.Run();

            cDisplayToWindow Disp0 = new cDisplayToWindow();
            Disp0.SetInputData(CDC.GetOutPut());
            Disp0.Title = "2D Scatter points graph - wells.";
            if (!Disp0.Run().IsSucceed) return;
            Disp0.Display();

        }
Beispiel #8
0
        private void covarianceMatrixToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1)
            {
                MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            cDisplayToWindow vD = new cDisplayToWindow();
            cDesignerTab DT = new cDesignerTab();

            cCovarianceMatrix CM = new cCovarianceMatrix();
            // CM.FTestTails = eFTestTails.BOTH;

            if (this.ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);


                    CM.SetInputData(NewTable);
                    CM.Run();

                    //cViewerHeatMap VHM = new cViewerHeatMap();
                    cViewerTable VHM = new cViewerTable();
                    VHM.SetInputData(CM.GetOutPut());
                    //VHM.IsDisplayValues = true;
                    vD.Title = "Covariance - " + TmpPlate.GetName() + " (" + ListWellsToProcess.Count + " wells)";
                    VHM.Run();

                    DT.SetInputData(VHM.GetOutPut());
                }
            }
            else if (this.ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);
                }

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                //  cTwoSampleFTest CM = new cTwoSampleFTest();
                CM.SetInputData(NewTable);
                CM.Run();

                // cViewerHeatMap VHM = new cViewerHeatMap();
                cViewerTable VHM = new cViewerTable();
                VHM.SetInputData(CM.GetOutPut());
                //VHM.IsDisplayValues = true;
                vD.Title = "Covariance - Entire screening (" + ListWellsToProcess.Count + " wells)";
                VHM.Run();

                DT.SetInputData(VHM.GetOutPut());
            }
            else
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                    if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                // cTwoSampleFTest CM = new cTwoSampleFTest();
                CM.SetInputData(NewTable);
                CM.Run();

                //cViewerHeatMap VHM = new cViewerHeatMap();
                cViewerTable VHM = new cViewerTable();
                VHM.SetInputData(CM.GetOutPut());
                //VHM.IsDisplayValues = true;
                vD.Title = "Covariance - " + cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName() + " (" + ListWellsToProcess.Count + " wells)";
                VHM.Run();

                DT.SetInputData(VHM.GetOutPut());
            }

            DT.Run();

            vD.SetInputData(DT.GetOutPut());
            // vD.Title = "F-Test";
            vD.Run();
            vD.Display();
        }
Beispiel #9
0
        public void PerformScreeningClustering(List<cPlate> ListPlatesToProcess, bool IsOneByOne)
        {


            this.Cursor = Cursors.WaitCursor;
            cMachineLearning MachineLearning = new cMachineLearning(this.GlobalInfo);
            cParamAlgo ParamAlgoForClustering = MachineLearning.AskAndGetClusteringAlgo();
            if (ParamAlgoForClustering == null)
            {
                this.Cursor = Cursors.Default;
                return;
            }

            //DataTable dt = new DataTable();
            cExtendedTable dt = new cExtendedTable();


            for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].IsActive())
                    dt.Add(new cExtendedList(cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].GetName()));
            }
            if (IsOneByOne)
            {
                foreach (cPlate itemPlate in ListPlatesToProcess)
                {
                    cListWells ListWell = new cListWells(null);

                    foreach (var item in itemPlate.ListActiveWells)
                        ListWell.Add(item);

                    dt = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false);

                    MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, dt);

                    if (MachineLearning.SelectedClusterer != null)
                    {
                        double[] Assign = MachineLearning.EvaluteAndDisplayClusterer(richTextBoxInfoClustering,
                                                                null,
                                                                MachineLearning.CreateInstancesWithoutClass(dt)).getClusterAssignments();

                        MachineLearning.Classes = new cExtendedList();
                        MachineLearning.Classes.AddRange(Assign);
                    }
                    if (MachineLearning.Classes.Max() >= cGlobalInfo.ListWellClasses.Count)
                    {
                        MessageBox.Show("The number of clusters is higher than the supported number of classes. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Cursor = Cursors.Default;
                        return;
                    }
                    if (MachineLearning.Classes.IsContainNegative() || (MachineLearning.Classes.Count == 0))
                    {
                        MessageBox.Show("Negative or null cluster index identified. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Cursor = Cursors.Default;
                        return;
                    }
                    // ----- update well classes ------
                    int IdxWell = 0;
                    foreach (cWell item in itemPlate.ListActiveWells)
                        item.SetClass((int)MachineLearning.Classes[IdxWell++]);
                }
            }
            else
            {
                cListWells ListWell = new cListWells(null);
                foreach (cPlate itemPlate in ListPlatesToProcess)
                {
                    foreach (cWell item in itemPlate.ListActiveWells)
                    {
                        //cExtendedList ListValues = item.GetAverageValuesList(false);
                        //dt.Rows.Add();
                        //int RealIdx = 0;
                        //for (int IdxDesc = 0; IdxDesc < CompleteScreening.ListDescriptors.Count; IdxDesc++)
                        //{
                        //    if (CompleteScreening.ListDescriptors[IdxDesc].IsActive())
                        //        dt.Rows[dt.Rows.Count - 1][RealIdx++] = ListValues[IdxDesc];
                        ListWell.Add(item);
                        //}
                    }
                }

                dt = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false);



                MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, dt);

                if (MachineLearning.SelectedClusterer != null)
                {
                    double[] Assign = MachineLearning.EvaluteAndDisplayClusterer(richTextBoxInfoClustering,
                                                            null,
                                                            MachineLearning.CreateInstancesWithoutClass(dt)).getClusterAssignments();

                    MachineLearning.Classes = new cExtendedList();
                    MachineLearning.Classes.AddRange(Assign);
                }
                if (MachineLearning.Classes.Max() >= cGlobalInfo.ListWellClasses.Count)
                {
                    MessageBox.Show("The number of cluster is higher than the supported number of classes. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Cursor = Cursors.Default;
                    return;
                }
                if (MachineLearning.Classes.IsContainNegative() || (MachineLearning.Classes.Count == 0))
                {
                    MessageBox.Show("Negative or null cluster index identified. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Cursor = Cursors.Default;
                    return;
                }
                int IdxWell = 0;
                // ----- update well classes ------
                foreach (cPlate itemPlate in ListPlatesToProcess)
                {
                    foreach (cWell item in itemPlate.ListActiveWells)
                        item.SetClass((int)MachineLearning.Classes[IdxWell++]);
                }
            }
            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false);
            this.Cursor = Cursors.Default;
        }
Beispiel #10
0
        public cFeedBackMessage Run()
        {
            if (this.Input == null)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No input data defined.";
                return FeedBackMessage;
            }
            if (this.IsGUI)
            {
                cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty();
                if (GUI_ListWellProperty.Run().IsSucceed == false)
                {
                    FeedBackMessage.IsSucceed = false;
                    FeedBackMessage.Message = "No propoerties selected";
                    return FeedBackMessage;
                }
                ListSelectedProp = GUI_ListWellProperty.GetOutPut();

            }

            this.OutPut = new cListListWells();

            foreach(cWell TmpWell in this.Input)
            {
                bool IsSimilar = false;
                for (int i = 0; i < this.OutPut.Count; i++)
                {
                    cWell WellToCompareTo = this.OutPut[i][0];
                    bool TmpSimilarity = true;

                    foreach (cPropertyType Prop in ListSelectedProp)
                    {
                        object Val = WellToCompareTo.ListProperties.FindValueByName(Prop.Name);
                        object Val2 = TmpWell.ListProperties.FindValueByName(Prop.Name);

                        if ((Val == null) && (Val2 == null))
                        {
                            TmpSimilarity = false;
                            break;
                        }
                        if ((Val == null) || (Val2 == null))
                        {
                            TmpSimilarity = false;
                            break;
                        }
                        if (!Val.Equals(Val2))
                        {
                            TmpSimilarity = false;
                            break;
                        }
                    }

                    if (TmpSimilarity == true)
                    {
                        this.OutPut[i].Add(TmpWell);
                        IsSimilar = true;
                        break;
                    }
                }
                if (IsSimilar == false)
                {
                    cListWells LW = new cListWells();
                    LW.Name = "";
                    foreach (var item in TmpWell.ListProperties)
                    {
                        foreach (var P in ListSelectedProp)
                        {
                            if (P.Name == item.PropertyType.Name)
                            {
                                if (item.GetValue() != null)
                                {
                                    if (P.Name == "Well Class")
                                    {
                                        int Value = (int)item.GetValue();
                                        LW.Name += "[" + item.PropertyType.Name + "] = " + cGlobalInfo.ListWellClasses[Value].Name + "\n";
                                    }
                                    else
                                    {
                                        LW.Name += "[" + item.PropertyType.Name + "] = " + item.GetValue().ToString() + "\n";
                                    }
                                }
                                else
                                    goto NEXTLOOP;
                            }
                        }
                    }

                    LW.Add(TmpWell);
                    this.OutPut.Add(LW);
                NEXTLOOP: ;
                }
            }

            return FeedBackMessage;
        }
Beispiel #11
0
        private void AssociatedChart_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Clicks != 1) return;
            if (e.Button != MouseButtons.Right) return;

            ContextMenuStrip NewMenu = new ContextMenuStrip();
            foreach (var item in base.GetContextMenu(e))
                NewMenu.Items.Add(item);

            NewMenu.Items.Add(this.GetContextMenu());

            #region Selection process
            MaxX = this.ChartAreas[0].CursorX.SelectionEnd;
            MinX = this.ChartAreas[0].CursorX.SelectionStart;

            if (MaxX < MinX)
            {
                MinX = this.ChartAreas[0].CursorX.SelectionEnd;
                MaxX = this.ChartAreas[0].CursorX.SelectionStart;
            }

            MaxY = this.ChartAreas[0].CursorY.SelectionEnd;
            MinY = this.ChartAreas[0].CursorY.SelectionStart;

            if (MaxY < MinY)
            {
                MinY = this.ChartAreas[0].CursorY.SelectionEnd;
                MaxY = this.ChartAreas[0].CursorY.SelectionStart;
            }

            cListWells ListWells = new cListWells(this);
            List<DataPoint> LDP = new List<DataPoint>();
            //cListWell ListWellsToProcess = new cListWell();

            foreach (DataPoint item in this.Series[0].Points)
            {
                if ((item.XValue >= MinX) && (item.XValue <= MaxX) && (item.YValues[0] >= MinY) && (item.YValues[0] <= MaxY))
                {
                    if ((item.Tag != null) && (item.Tag.GetType() == typeof(cWell)))
                    {
                        ListWells.Add((cWell)(item.Tag));
                        LDP.Add(item);
                    }
                }
            }

            if (LDP.Count > 0)
            {
                ToolStripMenuItem SpecificContextMenu = ListWells.GetContextMenu(); //new ToolStripMenuItem("List " + LDP.Count + " wells");
                //ToolStripMenuItem ToolStripMenuItem_ChangeClass = ListWells.GetContextMenu();// new ToolStripMenuItem("Classes");
                //ToolStripMenuItem_CopyClassToClipBoard.Click += new System.EventHandler(this.ToolStripMenuItem_CopyClassToClipBoard);
                //SpecificContextMenu.DropDownItems.Add(ToolStripMenuItem_ChangeClass);

                //cWell TmpWell = (cWell)(LDP[0].Tag);

                //for (int i = 0; i < TmpWell.cGlobalInfo.ListWellClasses.Count; i++)
                //{
                //    ToolStripMenuItem ToolStripMenuItem_NewClass = new ToolStripMenuItem(TmpWell.cGlobalInfo.ListWellClasses[i].Name);
                //    ToolStripMenuItem_NewClass.Click += new System.EventHandler(this.ToolStripMenuItem_NewClass);
                //    ToolStripMenuItem_NewClass.Tag = LDP;
                //    ToolStripMenuItem_ChangeClass.DropDownItems.Add(ToolStripMenuItem_NewClass);
                //}
                NewMenu.Items.Add(SpecificContextMenu);
            }

            if ((MinX < MaxX) && (MaxY > MinY))
            {
                NewMenu.Items.Add(new ToolStripSeparator());

                int NumPtsSelected = 0;
                List<int> ListIdx = new List<int>();

                for (int j = 0; j < this.InputSimpleData[0].Count; j++)
                {
                    if ((this.InputSimpleData[IdxDesc0][j] <= MaxX) && (this.InputSimpleData[IdxDesc0][j] >= MinX) && (this.InputSimpleData[IdxDesc1][j] <= MaxY) && (this.InputSimpleData[IdxDesc1][j] >= MinY))
                    {
                        ListIdx.Add(j);

                        NumPtsSelected++;
                    }
                }

                if (NumPtsSelected > 0)
                {
                    ToolStripMenuItem TSItemSubPopSelection = new ToolStripMenuItem("List " + NumPtsSelected + " Objects");

                    ToolStripMenuItem TSItemSubPopSelectionDataTable = new ToolStripMenuItem("Display Data Table");
                    TSItemSubPopSelectionDataTable.Click += new System.EventHandler(this.TSItemSubPopSelectionDataTable);
                    TSItemSubPopSelectionDataTable.Tag = ListIdx;
                    TSItemSubPopSelection.DropDownItems.Add(TSItemSubPopSelectionDataTable);

                    ToolStripMenuItem TSItemSubPopSelectionDataTableImages = new ToolStripMenuItem("Display Data Table (inc. Images)");
                    TSItemSubPopSelectionDataTableImages.Click += new System.EventHandler(this.TSItemSubPopSelectionDataTableImages);
                    TSItemSubPopSelectionDataTableImages.Tag = ListIdx;
                    TSItemSubPopSelection.DropDownItems.Add(TSItemSubPopSelectionDataTableImages);

                    NewMenu.Items.Add(TSItemSubPopSelection);
                }

                ToolStripMenuItem TSItemZoom = new ToolStripMenuItem("Zoom");
                TSItemZoom.Click += new System.EventHandler(this.TSItemZoom);
                NewMenu.Items.Add(TSItemZoom);

            }

            #endregion

            NewMenu.DropShadowEnabled = true;
            NewMenu.Show(Control.MousePosition);
        }
Beispiel #12
0
        public cFeedBackMessage Run()
        {
            if (this.Input == null)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No input data defined.";
                return FeedBackMessage;
            }

            if (FilePath == "")
            {
                // user interface for file selection
                SaveFileDialog CurrSaveFileDialog = new SaveFileDialog();
                CurrSaveFileDialog.Filter = "CSV file (*.csv)|*.csv";
                System.Windows.Forms.DialogResult Res = CurrSaveFileDialog.ShowDialog();
                if (Res != System.Windows.Forms.DialogResult.OK)
                    return new cFeedBackMessage(false,this);
                FilePath = CurrSaveFileDialog.FileName;
            }

            try
            {
                using (FileStream fs = new FileStream(FilePath, FileMode.OpenOrCreate))
                {
                }
            }
            catch (IOException ex)
            {
                MessageBox.Show("File currently used by another application.\n", "Saving error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return new cFeedBackMessage(false,this);
            }

            // create the file
            string separator = ",";
            List<cDescriptorType> ListSelectedDesc = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveSingleCellDescriptors();

            if (ListSelectedDesc.Count == 0)
            {
                MessageBox.Show("No single cell based descriptor selected.\n", "Saving error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return new cFeedBackMessage(false, this);
            }

            FormForProgress MyProgressBar = new FormForProgress();
            MyProgressBar.progressBar.Maximum = this.Input.Count;

            MyProgressBar.Show();

            using (StreamWriter myFile = new StreamWriter(FilePath, false, Encoding.Default))
            {
                string HeaderToBeWritten = "Plate,Well,";
                for (int i = 0; i < ListSelectedDesc.Count; i++)
                {
                    HeaderToBeWritten += ListSelectedDesc[i].GetName() + separator;
                }
                HeaderToBeWritten += "Phenotype_Class";
                myFile.WriteLine(HeaderToBeWritten);

                int IdxWell = 0;
                foreach(cWell TmpWell in this.Input)
                {
                    cListWells TmpList = new cListWells(TmpWell);

                    // this table should contain all the selected descriptor values and the phenotypic classes
                    cExtendedTable CompleteTable = TmpList.GetSingleObjectDescriptorValuesFull(ListSelectedDesc);

                    HeaderToBeWritten = TmpWell.AssociatedPlate.GetName() + separator;
                    HeaderToBeWritten += TmpWell.GetPos() + separator;

                    for (int Row = 0; Row < CompleteTable[0].Count; Row++)
                    {
                        string ToBeWritten = HeaderToBeWritten;

                        for (int i = 0; i < CompleteTable.Count - 1; i++)
                            ToBeWritten += CompleteTable[i][Row] + separator;

                        ToBeWritten += CompleteTable[CompleteTable.Count - 1][Row];
                        myFile.WriteLine(ToBeWritten);
                    }

                    MyProgressBar.progressBar.Value = IdxWell++;
                    MyProgressBar.richTextBoxForComment.Text = TmpWell.GetShortInfo();
                    MyProgressBar.Update();
                }
                myFile.Close();
            }

            MyProgressBar.Close();

            return FeedBackMessage;
        }
Beispiel #13
0
 public void SetInputData(cListWells MyData)
 {
     this.Input = MyData;
 }
Beispiel #14
0
        private void panelForPlate_MouseDown(object sender, MouseEventArgs e)
        {
            if (cGlobalInfo.CurrentScreening == null) return;

            if (e.Button == System.Windows.Forms.MouseButtons.Left)
            {
                cGlobalInfo.CurrentScreening.ClientPosFirst.X = e.X;
                cGlobalInfo.CurrentScreening.ClientPosFirst.Y = e.Y;

                //     if (GlobalInfo.WindowForDRCDesign.Visible) return;
                Point locationOnForm = this.panelForPlate.FindForm().PointToClient(Control.MousePosition);
                // int VertPos = locationOnForm.Y - 163;
                // Make a note that we "have the mouse".
                bHaveMouse = true;

                // Store the "starting point" for this rubber-band rectangle.
                cGlobalInfo.CurrentScreening.ptOriginal.X = locationOnForm.X;// e.X + this.panelForPlate.Location.X/* + 10*/;
                cGlobalInfo.CurrentScreening.ptOriginal.Y = locationOnForm.Y;// e.Y + this.panelForPlate.Location.Y/* + 76*/;
                // Special value lets us know that no previous
                // rectangle needs to be erased.
                cGlobalInfo.CurrentScreening.ptLast.X = -1;
                cGlobalInfo.CurrentScreening.ptLast.Y = -1;
            }
            else if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                int ScrollShiftY = this.panelForPlate.VerticalScroll.Value;
                int ScrollShiftX = this.panelForPlate.HorizontalScroll.Value;
                int Gutter = (int)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownGutter.Value;

                int PosX = (int)((e.X - ScrollShiftX) / (cGlobalInfo.SizeHistoWidth + Gutter));
                int PosY = (int)((e.Y - ScrollShiftY) / (cGlobalInfo.SizeHistoHeight + Gutter));

                bool OnlyOnSelected = false;

                cExtendedList cExL = new cExtendedList();
                List<string> Names = new List<string>();
                string CurrentName = "";

                #region Display plate heat map
                if ((PosX == 0) && (PosY == 0))
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                        if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

                    cDesignerTab DT = new cDesignerTab();

                    for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++)
                    {
                        if (!cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].IsActive()) continue;

                        bool IsMissing;

                        cExtendedTable NewTable = null;
                        if (!checkBoxDisplayClasses.Checked)
                            NewTable = new cExtendedTable(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetAverageValueDescTable(IdxDesc, out IsMissing));
                        else
                            NewTable = new cExtendedTable(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetWellClassesTable());

                        foreach (var item in NewTable)
                            item.ListTags = new List<object>();

                        for (int i = 0; i < cGlobalInfo.CurrentScreening.Columns; i++)
                            for (int j = 0; j < cGlobalInfo.CurrentScreening.Rows; j++)
                            {
                                cWell currentWell = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetWell(i, cGlobalInfo.CurrentScreening.Rows - j - 1, true);
                                NewTable[i].ListTags.Add(currentWell);
                            }

                        for (int IdxCol = 0; IdxCol < NewTable.Count; IdxCol++)
                            NewTable[IdxCol].Name = "Column " + (IdxCol + 1);

                        List<string> ListRow = new List<string>();
                        for (int IdxRow = 0; IdxRow < NewTable[0].Count; IdxRow++)
                            ListRow.Add("Row " + (NewTable[0].Count - IdxRow));

                        NewTable.ListRowNames = ListRow;
                        if (!checkBoxDisplayClasses.Checked)
                            NewTable.Name = cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].GetName() + " (" + ListWellsToProcess.Count + " wells)";
                        else
                            NewTable.Name = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName() + " - Well Associated Classes (" + ListWellsToProcess.Count + " wells)";

                        cViewerHeatMap VHM = new cViewerHeatMap();
                        VHM.SetInputData(NewTable);
                        VHM.GlobalInfo = GlobalInfo;
                        VHM.IsDisplayValues = false;
                        if (!checkBoxDisplayClasses.Checked)
                            VHM.Title = cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].GetName() + " (" + ListWellsToProcess.Count + " wells)";
                        else
                        {
                            //VHM.ChartToBeIncluded
                            VHM.CurrentLUT = cGlobalInfo.ListWellClasses.BuildLUT();
                            VHM.IsAutomatedMinMax = false;
                            VHM.Min = 0;
                            VHM.Max = cGlobalInfo.ListWellClasses.Count - 1;
                            VHM.IsWellClassLegend = true;
                            VHM.Title = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName() + " - Well Associated Classes (" + ListWellsToProcess.Count + " wells)";
                        }
                        VHM.Run();

                        DT.SetInputData(VHM.GetOutPut());

                        if (checkBoxDisplayClasses.Checked) break;

                    }

                    DT.Run();

                    cDisplayToWindow DWForPlate = new cDisplayToWindow();
                    DWForPlate.SetInputData(DT.GetOutPut());
                    DWForPlate.Run();
                    DWForPlate.Display();
                    return;
                }
                #endregion
                #region Display column or row graphs
                else if ((PosX == 0) && (PosY > 0))
                {
                    cExL.ListTags = new List<object>();
                    for (int col = 0; col < cGlobalInfo.CurrentScreening.Columns; col++)
                    {
                        cPlate CurrentPlateToProcess = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                        cWell TmpWell = CurrentPlateToProcess.GetWell(col, PosY - 1, OnlyOnSelected);
                        if (TmpWell == null) continue;
                        cExL.ListTags.Add(TmpWell);
                        cExL.Add(TmpWell.ListSignatures[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetValue());
                        Names.Add("Column " + col);
                    }
                    CurrentName = "Row " + PosY;
                }
                else if ((PosY == 0) && (PosX > 0))
                {
                    cExL.ListTags = new List<object>();
                    for (int row = 0; row < cGlobalInfo.CurrentScreening.Rows; row++)
                    {
                        cPlate CurrentPlateToProcess = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                        cWell TmpWell = CurrentPlateToProcess.GetWell(PosX - 1, row, OnlyOnSelected);
                        if (TmpWell == null) continue;
                        cExL.ListTags.Add(TmpWell);

                        cExL.Add(TmpWell.ListSignatures[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetValue());
                        Names.Add("Row " + row);
                    }
                    CurrentName = "Column " + PosX;
                }
                #endregion
                else
                {
                    ContextMenuStrip NewMenu = new ContextMenuStrip();
                    NewMenu.Items.Add(cGlobalInfo.CurrentScreening.GetExtendedContextMenu());
                    NewMenu.Items.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetExtendedContextMenu());
                    NewMenu.Show(Control.MousePosition);
                    return;
                }

                cExtendedTable cExT = new cExtendedTable(cExL);
                cExT.ListRowNames = Names;

                cExT.Name = CurrentName;
                cExT[0].Name = CurrentName;

                cViewerGraph1D CV = new cViewerGraph1D();
                CV.Chart.IsSelectable = true;
                CV.Chart.LabelAxisX = "Well Index";
                CV.Chart.LabelAxisY = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                //V1D.Chart.BackgroundColor = Color.LightYellow;
                CV.Chart.IsXGrid = true;
                CV.Chart.IsLine = true;
                CV.SetInputData(cExT);

                cFeedBackMessage Mess = CV.Run();
                if (!Mess.IsSucceed)
                {
                    MessageBox.Show(Mess.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                //cViewerGraph CV = new cViewerGraph();
                //CV.SetInputData(cExT);
                //CV.Run();

                cDesignerSinglePanel CD = new cDesignerSinglePanel();
                CD.SetInputData(CV.GetOutPut());
                CD.Run();

                cDisplayToWindow DW = new cDisplayToWindow();
                DW.SetInputData(CD.GetOutPut());
                DW.Run();
                DW.Display();
                // CV.Display();
            }
        }
Beispiel #15
0
        private void stackedHistogramsToolStripMenuItem_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;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cDisplayToWindow CDW1 = new cDisplayToWindow();

            if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeEntireScreeningToolStripMenuItem.Checked))
            {
                cListWells ListWellsToProcess = new cListWells(null);
                List<cPlate> PlateList = new List<cPlate>();

                if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                    PlateList.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
                else
                {
                    foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) PlateList.Add(TmpPlate);
                }

                foreach (cPlate TmpPlate in PlateList)
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);


                if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                    CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram (" + PlateList[0].GetName() + ")";
                else
                    CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram - " + PlateList.Count + " plates";

                cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                NewTable.Name = CDW1.Title;

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(NewTable);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                CV1.Run();

                CDW1.SetInputData(CV1.GetOutPut());
            }
            else if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab CDT = new cDesignerTab();
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                    cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                    NewTable.Name = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - " + TmpPlate.GetName();


                    cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                    CV1.SetInputData(NewTable);
                    CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    CV1.Title = TmpPlate.GetName();
                    CV1.Run();

                    CDT.SetInputData(CV1.GetOutPut());
                }
                CDT.Run();
                CDW1.SetInputData(CDT.GetOutPut());
                CDW1.Title = "Stacked Histogram - " + cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";
            }

            CDW1.Run();
            CDW1.Display();
        }
Beispiel #16
0
        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();
        }
Beispiel #17
0
        private void testLinearRegressionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cListWells ListWellsToProcess = new cListWells(null);

            foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

            cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

            cLinearRegression LR = new cLinearRegression();
            LR.SetInputData(NewTable);
            LR.Run();



            cViewerTable VT = new cViewerTable();
            VT.SetInputData(LR.GetOutPut());
            VT.Run();


            cDisplayToWindow vD = new cDisplayToWindow();
            vD.SetInputData(VT.GetOutPut());
            vD.Title = "Linear regression (Test)";
            vD.Run();
            vD.Display();

        }
Beispiel #18
0
        private void testBoxPlotToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            cPlate TmpPlate = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
            cListWells ListWellsToProcess = new cListWells(null);
            // cExtendedList ListClasses = new cExtendedList();
            // ListClasses.Name = "Classes";
            foreach (cWell item in TmpPlate.ListActiveWells)
            {
                if (item.GetCurrentClassIdx() != -1)
                {
                    if (ListClassSelected[item.GetCurrentClassIdx()] == 1)
                    {
                        ListWellsToProcess.Add(item);
                        // ListClasses.Add(item.GetClassIdx());
                    }
                }
            }

            cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);
            // NewTable.Add(ListClasses);


            cViewerBoxPlot CV = new cViewerBoxPlot();
            CV.SetInputData(NewTable);
            CV.Run();

            //cDesignerSinglePanel CDP = new cDesignerSinglePanel();
            //CDP.SetInputData(CV.GetOutPut());
            //CDP.Run();

            cDisplayToWindow CDW = new cDisplayToWindow();
            CDW.SetInputData(CV.GetOutPut());
            CDW.Title = CV.Title;
            CDW.Run();
            CDW.Display();

        }
Beispiel #19
0
        private void lDAToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 2)
            {
                MessageBox.Show("At least two classes have to be selected to perfom a LDA.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cDisplayToWindow vD = new cDisplayToWindow();

            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                cPlate TmpPlate = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                cListWells ListWellsToProcess = new cListWells(null);
                cExtendedList ListClasses = new cExtendedList();
                ListClasses.Name = "Classes";
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1))
                    {
                        ListWellsToProcess.Add(item);
                        ListClasses.Add(item.GetCurrentClassIdx());
                    }

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);
                NewTable.Add(ListClasses);

                cProjectorLDA LDA = new cProjectorLDA();
                LDA.SetInputData(NewTable);
                cFeedBackMessage FM = LDA.Run();
                if (!FM.IsSucceed)
                {
                    MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                cViewerTable VHM = new cViewerTable();
                cExtendedTable CT = LDA.GetOutPut();

                foreach (var item in CT)
                {
                    cDescriptorsLinearCombination DLC = new cDescriptorsLinearCombination(item);
                    foreach (cDescriptorType Desc in item.ListTags)
                        DLC.Add(Desc);
                    item.Tag = DLC;
                }
                VHM.SetInputData(CT);
                VHM.Run();

                vD.SetInputData(VHM.GetOutPut());
                vD.Title = "LDA - " + TmpPlate.GetName() + " : " + ListWellsToProcess.Count + " wells";
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                cListWells ListWellsToProcess = new cListWells(null);
                cExtendedList ListClasses = new cExtendedList();
                ListClasses.Name = "Classes";

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[item.GetCurrentClassIdx()] == 1)
                            {
                                ListWellsToProcess.Add(item);
                                ListClasses.Add(item.GetCurrentClassIdx());
                            }
                        }
                    }
                }

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);
                NewTable.Add(ListClasses);
                cProjectorLDA LDA = new cProjectorLDA();
                LDA.SetInputData(NewTable);
                cFeedBackMessage FM = LDA.Run();
                if (!FM.IsSucceed)
                {
                    MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                cExtendedTable CT = LDA.GetOutPut();

                foreach (var item in CT)
                {
                    cDescriptorsLinearCombination DLC = new cDescriptorsLinearCombination(item);

                    foreach (cDescriptorType Desc in item.ListTags)
                        DLC.Add(Desc);

                    item.Tag = DLC;
                }

                cViewerTable VHM = new cViewerTable();
                VHM.SetInputData(CT);

                VHM.Run();

                vD.SetInputData(VHM.GetOutPut());
                vD.Title = "LDA - " + ListWellsToProcess.Count + " wells.";
            }
            else if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab CDT = new cDesignerTab();

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    cExtendedList ListClasses = new cExtendedList();
                    ListClasses.Name = "Classes";


                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[item.GetCurrentClassIdx()] == 1)
                            {
                                ListWellsToProcess.Add(item);
                                ListClasses.Add(item.GetCurrentClassIdx());
                            }
                        }
                    }

                    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);
                    NewTable.Add(ListClasses);
                    NewTable.Name = TmpPlate.GetName();

                    cProjectorLDA LDA = new cProjectorLDA();
                    LDA.SetInputData(NewTable);
                    cFeedBackMessage FM = LDA.Run();
                    if (!FM.IsSucceed)
                    {
                        MessageBox.Show(FM.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    cExtendedTable CT = LDA.GetOutPut();

                    foreach (var item in CT)
                    {
                        cDescriptorsLinearCombination DLC = new cDescriptorsLinearCombination(item);

                        foreach (cDescriptorType Desc in item.ListTags)
                            DLC.Add(Desc);

                        item.Tag = DLC;
                    }

                    cViewerTable VHM = new cViewerTable();
                    VHM.SetInputData(CT);
                    VHM.Run();
                    CDT.SetInputData(VHM.GetOutPut());
                }
                CDT.Run();
                vD.SetInputData(CDT.GetOutPut());
            }
            else
                return;

            vD.Run();
            vD.Display();
        }
Beispiel #20
0
        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
            }
        }
Beispiel #21
0
        private void statisticsToolStripMenuItem1_Click_1(object sender, EventArgs e)
        {
            string NameFunction = "";

            if (_StatCVItem.Checked)
                NameFunction = "Coeff. of Variation";
            else if (_StatMeanItem.Checked)
                NameFunction = "Mean";
            else if (_StatSumItem.Checked)
                NameFunction = "Sum";
            else if (_StatJarqueBeraItem.Checked)
                NameFunction = "Jarque-Bera";

            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();

            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedTable ListClassSelected = new cExtendedTable(GUI_ListClasses.GetOutPut());// GetOutPut();


            int IdxClass = -1;
            for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++)
            {
                if (ListClassSelected[0][IdxC] == 1) IdxClass = IdxC;
            }

            #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)
                {
                    cListWells ListWellsToProcess1 = new cListWells(null);

                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1)
                                ListWellsToProcess1.Add(item);
                        }
                    }

                    cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, true);

                    if ((NewTable1.Count == 0) || (NewTable1[0].Count < 3))
                    {
                        if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                        {
                            MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        else
                            continue;
                    }

                    cExtendedList ListValues = new cExtendedList();
                    List<cDescriptorType> ListDescs = 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 TableForValues = new cExtendedTable();

                        TableForValues.Add(NewTable1[RealIdx]);

                        RealIdx++;

                        if (_StatJarqueBeraItem.Checked)
                        {
                            cNormalityJarqueBera JB = new cNormalityJarqueBera();
                            JB.SetInputData(TableForValues);
                            JB.Run();
                            ListValues.Add(JB.GetOutPut()[0][0]);
                        }
                        else
                        {
                            cStatistics CS = new cStatistics();
                            CS.UnselectAll();

                            if (_StatCVItem.Checked)
                                CS.IsCV = true;
                            else if (_StatMeanItem.Checked)
                                CS.IsMean = true;
                            else if (_StatSumItem.Checked)
                                CS.IsSum = true;

                            CS.SetInputData(TableForValues);
                            CS.Run();
                            ListValues.Add(CS.GetOutPut()[0][0]);
                        }

                        ListDescs.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IDxDesc]);

                    }

                    cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListValues));
                    ET[0].ListTags = new List<object>();
                    ET[0].ListTags.AddRange(ListDescs);
                    ET.Name = TmpPlate.GetName() + "\n" + NameFunction + " - " + cGlobalInfo.ListWellClasses[IdxClass].Name + " (" + NewTable1[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 = NameFunction;
                    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.Title = TmpPlate.GetName();
                    VG1.Run();

                    DT.SetInputData(VG1.GetOutPut());
                }
                DT.Run();

                cDisplayToWindow CDW = new cDisplayToWindow();
                CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut());


                if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                    CDW.Title = NameFunction + " - " + ListPlatesToProcess[0].GetName();
                else
                    CDW.Title = NameFunction + " - " + 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);

                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1)
                                ListWellsToProcess1.Add(item);
                        }
                    }


                    cExtendedTable NewTable1 = new cExtendedTable(ListWellsToProcess1, cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorIndex(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor()));


                    if ((NewTable1.Count == 0) || (NewTable1[0].Count < 3))
                    {
                        if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                        {
                            MessageBox.Show("Insufficient number of control wells", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                        else
                            continue;
                    }


                    if (_StatJarqueBeraItem.Checked)
                    {
                        cNormalityJarqueBera JB = new cNormalityJarqueBera();
                        JB.SetInputData(NewTable1);
                        JB.Run();
                        ListZ.Add(JB.GetOutPut()[0][0]);
                    }
                    else
                    {
                        cStatistics CS = new cStatistics();
                        CS.UnselectAll();

                        if (_StatCVItem.Checked)
                            CS.IsCV = true;
                        else if (_StatMeanItem.Checked)
                            CS.IsMean = true;
                        else if (_StatSumItem.Checked)
                            CS.IsSum = true;

                        CS.SetInputData(NewTable1);
                        CS.Run();
                        ListZ.Add(CS.GetOutPut()[0][0]);
                    }
                    ListPlatesForZFactor.Add(TmpPlate);
                }
            #endregion

                cExtendedTable ET = new cExtendedTable(new cExtendedTable(ListZ));
                ET[0].ListTags = new List<object>();
                ET[0].ListTags.AddRange(ListPlatesForZFactor);
                ET.Name = NameFunction + " - " + 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 = NameFunction;
                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 = NameFunction + " - " + ListPlatesToProcess.Count + " plates";
                CDW.Run();
                CDW.Display();
            }
        }
Beispiel #22
0
        private void normalProbabilityPlotToolStripMenuItem2_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 = new cExtendedTable(GUI_ListClasses.GetOutPut());// GetOutPut();

            int IdxClass = -1;
            for (int IdxC = 0; IdxC < ListClassSelected[0].Count; IdxC++)
            {
                if (ListClassSelected[0][IdxC] == 1) IdxClass = IdxC;
            }

            #region single plate and plate by plate
            cDescriptorType CurrentDesc = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor();
            cDesignerTab DT = new cDesignerTab();
            if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeplateByPlateToolStripMenuItem.Checked)/*||(ProcessModeEntireScreeningToolStripMenuItem.Checked)*/)
            {
                List<cPlate> ListPlatesToProcess = new List<cPlate>();
                if ((ProcessModeplateByPlateToolStripMenuItem.Checked))
                {
                    foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                        ListPlatesToProcess.Add(TmpPlate);
                }
                else
                    ListPlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());

                foreach (cPlate TmpPlate in ListPlatesToProcess)
                {
                    cListWells ListWellsToProcess1 = new cListWells(null);
                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1)
                                ListWellsToProcess1.Add(item);
                        }
                    }

                    cComputeAndDisplayNormalPlot CADP = new cComputeAndDisplayNormalPlot();
                    CADP.SetInputData(ListWellsToProcess1);
                    CADP.Run();
                    cExtendedControl ControlForTab = CADP.GetOutPut();

                    ControlForTab.Title = TmpPlate.GetName();

                    DT.SetInputData(ControlForTab);
                }
                DT.Run();

                cDisplayToWindow CDW = new cDisplayToWindow();
                CDW.SetInputData(DT.GetOutPut());//VG1.GetOutPut());


                if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                    CDW.Title = "Normal Probability Plot - " + CurrentDesc.GetName() + " - " + ListPlatesToProcess[0].GetName();
                else
                    CDW.Title = "Normal Probability Plot - " + CurrentDesc.GetName() + " - " + 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);

                cListWells ListWellsToProcess1 = new cListWells(null);

                foreach (cPlate TmpPlate in ListPlatesToProcess)
                {

                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1)
                                ListWellsToProcess1.Add(item);
                        }
                    }
                }

                cComputeAndDisplayNormalPlot CADP = new cComputeAndDisplayNormalPlot();
                CADP.SetInputData(ListWellsToProcess1);
                CADP.Run();

                cExtendedControl ControlForTab = CADP.GetOutPut();

                cDisplayToWindow CDW = new cDisplayToWindow();
                CDW.SetInputData(ControlForTab);//VG1.GetOutPut());

                CDW.Title = "Normal Probability Plot - " + CurrentDesc.GetName() + " - " + ListPlatesToProcess.Count + " plates";

                CDW.Run();
                CDW.Display();
            }


            //  ComputeAndDisplayMormalProbabilityPlot(false);
        }
Beispiel #23
0
        private void mannWithneyTestToolStripMenuItem_Click(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 = "Mann-Withney (both tails)";


            #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)
                {
                    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 < 5) || (NewTable2.Count == 0) || (NewTable2[0].Count < 5))
                    {
                        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++;

                        cMannWithneyTest ZF = new cMannWithneyTest();
                        ZF.SetInputData(TableForZ);
                        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.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());

                    cSort S1 = new cSort();
                    S1.SetInputData(ET);
                    S1.ColumnIndexForSorting = 0;
                    S1.IsAscending = false;
                    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 < 5) || (NewTable2.Count == 0) || (NewTable2[0].Count < 5))
                    {
                        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]);

                    cMannWithneyTest ZF = new cMannWithneyTest();
                    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;


                Classes.Base_Classes.General.cLineHorizontalForGraph VLZ05 = new Classes.Base_Classes.General.cLineHorizontalForGraph(.05);
                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
            }
        }
Beispiel #24
0
        private void aToolStripMenuItem_Click_1(object sender, EventArgs e)
        {


            //if (CompleteScreening.ListDescriptors.GetListNameActives().Count <= 1)
            //{
            //    MessageBox.Show("MINE Analysis requires at least two activated descriptors\n", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}

            //bool IsFullScreen = false;
            //List<double>[] ListValueDesc = ExtractDesciptorAverageValuesList(IsFullScreen);

            //DisplayMINE(ListValueDesc);

            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab DT = new cDesignerTab();

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() != -1)
                        {
                            if (ListClassSelected[item.GetCurrentClassIdx()] == 1)
                                ListWellsToProcess.Add(item);
                        }
                    }

                    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                    cMineAnalysis MA = new cMineAnalysis();
                    MA.SetInputData(NewTable);
                    MA.Is_BriefReport = true;
                    MA.CurrentScreening = cGlobalInfo.CurrentScreening;
                    MA.Run();

                    cDesignerTab SubDT = new cDesignerTab();
                    foreach (var item in MA.GetOutPut())
                    {
                        cViewerTable SubTable = new cViewerTable();

                        SubTable.Title = "MINE - " + item.Name;
                        SubTable.SetInputData(item);
                        SubTable.Run();

                        SubDT.SetInputData(SubTable.GetOutPut());
                    }
                    SubDT.Title = TmpPlate.GetName();
                    SubDT.Run();
                    DT.SetInputData(SubDT.GetOutPut());
                }

                DT.Run();
                cDisplayToWindow TmpvD = new cDisplayToWindow();

                TmpvD.SetInputData(DT.GetOutPut());
                TmpvD.Title = "MINE analysis - " + cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";
                TmpvD.Run();
                TmpvD.Display();
            }
            else if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                cPlate TmpPlate = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();

                cListWells ListWellsToProcess = new cListWells(null);
                foreach (cWell item in TmpPlate.ListActiveWells)
                {
                    if (item.GetCurrentClassIdx() != -1)
                    {
                        if (ListClassSelected[item.GetCurrentClassIdx()] == 1)
                            ListWellsToProcess.Add(item);
                    }
                }

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                cMineAnalysis MA = new cMineAnalysis();
                MA.SetInputData(NewTable);
                MA.Is_BriefReport = true;
                MA.CurrentScreening = cGlobalInfo.CurrentScreening;
                MA.Run();

                cDesignerTab SubDT = new cDesignerTab();
                foreach (var item in MA.GetOutPut())
                {
                    cViewerTable SubTable = new cViewerTable();

                    SubTable.Title = "MINE - " + item.Name;
                    SubTable.SetInputData(item);
                    SubTable.Run();

                    SubDT.SetInputData(SubTable.GetOutPut());
                }
                SubDT.Title = TmpPlate.GetName();
                SubDT.Run();

                cDisplayToWindow TmpvD = new cDisplayToWindow();

                TmpvD.SetInputData(SubDT.GetOutPut());
                TmpvD.Title = "MINE analysis - " + TmpPlate.GetName() + " : " + ListWellsToProcess.Count + " wells";
                TmpvD.Run();
                TmpvD.Display();
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if (item.GetCurrentClassIdx() != -1)
                            if (ListClassSelected[item.GetCurrentClassIdx()] == 1) ListWellsToProcess.Add(item);

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                cMineAnalysis MA = new cMineAnalysis();
                MA.SetInputData(NewTable);
                MA.Is_BriefReport = true;
                MA.CurrentScreening = cGlobalInfo.CurrentScreening;
                MA.Run();

                cDesignerTab SubDT = new cDesignerTab();
                foreach (var item in MA.GetOutPut())
                {
                    cViewerTable SubTable = new cViewerTable();

                    SubTable.Title = "MINE - " + item.Name;
                    SubTable.SetInputData(item);
                    SubTable.Run();

                    SubDT.SetInputData(SubTable.GetOutPut());
                }
                SubDT.Run();

                cDisplayToWindow TmpvD = new cDisplayToWindow();

                TmpvD.SetInputData(SubDT.GetOutPut());
                TmpvD.Title = "MINE analysis : " + ListWellsToProcess.Count + " wells";
                TmpvD.Run();
                TmpvD.Display();
            }

        }
Beispiel #25
0
        private void mahalanobisDistanceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormForMahalanobisDistance MainWindow = new FormForMahalanobisDistance();

            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(true, eClassType.WELL);
            ClassSelectionPanel.Height = MainWindow.panelForSourceCloud.Height;
            MainWindow.panelForSourceCloud.Controls.Add(ClassSelectionPanel);

            PanelForClassSelection HitClassSelectionPanel = new PanelForClassSelection(false, eClassType.WELL);
            HitClassSelectionPanel.Height = MainWindow.panelHitClass.Height;
            HitClassSelectionPanel.ListRadioButtons[1].Checked = true;
            MainWindow.panelHitClass.Controls.Add(HitClassSelectionPanel);

            if (MainWindow.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            cExtendedList ListClassSelected = new cExtendedList();
            for (int i = 0; i < ClassSelectionPanel.ListCheckBoxes.Count; i++)
                if (ClassSelectionPanel.ListCheckBoxes[i].Checked) ListClassSelected.Add(1);
                else
                    ListClassSelected.Add(0);

            int IdxClassForOutliers = 0;
            for (int i = 0; i < HitClassSelectionPanel.ListRadioButtons.Count; i++)
                if (HitClassSelectionPanel.ListRadioButtons[i].Checked)
                {
                    IdxClassForOutliers = i;
                    break;
                }

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            // start by computing the inversed covariance matrix
            //if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1)
            //{
            //    MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}


            cCovarianceMatrix CM = new cCovarianceMatrix();
            cExtendedTable NewTable = null;

            if (this.ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                //foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive)
                //{
                //    cListWells ListWellsToProcess = new cListWells(null);
                //    foreach (cWell item in TmpPlate.ListActiveWells)
                //        if ((item.GetClassIdx() != -1) && (ListClassSelected[item.GetClassIdx()] == 1)) ListWellsToProcess.Add(item);

                //    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                //    CM.SetInputData(NewTable);
                //}
            }
            else if (this.ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                NewTable = new cExtendedTable(ListWellsToProcess, true);

                //  cTwoSampleFTest CM = new cTwoSampleFTest();
                CM.SetInputData(NewTable);
            }
            else
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                    if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                NewTable = new cExtendedTable(ListWellsToProcess, true);

                // cTwoSampleFTest CM = new cTwoSampleFTest();
                CM.SetInputData(NewTable);
            }

            CM.Run();

            cInverse cI = new cInverse();
            cI.SetInputData(CM.GetOutPut());
            cI.Run();

            // get the cloud center
            cStatistics cstat = new cStatistics();
            cstat.UnselectAll();
            cstat.IsMean = true;
            cstat.SetInputData(NewTable);
            cstat.Run();

            if (cstat.GetOutPut() == null) return;

            cExtendedList ListMeans = cstat.GetOutPut().GetRow(0);
            cDescriptorType MahalanobisType = new cDescriptorType("Mahalanobis Distance", true, 1);

            #region Compute the Threshold
            int DegreeOfFreedom = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors().Count;
            cExtendedTable T = new cExtendedTable();
            T.Add(new cExtendedList());

            T[0].Add((double)MainWindow.numericUpDownPValue.Value);

            cFunctions F = new cFunctions();
            F.SetInputData(T);
            F.IsInverse = true;
            F.DegreeOfFreedom = DegreeOfFreedom;
            F.Run();

            double ThresholdForMahalanobis = Math.Sqrt(F.GetOutPut()[1][0]);

            #endregion


            int IdxClassForNonOutliers = 1;

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesAvailable)
            {
                for (int Col = 0; Col < cGlobalInfo.CurrentScreening.Columns; Col++)
                    for (int Row = 0; Row < cGlobalInfo.CurrentScreening.Rows; Row++)
                    {
                        cWell TmpWell = TmpPlate.GetWell(Col, Row, false);
                        if (TmpWell == null) continue;

                        double ValueDistance = TmpWell.GetAverageValuesList(true)[0].Dist_Mahalanobis(ListMeans, cI.GetOutPut());
                        if (ValueDistance > ThresholdForMahalanobis || double.IsNaN(ValueDistance) )        // that's an outlier
                        {
                            TmpWell.SetClass(IdxClassForOutliers);
                        }
                        else
                        {
                            TmpWell.SetClass(IdxClassForNonOutliers);
                        }

                        if (MainWindow.checkBoxDistAsDesc.Checked)
                        {
                            cListSignature LDesc = new cListSignature();
                            cSignature NewDesc = new cSignature(ValueDistance, MahalanobisType, cGlobalInfo.CurrentScreening);
                            LDesc.Add(NewDesc);
                            TmpWell.AddSignatures(LDesc);
                        }
                    }
            }

            if (MainWindow.checkBoxDistAsDesc.Checked)
            {
                cGlobalInfo.CurrentScreening.ListDescriptors.AddNew(MahalanobisType);
            }

            cGlobalInfo.CurrentScreening.ListDescriptors.UpDateDisplay();
            cGlobalInfo.CurrentScreening.UpDatePlateListWithFullAvailablePlate();

            for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; idxP++)
                cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax();
        }
Beispiel #26
0
        private void correlationMatrixToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1)
            {
                MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1)
            {
                MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            cDesignerTab DT = new cDesignerTab();

            if (this.ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    //ListWellsToProcess.AddRange(TmpPlate.ListActiveWells);
                    cListWells ListWellsToProcess = new cListWells(null);

                    foreach (cWell item in TmpPlate.ListActiveWells)
                    {
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);
                    }

                    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                    cCorrelationMatrix CM = new cCorrelationMatrix();
                    CM.SetInputData(NewTable);
                    CM.Run();


                    cExtendedTable CorrelationMatrix = CM.GetOutPut();
                    weka.core.Instances Insts = CorrelationMatrix.CreateWekaInstances();


                    weka.clusterers.HierarchicalClusterer ClustererToReturn = new weka.clusterers.HierarchicalClusterer();
                    // string OptionDistance = " -N " + (int)Parameters.ListDoubleValues.Get("numericUpDownNumClasses").Value;

                    //string DistanceType = (string)Parameters.ListTextValues.Get("comboBoxDistance").Value;
                    //OptionDistance += " -A \"weka.core.";
                    //switch (DistanceType)
                    //{
                    //    case "Euclidean":
                    //        OptionDistance += "EuclideanDistance";
                    //        break;
                    //    case "Manhattan":
                    //        OptionDistance += "ManhattanDistance";
                    //        break;
                    //    case "Chebyshev":
                    //        OptionDistance += "ChebyshevDistance";
                    //        break;
                    //    default:
                    //        break;
                    //}

                    //if (!(bool)Parameters.ListCheckValues.Get("checkBoxNormalize").Value)
                    //    OptionDistance += " -D";
                    //OptionDistance += " -R ";


                    //OptionDistance += "first-last\"";
                    //string WekaOption = "-L " + (string)Parameters.ListTextValues.Get("comboBoxLinkType").Value + OptionDistance;
                    ((weka.clusterers.HierarchicalClusterer)ClustererToReturn).setOptions(weka.core.Utils.splitOptions("-N 1 -L SINGLE -P -A \"weka.core.EuclideanDistance -R first-last\" "));

                    ClustererToReturn.buildClusterer(Insts);
                    //this.NumberOfClusters = ClustererToReturn.numberOfClusters();
                    cInfoForHierarchical IFH = new cInfoForHierarchical();
                    IFH.ListInstances = Insts;

                    cDendoGram DENDO = new cDendoGram(((weka.clusterers.HierarchicalClusterer)ClustererToReturn), IFH, GlobalInfo);



                    //cViewerHeatMap VHM = new cViewerHeatMap();
                    cViewerTable VHM = new cViewerTable();
                    VHM.SetInputData(CM.GetOutPut());
                    //VHM.IsDisplayValues = true;
                    VHM.Title = "Correlation - " + TmpPlate.GetName() + " (" + ListWellsToProcess.Count + " wells)";
                    VHM.Run();
                    VHM.GetOutPut().Title = TmpPlate.GetName();
                    DT.SetInputData(VHM.GetOutPut());
                }
            }
            else if (this.ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);
                }

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                cCorrelationMatrix CM = new cCorrelationMatrix();
                CM.SetInputData(NewTable);
                CM.Run();

                //cViewerHeatMap VHM = new cViewerHeatMap();
                cViewerTable VHM = new cViewerTable();
                VHM.SetInputData(CM.GetOutPut());
                //VHM.IsDisplayValues = true;
                VHM.Title = "Correlation - Entire screening (" + ListWellsToProcess.Count + " wells)";
                VHM.Run();

                DT.SetInputData(VHM.GetOutPut());
            }
            else
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                    if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                cCorrelationMatrix CM = new cCorrelationMatrix();
                CM.SetInputData(NewTable);
                CM.Run();

                //cViewerHeatMap VHM = new cViewerHeatMap();
                cViewerTable VHM = new cViewerTable();
                VHM.SetInputData(CM.GetOutPut());
                //VHM.IsDisplayValues = true;
                VHM.Title = "Correlation - " + cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName() + " (" + ListWellsToProcess.Count + " wells)";
                VHM.Run();

                DT.SetInputData(VHM.GetOutPut());
            }

            DT.Run();

            //  DT.SetInputData(VT.GetOutPut());

            //cDesignerColumn DC = new cDesignerColumn();  
            //DC.SetInputData(VHM.GetOutPut());
            //DC.SetInputData(VT.GetOutPut());
            //DC.Run();

            //cDisplayDesigner DD = new cDisplayDesigner();
            // DD.SetInputData(VHM.GetOutPut());
            // DD.Run();

            cDisplayToWindow vD = new cDisplayToWindow();
            vD.SetInputData(DT.GetOutPut());
            vD.Title = "Pearson Correlation";
            vD.Run();
            vD.Display();

            //ComputeAndDisplayCorrelationMatrix(false, true, null);
        }
Beispiel #27
0
        private void dToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cFeedBackMessage MessageReturned;

            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            List<cWellClassType> ListWellClassesSelected = new List<cWellClassType>();
            foreach (var item in ListClassSelected.ListTags)
            {
                ListWellClassesSelected.Add((cWellClassType)(item));
            }

            cViewerGraph1D V1D = new cViewerGraph1D();
            V1D.Chart.IsSelectable = true;
            V1D.Chart.LabelAxisX = "Well Index";
            V1D.Chart.LabelAxisY = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();

            V1D.Chart.IsXGrid = true;



            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                cExtendedTable DataFromPlate = new cExtendedTable(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells,
                                                cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx, ListClassSelected);

                DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName();

                V1D.Chart.IsShadow = true;
                V1D.Chart.IsBorder = true;
                //V1D.Chart.IsSelectable = true;
                V1D.Chart.CurrentTitle.Tag = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                V1D.SetInputData(DataFromPlate);
                V1D.Run();

                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                DS.SetInputData(V1D.GetOutPut());

                cExtendedTable NewTable = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells.Filter(ListWellClassesSelected).GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                NewTable.Name = "Histogram";

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(NewTable);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                CV1.Run();
                DS.SetInputData(CV1.GetOutPut());
                DS.Run();


                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(DS.GetOutPut());
                Disp0.Title = "Scatter points graph - " + DataFromPlate[0].Count + " wells.";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                V1D.Chart.MarkerSize = 5;
                V1D.Chart.IsBorder = false;
                V1D.Chart.IsShadow = false;

                cListWells ListWell = new cListWells(null);
                int IdxWellForPlateSeparator = 0;
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell TmpWell in TmpPlate.ListActiveWells)
                    {
                        int ClassTmp = TmpWell.GetCurrentClassIdx();
                        if ((ClassTmp == -1) || (GUI_ListClasses.GetOutPut()[0][TmpWell.GetCurrentClassIdx()] == 0)) continue;
                        ListWell.Add(TmpWell);
                        IdxWellForPlateSeparator++;
                    }


                    if (cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDisplayPlatesVerticalLines.Checked)
                    {
                        Classes.Base_Classes.General.cLineVerticalForGraph VL = new Classes.Base_Classes.General.cLineVerticalForGraph(IdxWellForPlateSeparator + 0.5);
                        VL.IsAllowMoving = false;
                        V1D.Chart.ListVerticalLines.Add(VL);
                    }

                }
                cExtendedTable DataFromPlate = new cExtendedTable(ListWell,
                                                cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx, ListClassSelected);

                DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetName() + " - " + cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";

                int MaxNumberOfPts = (int)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownMinNumPointForFastDisp.Value;
                if (ListWell.Count > MaxNumberOfPts)
                {
                    cGlobalInfo.WindowHCSAnalyzer.richTextBoxConsole.AppendText("\n" + V1D.Title + ": Number of Wells is Higher than " + MaxNumberOfPts + " => Switching to FastPoints Mode.\n");
                    V1D.Chart.ISFastPoint = true;
                }

                V1D.SetInputData(DataFromPlate);
                V1D.Run();

                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                DS.SetInputData(V1D.GetOutPut());

                cExtendedTable NewTable = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                NewTable.Name = "Histogram";

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(NewTable);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                CV1.Run();
                DS.SetInputData(CV1.GetOutPut());
                DS.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(DS.GetOutPut());
                Disp0.Title = "Scatter points graph - " + DataFromPlate[0].Count + " wells.";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();

            }
            else if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab CDT = new cDesignerTab();

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cExtendedTable DataFromPlate = new cExtendedTable(TmpPlate.ListActiveWells,
                                                cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx, ListClassSelected);

                    DataFromPlate.Name = TmpPlate.GetName();

                    V1D = new cViewerGraph1D();
                    V1D.Chart.IsSelectable = true;
                    V1D.Chart.LabelAxisX = "Well Index";
                    V1D.Chart.LabelAxisY = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    V1D.Chart.IsXGrid = true;
                    V1D.Chart.CurrentTitle.Tag = TmpPlate;
                    V1D.SetInputData(DataFromPlate);
                    V1D.Title = TmpPlate.GetName();
                    V1D.Run();

                    cDesignerSplitter DS = new cDesignerSplitter();
                    DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                    DS.SetInputData(V1D.GetOutPut());

                    cExtendedTable NewTable = TmpPlate.ListActiveWells.Filter(ListWellClassesSelected).GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                    NewTable.Name = "Histogram";

                    cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                    CV1.SetInputData(NewTable);
                    CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    CV1.Run();

                    DS.Title = TmpPlate.GetName();
                    DS.SetInputData(CV1.GetOutPut());
                    DS.Run();

                    CDT.SetInputData(DS.GetOutPut());
                }

                CDT.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(CDT.GetOutPut());
                Disp0.Title = "Scatter points graphs";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();
            }

        }
Beispiel #28
0
        private void ftestdescBasedToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1)
            {
                MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cDesignerTab DT = new cDesignerTab();

            cTwoSampleFTest CM = new cTwoSampleFTest();
            CM.FTestTails = eFTestTails.BOTH;

            if (this.ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

                    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);


                    CM.SetInputData(NewTable);
                    CM.Run();

                    cViewerHeatMap VHM = new cViewerHeatMap();
                    VHM.SetInputData(CM.GetOutPut());
                    VHM.IsDisplayValues = true;
                    VHM.Title = "F-Test - " + TmpPlate.GetName() + " (" + ListWellsToProcess.Count + " wells)";
                    VHM.Run();

                    DT.SetInputData(VHM.GetOutPut());
                }
            }
            else if (this.ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);
                }

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                //  cTwoSampleFTest CM = new cTwoSampleFTest();
                CM.SetInputData(NewTable);
                CM.Run();

                cViewerHeatMap VHM = new cViewerHeatMap();
                VHM.SetInputData(CM.GetOutPut());
                VHM.IsDisplayValues = true;
                VHM.Title = "F-Test - Entire screening (" + ListWellsToProcess.Count + " wells)";
                VHM.Run();

                DT.SetInputData(VHM.GetOutPut());
            }
            else
            {
                cListWells ListWellsToProcess = new cListWells(null);

                foreach (cWell item in cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells)
                    if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

                // cTwoSampleFTest CM = new cTwoSampleFTest();
                CM.SetInputData(NewTable);
                CM.Run();

                cViewerHeatMap VHM = new cViewerHeatMap();
                VHM.SetInputData(CM.GetOutPut());
                VHM.IsDisplayValues = true;
                VHM.Title = "F-Test - " + cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName() + " (" + ListWellsToProcess.Count + " wells)";
                VHM.Run();

                DT.SetInputData(VHM.GetOutPut());
            }

            DT.Run();
            cDisplayToWindow vD = new cDisplayToWindow();
            vD.SetInputData(DT.GetOutPut());
            vD.Title = "F-Test";
            vD.Run();
            vD.Display();
        }
Beispiel #29
0
 public void SetInputData(cListWells Input)
 {
     this.Input = Input;
 }
Beispiel #30
0
        private void ToolStripMenuItem_DisplayHistograms(object sender, EventArgs e)
        {
            if (GlobalInfo == null) return;
            for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++)
            {
                if (cGlobalInfo.ListWellClasses[i].Name == this.Name)
                {
                    Idx = i;
                    break;
                }
            }

            if (Idx == -1) return;

            if ((cGlobalInfo.CurrentScreening.ListDescriptors == null) || (cGlobalInfo.CurrentScreening.ListDescriptors.Count == 0)) return;

            cDisplayToWindow CDW1 = new cDisplayToWindow();

            cListWells ListWellsToProcess = new cListWells(null);
            List<cPlate> PlateList = new List<cPlate>();
            cDesignerSplitter DS = new cDesignerSplitter();

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) PlateList.Add(TmpPlate);

            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() == base.Idx) ListWellsToProcess.Add(item);

            cExtendedTable NewTable2 = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable2.Name = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Histogram - " + PlateList.Count + " plates";

            cViewerStackedHistogram CV2 = new cViewerStackedHistogram();
            CV2.SetInputData(NewTable2);
            CV2.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV2.Chart.IsBorder = false;
            CV2.Chart.Width = 0;
            CV2.Chart.Height = 0;

            //StripLine AverageLine = new StripLine();
            //AverageLine.BackColor = Color.Red;
            //AverageLine.IntervalOffset = GlobalInfo.CurrentScreen.ListDescriptors[Parent.ListDescriptors.CurrentSelectedDescriptor].GetValue();
            //AverageLine.StripWidth = 0.0001;
            //AverageLine.Text = this.ListDescriptors[Parent.ListDescriptors.CurrentSelectedDescriptor].GetValue().ToString("N2");

            CV2.Run();

            //CV2.Chart.ChartAreas[0].AxisX.StripLines.Add(AverageLine);

            DS.SetInputData(CV2.GetOutPut());

            PlateList.Clear();
            PlateList.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            ListWellsToProcess.Clear();
            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() == Idx) ListWellsToProcess.Add(item);

            CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Histogram (" + PlateList[0].GetName() + ")";

            cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable.Name = CDW1.Title;

            cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
            CV1.SetInputData(NewTable);
            CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV1.Chart.Width = 0;
            CV1.Chart.Height = 0;

            //  CV1.Chart.ChartAreas[0].AxisX.Minimum = CV2.Chart.ChartAreas[0].AxisX.Minimum;
            //  CV1.Chart.ChartAreas[0].AxisX.Maximum = CV2.Chart.ChartAreas[0].AxisX.Maximum;
            CV1.Run();

            // CV1.Chart.ChartAreas[0].AxisX.StripLines.Add(AverageLine);
            DS.SetInputData(CV1.GetOutPut());
            DS.Run();

            CDW1.SetInputData(DS.GetOutPut());
            CDW1.Run();
            CDW1.Display();

            return;
        }