Ejemplo n.º 1
0
        private void hitsDistributionMapToolStripMenuItem_Click(object sender, EventArgs e)
        {

            if (cGlobalInfo.CurrentScreening == null) return;
            List<cPanelForDisplayArray> ListPlates = new List<cPanelForDisplayArray>();

            foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
            {
                ListPlates.Add(new FormToDisplayPlate(CurrentPlate));
            }

            cWindowToDisplayEntireScreening WindowToDisplayArray = new cWindowToDisplayEntireScreening(ListPlates, cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName(), 6);
            WindowToDisplayArray.checkBoxDisplayClasses.Checked = true;
            WindowToDisplayArray.Text = "Generate Hits Distribution Maps";

            WindowToDisplayArray.Show();


            System.Windows.Forms.DialogResult ResWin = MessageBox.Show("By applying this process, the current screening will be entirely updated ! Proceed ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
            if (ResWin == System.Windows.Forms.DialogResult.No)
            {
                WindowToDisplayArray.Close();
                return;
            }

            WindowToDisplayArray.Close();
            if (cGlobalInfo.CurrentScreening != null) cGlobalInfo.CurrentScreening.Close3DView();

            //   CompleteScreening.ListDescriptors.RemoveDesc(CompleteScreening.ListDescriptors[IntToTransfer], CompleteScreening);
            cScreening MergedScreening = new cScreening("Class Screen");
            MergedScreening.PanelForPlate = this.panelForPlate;

            MergedScreening.Rows = cGlobalInfo.CurrentScreening.Rows;
            MergedScreening.Columns = cGlobalInfo.CurrentScreening.Columns;
            MergedScreening.ListPlatesAvailable = new cListPlates();

            // create the descriptor
            MergedScreening.ListDescriptors.Clean();

            List<cDescriptorType> ListDescType = new List<cDescriptorType>();
            List<int[][]> Values = new List<int[][]>();

            for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++)
            {
                cDescriptorType DescClass = new cDescriptorType("Class_" + i, true, 1);
                ListDescType.Add(DescClass);
                MergedScreening.ListDescriptors.AddNew(DescClass);

                int[][] TMpVal = new int[MergedScreening.Columns][];
                for (int ii = 0; ii < MergedScreening.Columns; ii++)
                    TMpVal[ii] = new int[MergedScreening.Rows];

                Values.Add(TMpVal);
            }

            MergedScreening.ListDescriptors.CurrentSelectedDescriptorIdx = 0;

            foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
            {
                foreach (cWell TmpWell in CurrentPlate.ListActiveWells)
                {
                    int Class = TmpWell.GetCurrentClassIdx();
                    if (Class >= 0)
                        Values[Class][TmpWell.GetPosX() - 1][TmpWell.GetPosY() - 1]++;
                }
            }

            cPlate NewPlate = new cPlate(cGlobalInfo.CurrentScreening.GetName(), MergedScreening);

            for (int X = 0; X < cGlobalInfo.CurrentScreening.Columns; X++)
                for (int Y = 0; Y < cGlobalInfo.CurrentScreening.Rows; Y++)
                {
                    cListSignature LDesc = new cListSignature();
                    for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++)
                    {
                        cSignature Desc = new cSignature(Values[i][X][Y], ListDescType[i], cGlobalInfo.CurrentScreening);
                        LDesc.Add(Desc);

                    }
                    cWell NewWell = new cWell(LDesc, X + 1, Y + 1, MergedScreening, NewPlate);
                   // NewWell.SetCpdName("Well [" + (X + 1) + ":" + (Y + 1) + "]");
                    NewPlate.AddWell(NewWell);

                }

            // check if the plate exist already
            MergedScreening.AddPlate(NewPlate);
            MergedScreening.ListPlatesActive = new cListPlates();

            cGlobalInfo.WindowHCSAnalyzer.toolStripcomboBoxPlateList.Items.Clear();

            for (int i = 0; i < MergedScreening.ListPlatesAvailable.Count; i++)
            {
                MergedScreening.ListPlatesActive.Add(MergedScreening.ListPlatesAvailable[i]);
                cGlobalInfo.WindowHCSAnalyzer.toolStripcomboBoxPlateList.Items.Add(NewPlate.GetName());
            }

            cGlobalInfo.CurrentScreening.ListDescriptors = MergedScreening.ListDescriptors;
            cGlobalInfo.CurrentScreening.ListPlatesAvailable = MergedScreening.ListPlatesAvailable;
            cGlobalInfo.CurrentScreening.ListPlatesActive = MergedScreening.ListPlatesActive;

            cGlobalInfo.CurrentScreening.UpDatePlateListWithFullAvailablePlate();
            for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; idxP++)
                cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax();

            cGlobalInfo.CurrentScreening.CurrentDisplayPlateIdx = 0;
            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), true);

            ListPlates = new List<cPanelForDisplayArray>();
            for (int DescIdx = 0; DescIdx < cGlobalInfo.CurrentScreening.ListDescriptors.Count; DescIdx++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[DescIdx].IsActive())
                    ListPlates.Add(new FormToDisplayDescriptorPlate(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate(), cGlobalInfo.CurrentScreening, DescIdx));
            }

            cWindowToDisplayEntireDescriptors WindowToDisplayDesc = new cWindowToDisplayEntireDescriptors(ListPlates, cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName(), cGlobalInfo.ListWellClasses.Count);
            WindowToDisplayDesc.checkBoxGlobalNormalization.Checked = true;

            WindowToDisplayDesc.Show();
        }