public FormForManualClustering(cGlobalInfo GlobalInfo)
        {
            InitializeComponent();

            this.GlobalInfo = GlobalInfo;
            WellClassSelectionPanel = new PanelForClassSelection(true, eClassType.WELL);
            WellClassSelectionPanel.SelectAll();
            WellClassSelectionPanel.Height = tabPageWellClasses.Height;
            tabPageWellClasses.Controls.Add(WellClassSelectionPanel);

            HitClassPanel = new PanelForClassSelection(false, eClassType.WELL);
            HitClassPanel.Height = panelForHitClass.Height;
            HitClassPanel.UnSelectAll();
            HitClassPanel.Select(1);
            panelForHitClass.Controls.Add(HitClassPanel);

            NonHitClassPanel = new PanelForClassSelection( false, eClassType.WELL);
            NonHitClassPanel.Height = panelForNonHitClass.Height;
            NonHitClassPanel.UnSelectAll();
            NonHitClassPanel.Select(0);
            panelForNonHitClass.Controls.Add(NonHitClassPanel);

            PlatesSelectionPanel = new PanelForPlatesSelection(true, null, true);
            PlatesSelectionPanel.Height = tabPageWellClasses.Height;
            PlatesSelectionPanel.Width = tabPageWellClasses.Width;
            TabPagePlates.Controls.Add(PlatesSelectionPanel);
        }
Example #2
0
        public cFeedBackMessage Run()
        {
            //if (GlobalInfo == null)
            //{
            //    base.FeedBackMessage.IsSucceed = false;
            //    return base.FeedBackMessage;
            //}
            FormForDisplay WindowToDisplay = new FormForDisplay();
            WindowToDisplay.Text = "Class Selection";
            WindowToDisplay.FormBorderStyle = FormBorderStyle.FixedSingle;

            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(this.IsCheckBoxes, this.ClassType);
            //ClassSelectionPanel.Height = WindowToDisplay.Height;

            if ((IsSelectAll) && (this.IsCheckBoxes))
            {
                ClassSelectionPanel.SelectAll();
            }
            else
            {
                ClassSelectionPanel.UnSelectAll();
                ClassSelectionPanel.Select(0);
                ClassSelectionPanel.Select(1);
            }
            ClassSelectionPanel.Location = new System.Drawing.Point(10, 10);
            ClassSelectionPanel.Width = 150;
            ClassSelectionPanel.Height = ClassSelectionPanel.ListCheckBoxes.Count * 25;
            ClassSelectionPanel.BorderStyle = BorderStyle.Fixed3D;
            // MyPanel.Controls.Add(ClassSelectionPanel);

            Button ReturnButton = new Button();
            ReturnButton.Text = "Ok";
            ReturnButton.DialogResult = DialogResult.OK;
            ReturnButton.Location = new System.Drawing.Point(ClassSelectionPanel.Location.X, ClassSelectionPanel.Location.Y + ClassSelectionPanel.Height + 5);
            WindowToDisplay.Controls.Add(ReturnButton);

            WindowToDisplay.Controls.Add(ClassSelectionPanel);
            WindowToDisplay.Width = ClassSelectionPanel.Width + 28;
            WindowToDisplay.Height = ClassSelectionPanel.Height + ReturnButton.Height + 48;

            if (WindowToDisplay.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "Selection aborded !";
                return FeedBackMessage;
            }

            List<bool> ListBool = ClassSelectionPanel.GetListSelectedClass();

            int NumSelected = 0;
            this.ListSelectedClass = new cExtendedList();
            foreach (var item in ListBool)
            {
                if (item)
                {
                    this.ListSelectedClass.Add(1);
                    NumSelected++;
                }
                else
                    this.ListSelectedClass.Add(0);
            }

            if (NumSelected == 0)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No class selected !";
                return FeedBackMessage;
            }

            return FeedBackMessage;
        }
Example #3
0
        public cFeedBackMessage Run()
        {
            FormForDisplay WindowToDisplay = new FormForDisplay();
            WindowToDisplay.Text = "Class Selection";
            WindowToDisplay.FormBorderStyle = FormBorderStyle.FixedSingle;

            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection( this.IsCheckBoxes, this.ClassType);

            //ClassSelectionPanel.Height = WindowToDisplay.Height;
            if (this.IsSelectAll && this.IsCheckBoxes)
            {
                ClassSelectionPanel.SelectAll();
            }
            else
            {
                ClassSelectionPanel.UnSelectAll();
                ClassSelectionPanel.Select(0);
                ClassSelectionPanel.Select(1);
            }
            ClassSelectionPanel.Location = new System.Drawing.Point(10, 10);
            ClassSelectionPanel.Width = 150;

            if(IsCheckBoxes)
                ClassSelectionPanel.Height = ClassSelectionPanel.ListCheckBoxes.Count*25;
            else
                ClassSelectionPanel.Height = ClassSelectionPanel.ListRadioButtons.Count * 25;
            ClassSelectionPanel.BorderStyle = BorderStyle.Fixed3D;
               // MyPanel.Controls.Add(ClassSelectionPanel);

            Button ReturnButton = new Button();
            ReturnButton.Text = "Ok";
            ReturnButton.DialogResult = DialogResult.OK;
            ReturnButton.Location = new System.Drawing.Point(ClassSelectionPanel.Location.X, ClassSelectionPanel.Location.Y + ClassSelectionPanel.Height + 5);
            WindowToDisplay.Controls.Add(ReturnButton);

            WindowToDisplay.Controls.Add(ClassSelectionPanel);
            WindowToDisplay.Width = ClassSelectionPanel.Width + 28;
            WindowToDisplay.Height = ClassSelectionPanel.Height + ReturnButton.Height+ 48;

            if (WindowToDisplay.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "Selection aborded !";
                return FeedBackMessage;
            }

            List<bool> ListBool = ClassSelectionPanel.GetListSelectedClass();

            int NumSelected = 0;

            this.ListSelectedClass = new cExtendedTable();
            this.ListSelectedClass.Name = "List Class Selected";
            this.ListSelectedClass.Add(new cExtendedList());

            this.ListSelectedClass[0].ListTags = new List<object>();

            int Idx = 0;
            foreach (var item in ListBool)
            {
                if (item)
                {
                    this.ListSelectedClass[0].Add(1);
                    if(this.ClassType== eClassType.WELL)
                        this.ListSelectedClass[0].ListTags.Add(cGlobalInfo.ListWellClasses[Idx]);
                    else if(this.ClassType == eClassType.PHENOTYPE)
                        this.ListSelectedClass[0].ListTags.Add(cGlobalInfo.ListCellularPhenotypes[Idx]);

                    NumSelected++;
                }
                else
                {
                    this.ListSelectedClass[0].Add(0);
                    this.ListSelectedClass[0].ListTags.Add(null);

                }
                Idx++;
            }

            if (NumSelected==0)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No class selected !";
                return FeedBackMessage;
            }

            //if (NumSelected < MinNumberOfClass)
            //{
            //    FeedBackMessage.IsSucceed = false;
            //    FeedBackMessage.Message = "At least "+MinNumberOfClass+" class have to be selected !";
            //    return FeedBackMessage;
            //}

            return FeedBackMessage;
        }
Example #4
0
        private void SubPopulationStatDescItem(object sender, EventArgs e)
        {
            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(true, eClassType.PHENOTYPE);
            //ClassSelectionPanel.Height = WindowToDisplay.Height;
            ClassSelectionPanel.UnSelectAll();
            ClassSelectionPanel.Select(0);
            ClassSelectionPanel.Select(1);
            ClassSelectionPanel.Location = new System.Drawing.Point(10, 10);
            ClassSelectionPanel.Width = 150;
            ClassSelectionPanel.Height = ClassSelectionPanel.ListCheckBoxes.Count * 25;
            ClassSelectionPanel.BorderStyle = BorderStyle.Fixed3D;

            FormForStatDesc NewWindow = new FormForStatDesc(this.GlobalInfo);
            NewWindow.panelForSubPopulation.Controls.Add(ClassSelectionPanel);
            NewWindow.textBoxDescName.Text = cGlobalInfo.CurrentScreening.ListDescriptors[IntToTransfer].GetName() + "_Average";
            if (NewWindow.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            if ((NewWindow.comboBoxStatistics.Text != "Average") && (NewWindow.comboBoxStatistics.Text != "Stdev") &&
                (NewWindow.comboBoxStatistics.Text != "Sum") && (NewWindow.comboBoxStatistics.Text != "Median") && (NewWindow.comboBoxStatistics.Text != "MAD") && (NewWindow.comboBoxStatistics.Text != "CV%"))
                return;

            List<cCellularPhenotype> LCP = new List<cCellularPhenotype>();
            for (int IdxPheno = 0; IdxPheno < ClassSelectionPanel.GetListSelectedClass().Count; IdxPheno++)
            {
                if (ClassSelectionPanel.GetListSelectedClass()[IdxPheno])
                    LCP.Add(cGlobalInfo.ListCellularPhenotypes[IdxPheno]);
            }

            if (LCP.Count == 0) return;

            double RatioPopulation = 1;

            string description = "This descriptor has been generated by computing the " + NewWindow.textBoxDescName.Text + " of " + RatioPopulation * 100 + "% the following phenotypic sub-populations:\n";
            foreach (var item in LCP)
            {
                description += item.Name + "\n";
            }

            cDescriptorType NewAverageType = new cDescriptorType(NewWindow.textBoxDescName.Text, true, 1, description);
            cGlobalInfo.CurrentScreening.ListDescriptors.AddNew(NewAverageType);

            FormForProgress ProgressWindow = new FormForProgress();
            ProgressWindow.Show();

            int IdxProgress = 0;
            int MaxProgress = 0;

            foreach (cPlate CurrentPlateToProcess in cGlobalInfo.CurrentScreening.ListPlatesAvailable)
                MaxProgress += (int)CurrentPlateToProcess.ListActiveWells.Count;

            ProgressWindow.progressBar.Maximum = MaxProgress;

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesAvailable)
            {
                foreach (cWell Tmpwell in TmpPlate.ListActiveWells)
                {
                    TmpPlate.DBConnection = new cDBConnection(TmpPlate, Tmpwell.SQLTableName);
                    List<cDescriptorType> LDT = new List<cDescriptorType>();
                    LDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors[IntToTransfer]);

                    cExtendedTable CT = TmpPlate.DBConnection.GetWellValues(Tmpwell, LDT, LCP, RatioPopulation);
                    cListSignature LDesc = new cListSignature();

                    double Value = 0;
                    if (CT.Count == 1)
                    {

                        if (CT[0].Count == 0)
                        {
                            Value = 0;
                            richTextBoxConsole.AppendText(TmpPlate.GetName() + " : " + Tmpwell.GetShortInfo().Remove(Tmpwell.GetShortInfo().Length - 2) + ": no objects fullfill your request. Statistics set to null.\n");
                        }
                        else
                        {
                            if (NewWindow.comboBoxStatistics.Text == "Average")
                                Value = CT[0].Average();
                            else if (NewWindow.comboBoxStatistics.Text == "Stdev")
                                Value = CT[0].Std();
                            else if (NewWindow.comboBoxStatistics.Text == "Sum")
                                Value = CT[0].Sum();
                            else if (NewWindow.comboBoxStatistics.Text == "Median")
                                Value = CT[0].Median();
                            else if (NewWindow.comboBoxStatistics.Text == "MAD")
                                Value = CT[0].MAD(true);
                            else if (NewWindow.comboBoxStatistics.Text == "CV%")
                                Value = CT[0].CV();
                        }
                    }

                    ProgressWindow.richTextBoxForComment.AppendText(Tmpwell.GetShortInfo() + ": " + CT[0].Count.ToString() + " / " + Tmpwell.GetNumBiologicalObjects() + "\n");

                    cSignature NewDesc = new cSignature(Value, NewAverageType, cGlobalInfo.CurrentScreening);
                    LDesc.Add(NewDesc);
                    Tmpwell.AddSignatures(LDesc);
                    TmpPlate.DBConnection.CloseConnection();

                    ProgressWindow.progressBar.Value = IdxProgress++;

                    ProgressWindow.richTextBoxForComment.AppendText(TmpPlate.GetName() + " : " + Tmpwell.GetShortInfo().Remove(Tmpwell.GetShortInfo().Length - 2) + "\n");
                    ProgressWindow.Refresh();
                }
            }
            ProgressWindow.Close();

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

            for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; idxP++)
                cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax();
        }
Example #5
0
        private void GeneratePCADescriptorItem(object sender, EventArgs e)
        {
            FormForProjections WindowClassification = new FormForProjections();
            //WindowClassification.buttonClassification.Text = "Process";
            WindowClassification.label1.Text = "Class of Interest";
            WindowClassification.Text = "PCA";
            WindowClassification.IsPCA = true;
            WindowClassification.numericUpDownNumberOfAxis.Maximum = cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor();

            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(true, eClassType.WELL);
            ClassSelectionPanel.Height = WindowClassification.panelForClasses.Height;
            ClassSelectionPanel.UnSelectAll();
            ClassSelectionPanel.Select(2);
            WindowClassification.panelForClasses.Controls.Add(ClassSelectionPanel);

            cListPlates PlatesToProcess = new cListPlates(null);
            if (WindowClassification.radioButtonFromCurrentPlate.Checked)
                PlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            else
                PlatesToProcess = cGlobalInfo.CurrentScreening.ListPlatesActive;

            WindowClassification.PlatesToProcess = PlatesToProcess;
            if (WindowClassification.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
        }
        public cFeedBackMessage Run(cGlobalInfo GlobalInfo)
        {
            FormForDisplay WindowToDisplay = new FormForDisplay();
            WindowToDisplay.Text = "2 Classes Selection";
            WindowToDisplay.FormBorderStyle = FormBorderStyle.FixedSingle;

            PanelForClassSelection ClassSelectionPanel1 = new PanelForClassSelection(PanelLeft_IsCheckBoxes, this.ClassType);
            ClassSelectionPanel1.UnSelectAll();
            ClassSelectionPanel1.Select(0);
            ClassSelectionPanel1.Location = new System.Drawing.Point(10, 10);
            ClassSelectionPanel1.Width = 140;
            if(ClassSelectionPanel1.ListCheckBoxes!=null)
                ClassSelectionPanel1.Height = ClassSelectionPanel1.ListCheckBoxes.Count*25;
            else
                ClassSelectionPanel1.Height = ClassSelectionPanel1.ListRadioButtons.Count * 25;
            ClassSelectionPanel1.BorderStyle = BorderStyle.Fixed3D;

            PanelForClassSelection ClassSelectionPanel2 = new PanelForClassSelection( PanelRight_IsCheckBoxes, this.ClassType);
            ClassSelectionPanel2.UnSelectAll();
            ClassSelectionPanel2.Select(1);
            ClassSelectionPanel2.Location = new System.Drawing.Point(10 + ClassSelectionPanel1.Width, 10);
            ClassSelectionPanel2.Width = 140;
            if (ClassSelectionPanel2.ListCheckBoxes != null)
                ClassSelectionPanel2.Height = ClassSelectionPanel2.ListCheckBoxes.Count * 25;
            else
                ClassSelectionPanel2.Height = ClassSelectionPanel2.ListRadioButtons.Count * 25;
            ClassSelectionPanel2.BorderStyle = BorderStyle.Fixed3D;

            Button ReturnButton = new Button();
            ReturnButton.Text = "Ok";
            ReturnButton.DialogResult = DialogResult.OK;
            ReturnButton.Location = new System.Drawing.Point(ClassSelectionPanel1.Location.X, ClassSelectionPanel1.Location.Y + ClassSelectionPanel1.Height + 5);
            WindowToDisplay.Controls.Add(ReturnButton);

            WindowToDisplay.Controls.Add(ClassSelectionPanel1);
            WindowToDisplay.Controls.Add(ClassSelectionPanel2);
            WindowToDisplay.Width = ClassSelectionPanel1.Width + ClassSelectionPanel2.Width + 28;
            WindowToDisplay.Height = ClassSelectionPanel1.Height + ReturnButton.Height+ 48;

            if (WindowToDisplay.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "Selection aborded !";
                return FeedBackMessage;
            }

            List<bool> ListBool1 = ClassSelectionPanel1.GetListSelectedClass();
            List<bool> ListBool2 = ClassSelectionPanel2.GetListSelectedClass();

            int NumSelected = 0;
            this.ListSelectedClass = new cExtendedTable();

            foreach (var item in ListBool1)
            {
                this.ListSelectedClass.Add(new cExtendedList());
                if (item)
                {
                    this.ListSelectedClass[0].Add(1);
                    NumSelected++;
                }
                else
                    this.ListSelectedClass[0].Add(0);
            }
            foreach (var item in ListBool2)
            {
                this.ListSelectedClass.Add(new cExtendedList());
                if (item)
                {
                    this.ListSelectedClass[1].Add(1);
                    NumSelected++;
                }
                else
                    this.ListSelectedClass[1].Add(0);
            }

            return FeedBackMessage;
        }