Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
        private void DisplayHeatMap(object sender, EventArgs e)
        {
            cViewerHeatMap VHM = new cViewerHeatMap();
            VHM.SetInputData(this.Input);
            VHM.Run();

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

            cDisplayToWindow DW = new cDisplayToWindow();
            DW.SetInputData(CD.GetOutPut());
            DW.Run();
            DW.Display();
        }
Ejemplo n.º 4
0
        public cFeedBackMessage Run(bool IsDisplayResults)
        {
            cMachineLearning MachineLearning = new cMachineLearning(/*cWell.GlobalInfo*/null);
            ParamAlgoForClustering = MachineLearning.AskAndGetClusteringAlgo();

            if (MinObjectsNumber == -1)
                MinObjectsNumber = (cGlobalInfo.CurrentScreening.Columns * cGlobalInfo.CurrentScreening.Rows * (int)cGlobalInfo.OptionsWindow.numericUpDownSystemMinWellRatio.Value) / 100;

            foreach (cPlate CurrentPlate in PlatesToProcess)
            {
                cExtendedTable CurrentPlateResult = null;

                foreach (var item in this.DescriptorsToProcess)
                {
                    cExtendedTable ET = CurrentPlate.GetAverageValueList(item, false);
                    ET.Name = item.GetName();

                    cExtendedTable ResultTable = this.GenerateArtifactMessage(ET, CurrentPlate);
                    ResultTable.ListRowNames = new List<string>();
                    ResultTable.ListRowNames.Add(item.GetName());

                    if (CurrentPlateResult == null) CurrentPlateResult = new cExtendedTable(ResultTable);
                    else
                    {
                        cMerge M = new cMerge();
                        M.IsHorizontal = false;
                        M.SetInputData(CurrentPlateResult, ResultTable);
                        M.Run();
                        CurrentPlateResult = M.GetOutPut();
                    }

                }
                CurrentPlateResult.Name = CurrentPlate.GetName();
                CurrentPlateResult.Tag = CurrentPlate;

                this.Output.Add(CurrentPlateResult);
            }

            this.Output.Name = "Systematic Errors (" + PlatesToProcess.Count + " plate(s))";

            if (IsDisplayResults)
            {
                cDisplayToWindow DTW = new cDisplayToWindow();

                cDesignerMultiChoices DMC = new cDesignerMultiChoices();

                foreach (var item in this.Output)
                {

                    cDesignerSplitter DS = new cDesignerSplitter();
                    DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                    DS.Title = item.Name;

                    cViewerTable VT = new cViewerTable();
                    VT.SetInputData(item);
                    VT.DigitNumber = 0;
                    VT.Run();
                    DS.SetInputData(VT.GetOutPut());

                    cViewerHeatMap VHM = new cViewerHeatMap();
                    VHM.SetInputData(item);
                    VHM.IsAutomatedMinMax = false;
                    VHM.Min = 0;
                    VHM.Max = 1;
                    VHM.Run();
                    DS.SetInputData(VHM.GetOutPut());

                    DS.Run();
                    cExtendedControl TmpXCtrl = DS.GetOutPut();
                    TmpXCtrl.Tag = item.Tag;
                    DMC.SetInputData(TmpXCtrl);

                }

                DMC.Run();
                DTW.SetInputData(DMC.GetOutPut());
                DTW.Title = "Systematic Errors [" + PlatesToProcess.Count + " plate(s)]";

                DTW.Run();
                DTW.Display();

                //cDisplayListExtendedTable DLET = new cDisplayListExtendedTable();
                //DLET.SetInputData(this.Output);
                //return DLET.Run();
            }

            return FeedBackMessage;
        }