Exemplo n.º 1
0
        private cFeedBackMessage Process()
        {
            cExtendedTable TmpTable = new cExtendedTable(this.Input[this.IdxColumnToProcess]);

            cSort S = new cSort();
            S.SetInputData(TmpTable);
            base.FeedBackMessage = S.Run();
            if (base.FeedBackMessage.IsSucceed == false) return base.FeedBackMessage;

            cNormalize N = new cNormalize();
            N.NormalizationType = eNormalizationType.STANDARDIZE;
            N.SetInputData(S.GetOutPut());
            base.FeedBackMessage = N.Run();
            if (base.FeedBackMessage.IsSucceed == false) return base.FeedBackMessage;

            int Num = N.GetOutPut()[0].Count;
            double[] CumulativeProba = new double[Num];
            for (int i = 1; i < Num - 1; i++)
                CumulativeProba[i] = (i - 0.3175) / (Num + 0.365);

            CumulativeProba[Num - 1] = Math.Pow(0.5, 1.0 / Num);
            CumulativeProba[0] = 1 - CumulativeProba[Num - 1];

            double[] PercentPointFunction = new double[Num];

            for (int i = 0; i < Num; i++)
                PercentPointFunction[i] = alglib.normaldistr.invnormaldistribution(CumulativeProba[i]);

            this.Output = new cExtendedTable(new cExtendedList(PercentPointFunction));

            this.Output.Add(new cExtendedList());

            this.Output.ListTags = new List<object>();

            for (int i = 0; i < N.GetOutPut()[0].Count; i++)
            {
                this.Output[1].Add(N.GetOutPut()[0][i]);
                if(S.GetOutPut()[0].ListTags!=null)
                this.Output.ListTags.Add(S.GetOutPut()[0].ListTags[i]);
            }

            this.Output[0].Name = "";
            this.Output[1].Name = "Normalized Data";

            return base.FeedBackMessage;
        }
Exemplo n.º 2
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
            }

        }
Exemplo n.º 3
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
            }
        }
Exemplo n.º 4
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();
            }
        }
Exemplo n.º 5
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
            }
        }
Exemplo n.º 6
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();
        }
Exemplo n.º 7
0
        private void ToolStripMenuItem_CrossZFactor(object sender, EventArgs e)
        {
            cGUI_ListSingleClasse GUI_ListClasses = new cGUI_ListSingleClasse();
            GUI_ListClasses.IsCheckBoxes = true;

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


            int ClassId = 0;
            //int NumActiveDesc = 0;
            //foreach (cDescriptorType DescType in this.GlobalInfo.CurrentScreening.ListDescriptors)
            //{
            //    if (DescType.IsActive() == false) continue;
            //    NumActiveDesc++;
            //}


            cExtendedTable FinalListValues = new cExtendedTable();
            cExtendedTable TmpTable = new cExtendedTable();



            TmpTable.Add(new cExtendedList("Sorted Z'"));
            TmpTable.ListRowNames = new List<string>();
            TmpTable[0].ListTags = new List<object>();
            //   TmpTable.ListTags = new List<object>();
            for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++)
            {
                cDescriptorType CurrentDescType = cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc];
                if (CurrentDescType.IsActive() == false) continue;

                cExtendedTable ListSource = new cExtendedTable();

                // int IdxClasse =0;
                foreach (var item in cGlobalInfo.ListWellClasses)
                {
                    // if (ListClassSelected[0][IdxClasse] == 1)
                    ListSource.Add(new cExtendedList(item.Name));

                    // if (ListClassSelected[1][IdxClasse] == 1)
                    //ListDestination.Add(new cExtendedList(item.Name));

                    // IdxClasse++;
                }

                foreach (cWell TmpWell in cGlobalInfo.ListSelectedWell)
                {
                    ClassId = TmpWell.GetCurrentClassIdx();
                    if (ClassId > -1)
                    {
                        if (GUI_ListClasses.GetOutPut()[ClassId] == 1)
                            ListSource[ClassId].Add(TmpWell.GetAverageValue(CurrentDescType));

                        //if (GUI_ListClasses.GetOutPut()[1][ClassId] == 1)
                        //ListDestination[ClassId].Add(TmpWell.GetAverageValue(CurrentDescType));
                    }
                }

                int InitCount = ListSource.Count;
                for (int i = 0; i < ListSource.Count; i++)
                {
                    if (ListSource[i].Count < 2)
                    {
                        ListSource.RemoveAt(i);
                        i--;
                    }
                }

                // if (ListSource.Count == 0) return;

                cZFactor ZF = new cZFactor();
                ZF.SetInputData(ListSource);
                cFeedBackMessage FM = ZF.Run();
                richTextBoxConsole.AppendText(FM.Message);
                if (!FM.IsSucceed) return;

                cExtendedTable ListValues = ZF.GetOutPut();

                for (int i = 0; i < ListValues.Count; i++)
                {
                    for (int j = 0; j < i; j++)
                    {
                        TmpTable[0].Add(ListValues[i][j]);
                        TmpTable.ListRowNames.Add(ListValues[i].Name + " vs. " + ListValues[j].Name + " - [" + CurrentDescType.GetName() + "]");
                        TmpTable[0].ListTags.Add(CurrentDescType);
                    }
                }

            }
            cSort S = new cSort();
            S.SetInputData(TmpTable);
            S.IsAscending = false;
            S.Run();

            //cViewerTable VT1 = new cViewerTable();
            //VT1.SetInputData(ListValues);
            //VT1.Run();

            cViewerTable VT2 = new cViewerTable();
            VT2.SetInputData(S.GetOutPut());
            VT2.Run();

            //cDesignerSplitter DS = new cDesignerSplitter();
            //DS.Orientation = Orientation.Vertical;
            //DS.SetInputData(VT2.GetOutPut());
            //DS.SetInputData(VT1.GetOutPut());
            //DS.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.Title = "Cross Classes Z'";
            DTW.SetInputData(VT2.GetOutPut());
            DTW.Run();
            DTW.Display();
        }
Exemplo n.º 8
0
        void ToolStripMenuItem_DRCAnalysis_Click(object sender, EventArgs e)
        {
            List<cDescriptorType> ListSelectedDesc = new List<cDescriptorType>();// GlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors();
            ListSelectedDesc.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor());

            //if (GlobalInfo == null) GlobalInfo = cGlobalInfo.CurrentScreening.GlobalInfo;
            //if (cGlobalInfo == null) return;

            cDesignerMultiChoices DT = new cDesignerMultiChoices();

            cExtendedTable TableForGeneralResuts = new cExtendedTable();
            TableForGeneralResuts.Add(new cExtendedList("p-Value"));
            TableForGeneralResuts.Add(new cExtendedList("EC50"));
            TableForGeneralResuts.Add(new cExtendedList("Slope"));
            TableForGeneralResuts.Add(new cExtendedList("Bottom"));
            TableForGeneralResuts.Add(new cExtendedList("Top"));
            TableForGeneralResuts.Add(new cExtendedList("Window"));
            TableForGeneralResuts.Add(new cExtendedList("Area Under Curve"));

            TableForGeneralResuts.ListRowNames = new List<string>();
            TableForGeneralResuts.ListTags = new List<object>();

            cDesignerSplitter MainSplitter = new cDesignerSplitter();

            int IdxNode = 0;
            cListListWells CurrentSelectedGroups = this.BuildListListWells();

            foreach (cListWells TmpListWells in CurrentSelectedGroups)
            {
                // List<cDescriptorType> LType = new List<cDescriptorType>();
                //  LType.Add(ListSelectedDesc[i]);
                cExtendedTable CompleteTable = TmpListWells.GetAverageDescriptorValues(ListSelectedDesc, true, false);

                //cExtendedTable CompleteTable = GLP.GetOutPut();

                cCurveForGraph CFG = new cCurveForGraph();
                CFG.SetInputData(CompleteTable);
                CFG.Run();

                cSigmoidFitting SF = new cSigmoidFitting();
                SF.SetInputData(CompleteTable);
                if (SF.Run().IsSucceed == false) continue;

                // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1];

                cANOVA A = new cANOVA();

                cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1);
                A.SignificanceThreshold = 1E-11;
                A.SetInputData(NewTable);
                A.Run();

                cExtendedTable Sigmoid = SF.GetFittedRawValues(CFG.GetListXValues());
                CompleteTable[0] = Sigmoid[1];
                CompleteTable[0].Name = ListSelectedDesc[0].GetName() + "\n" + Sigmoid[1].Name;
                cDesignerSplitter DS = new cDesignerSplitter();

                //cViewerTableAsRichText VT = new cViewerTableAsRichText();
                cViewerTable VT = new cViewerTable();
                cExtendedTable TableResults = SF.GetOutPut();

                if ((A.GetOutPut() != null) && (A.GetOutPut().Count > 0))
                {
                    TableResults[0].Add(A.GetOutPut()[0][0]);
                    TableResults[0].Add(A.GetOutPut()[0][1]);
                    TableResults.ListRowNames.Add("p-Value");
                    TableResults.ListRowNames.Add("Rejected?");

                    TableForGeneralResuts[0].Add(A.GetOutPut()[0][0]);
                }
                else
                {
                    TableForGeneralResuts[0].Add(1);
                }

                TableResults.Name = TV.Nodes[IdxNode].Text;
                TableResults[0].Name = "Fitting Parameters";
                VT.SetInputData(TableResults);
                VT.DigitNumber = -1;
                VT.Run();

                cViewerGraph1D VS1 = new cViewerGraph1D();

                cExtendedTable MyTable = new cExtendedTable(Sigmoid[1]);
                MyTable.Name = TmpListWells.Name;// TV.Nodes[IdxNode].Text;
                VS1.SetInputData(MyTable);
                VS1.AddCurve(CFG);

                VS1.Chart.X_AxisValues = Sigmoid[0];
                VS1.Chart.IsLogAxis = true;
                VS1.Chart.IsLine = true;
                VS1.Chart.IsShadow = false;
                VS1.Chart.Opacity = 210;
                VS1.Chart.LineWidth = 3;
                VS1.Chart.MarkerSize = 8;
                VS1.Chart.IsDisplayValues = cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDRCDisplayValues.Checked;
                VS1.Chart.LabelAxisX = "Concentration";
                VS1.Chart.LabelAxisY = CompleteTable[1].Name;
                VS1.Chart.XAxisFormatDigitNumber = cGlobalInfo.OptionsWindow.FFAllOptions.GetDRCNumberOfDigit();
                VS1.Chart.IsZoomableX = true;

                Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]);
                //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/);
                VS1.Chart.ListVerticalLines.Add(VLForEC50);

                TableForGeneralResuts.ListRowNames.Add(TV.Nodes[IdxNode].Text);
                TableForGeneralResuts.ListTags.Add((Chart)VS1.Chart);//ListSelectedDesc[0]);

                //EC50
                TableForGeneralResuts[1].Add(SF.GetOutPut()[0][2]);

                // Slope
                TableForGeneralResuts[2].Add(SF.GetOutPut()[0][3]);

                // Bottom
                TableForGeneralResuts[3].Add(SF.GetOutPut()[0][0]);

                // Top
                TableForGeneralResuts[4].Add(SF.GetOutPut()[0][1]);

                // Window
                double Window = SF.GetOutPut()[0][1] / SF.GetOutPut()[0][0];
                TableForGeneralResuts[5].Add(Window);

                TableForGeneralResuts[6].Add(SF.GetOutPut()[0][5]);

                VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[CompleteTable.Count];

                for (int IdxCurve = 0; IdxCurve < CompleteTable.Count; IdxCurve++)
                {
                    cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign();
                    TmpSerieInfo.color = cGlobalInfo.ListCellularPhenotypes[IdxCurve % cGlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay;
                    TmpSerieInfo.markerStyle = MarkerStyle.None;

                    VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo;
                }

                VS1.Run();

                DS.SetInputData(VS1.GetOutPut());
                DS.SetInputData(VT.GetOutPut());
                DS.Orientation = Orientation.Horizontal;
                DS.Title = TV.Nodes[IdxNode++].Text; //TmpListWells.ti;// ListSelectedDesc[0].GetName();
                DS.Run();
                DT.SetInputData(DS.GetOutPut());
            }

            DT.Run();
            cExtendedControl TextEC = DT.GetOutPut();
            if (TextEC == null) return;

            TextEC.Width = 0;
            TextEC.Height = 0;

            TextEC.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom
                    | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);

            MainSplitter.SetInputData(TextEC);

            string DRCsortingMethod = cGlobalInfo.OptionsWindow.FFAllOptions.comboBoxDRCSorting.SelectedItem.ToString();
            //comboBoxDRCSorting
            int IdxColSorting = 0;
            cExtendedTable RT = TableForGeneralResuts;

            switch (DRCsortingMethod)
            {
                case "ANOVA":
                    IdxColSorting = 0;
                    break;
                case "EC50":
                    IdxColSorting = 1;
                    break;
                case "Window":
                    IdxColSorting = 5;
                    break;
                case "AUC":
                    IdxColSorting = 6;
                    break;
                case "None":
                    IdxColSorting = -1;
                    break;
                default:
                    break;

            }

            if (IdxColSorting != -1)
            {
                cSort S = new cSort();
                S.ColumnIndexForSorting = IdxColSorting;
                S.SetInputData(TableForGeneralResuts);
                S.IsAscending = true;
                S.Run();
                RT = S.GetOutPut();
            }
            cViewerTable VTForEC50 = new cViewerTable();

            RT.Name = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor().GetName();
            VTForEC50.SetInputData(RT);
            VTForEC50.DigitNumber = -1;
            VTForEC50.Run();

            MainSplitter.SetInputData(VTForEC50.GetOutPut());

            MainSplitter.Orientation = Orientation.Vertical;
            MainSplitter.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(MainSplitter.GetOutPut());
            DTW.Title = "DRC analysis [" + cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor().GetName() + "]";

            DTW.Run();
            DTW.Display();
        }
Exemplo n.º 9
0
        private void ToolStripMenuItem_DescendingSorting(object sender, EventArgs e)
        {
            if (GridView.SelectedColumns.Count == 0) return;

            cSort S = new cSort();
            S.SetInputData(this.Input);
            S.IsAscending = false;
            S.ColumnIndexForSorting = GridView.SelectedColumns[0].Index;
            S.Run();

            cDisplayExtendedTable CDT = new cDisplayExtendedTable();
            CDT.SetInputData(S.GetOutPut());
            CDT.Run();
        }