コード例 #1
0
        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);
        }
コード例 #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;
        }
コード例 #3
0
ファイル: cGUI_ListClasses.cs プロジェクト: cyrenaique/HCSA
        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;
        }
コード例 #4
0
ファイル: HCSAnalyzer2.cs プロジェクト: cyrenaique/HCSA
        private void swapClassesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (cGlobalInfo.CurrentScreening == null) return;

            FormForSwapClasses WindowSwapClasses = new FormForSwapClasses(GlobalInfo);

            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(true, eClassType.WELL);
            ClassSelectionPanel.Height = WindowSwapClasses.panelToBeSwapped.Height;
            //ClassSelectionPanel.Location.Y = ClassSelectionPanel.Location.Y+ 20;
            ClassSelectionPanel.UnSelectAll();
            WindowSwapClasses.panelToBeSwapped.Controls.Add(ClassSelectionPanel);

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

            int Idx = 0;
            int NumberOfPlates = cGlobalInfo.CurrentScreening.ListPlatesActive.Count;

            // int OriginalIdx = WindowSwapClasses.comboBoxOriginalClass.SelectedIndex - 1;
            int DestinatonIdx = WindowSwapClasses.comboBoxDestinationClass.SelectedIndex - 1;

            // loop on all the plate
            for (int PlateIdx = 0; PlateIdx < NumberOfPlates; PlateIdx++)
            {
                cPlate CurrentPlateToProcess = cGlobalInfo.CurrentScreening.ListPlatesActive.GetPlate(PlateIdx);

                for (int IdxValue = 0; IdxValue < cGlobalInfo.CurrentScreening.Columns; IdxValue++)
                    for (int IdxValue0 = 0; IdxValue0 < cGlobalInfo.CurrentScreening.Rows; IdxValue0++)
                    {
                        cWell TmpWell = CurrentPlateToProcess.GetWell(IdxValue, IdxValue0, false);
                        if (TmpWell == null) continue;

                        if ((TmpWell.GetCurrentClassIdx() > -1) && (ClassSelectionPanel.GetListSelectedClass()[TmpWell.GetCurrentClassIdx()]))
                        {
                            if (DestinatonIdx == -1)
                                TmpWell.SetAsNoneSelected();
                            else
                                TmpWell.SetClass(DestinatonIdx);

                            Idx++;
                        }

                    }
            }
            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false);
            MessageBox.Show(Idx + " wells have been swapped !", "Process over !", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
コード例 #5
0
ファイル: HCSAnalyzer2.cs プロジェクト: cyrenaique/HCSA
        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();
        }
コード例 #6
0
ファイル: HCSAnalyzer2.cs プロジェクト: cyrenaique/HCSA
        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;
        }
コード例 #7
0
        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;
        }