コード例 #1
0
        void Process()
        {
            // here is the core of the meta component ...
            // just a list of Component steps

            cCorrelationMatrix MyCorrelation = new cCorrelationMatrix();
            MyCorrelation.SetCorrelationType(this.CorrelationType);
            MyCorrelation.SetInputData(Input);
            MyCorrelation.Run();

            cViewerTable MyTable = new cViewerTable();
            MyTable.SetInputData(MyCorrelation.GetOutPut());
            MyTable.Run();

            cDesignerSinglePanel MyDesigner = new cDesignerSinglePanel();
            MyDesigner.SetInputData(MyTable.GetOutPut());
            MyDesigner.Run();

            cDisplayToWindow MyDisplay = new cDisplayToWindow();
            MyDisplay.SetInputData(MyDesigner.GetOutPut());
            MyDisplay.Title = this.Title;
            MyDisplay.Run();
            MyDisplay.Display();
        }
コード例 #2
0
ファイル: WindowHCSAnalyzer.cs プロジェクト: cyrenaique/HCSA
        private void correlationMatrixToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            if (checkedListBoxActiveDescriptors.CheckedItems.Count <= 1)
            {
                MessageBox.Show("At least two descriptors have to be selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


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

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

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

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


            cDesignerTab DT = new cDesignerTab();

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

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

                    cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

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


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


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

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

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


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

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

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



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

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

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

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

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

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

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

                cExtendedTable NewTable = new cExtendedTable(ListWellsToProcess, true);

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

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

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

            DT.Run();

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

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

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

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

            //ComputeAndDisplayCorrelationMatrix(false, true, null);
        }