Exemple #1
0
        private void histogramsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cGUI_ListClasses GUIClasses = new cGUI_ListClasses();
            GUIClasses.IsCheckBoxes = false;
            GUIClasses.ClassType = eClassType.PHENOTYPE;
            if (!GUIClasses.Run().IsSucceed) return;

            cGUI_ListClasses GUIClassesWells = new cGUI_ListClasses();
            GUIClassesWells.IsCheckBoxes = true;
            GUIClassesWells.ClassType = eClassType.WELL;
            if (!GUIClassesWells.Run().IsSucceed) return;

            List<cWellClassType> ListClass = new List<cWellClassType>();
            for (int i = 0; i < GUIClassesWells.GetOutPut()[0].Count; i++)
            {
                if (GUIClassesWells.GetOutPut()[0][i] == 1)
                    ListClass.Add(cGlobalInfo.ListWellClasses[i]);
            }


            cGUI_ListPlates GUIListPlates = new cGUI_ListPlates();
            GUIListPlates.IsCheckBoxes = true;
            if (!GUIListPlates.Run().IsSucceed) return;

            List<cDescriptorType> LCDT = new List<cDescriptorType>();
            LCDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor());


            cDesignerTab DT = new cDesignerTab();
            DT.IsMultiline = false;

            foreach (var TmpPlate in GUIListPlates.GetOutPut())
            {
                cListWells CurrentPlateListWells = TmpPlate.ListWells.Filter(ListClass);

                cExtendedTable FinalTable = new cExtendedTable();
                FinalTable.Name = TmpPlate.GetName() + " - " + CurrentPlateListWells.Count + " wells";

                for (int i = 0; i < GUIClasses.GetOutPut()[0].Count; i++)
                {
                    if (GUIClasses.GetOutPut()[0][i] == 1)
                    {
                        FinalTable.Add(new cExtendedList());
                        FinalTable[0].Name = cGlobalInfo.ListCellularPhenotypes[i].Name;
                        FinalTable[0].Tag = cGlobalInfo.ListCellularPhenotypes[i];
                    }
                }

                foreach (cWell TmpWell in CurrentPlateListWells)
                {
                    TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName);

                    for (int i = 0; i < GUIClasses.GetOutPut()[0].Count; i++)
                    {
                        if (GUIClasses.GetOutPut()[0][i] == 1)
                        {
                            List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>();
                            ListCellularPhenotypesToBeSelected.Add(cGlobalInfo.ListCellularPhenotypes[i]);

                            cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell,
                                                     LCDT, ListCellularPhenotypesToBeSelected);

                            if (TmpET.Count > 0) FinalTable[0].AddRange(TmpET[0]);
                            break;
                        }
                    }
                    TmpWell.AssociatedPlate.DBConnection.CloseConnection();
                }

                cViewerHistogram VH = new cViewerHistogram();
                //cViewerStackedHistogram VSH = new cViewerStackedHistogram();
                VH.SetInputData(FinalTable);
                //VH.Chart.BinNumber = -1;
                //VSH.Chart.Is

                //VH.ListProperties.FindByName("Bin Number").SetNewValue((int)100);
                //VH.ListProperties.FindByName("Bin Number").IsGUIforValue = true;

                //  VSH.Chart.BinNumber = LCDT[0].GetBinNumber();
                VH.Chart.IsShadow = false;
                VH.Chart.IsBorder = true;
                VH.Chart.IsXGrid = true;
                VH.Chart.IsHistoNormalized = true;
                VH.Chart.IsBar = true;

                VH.Chart.IsYGrid = true;
                VH.Chart.LabelAxisX = LCDT[0].GetName();
                VH.Title = TmpPlate.GetName();
                VH.Run();
                VH.Chart.Width = 0;
                VH.Chart.Height = 0;


                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = Orientation.Vertical;
                DS.SetInputData(VH.GetOutPut());

                cHistogramBuilder HB = new cHistogramBuilder();
                HB.SetInputData(FinalTable);
                HB.BinNumber = -1;
                HB.IsNormalized = true;
                HB.Run();

                cViewerTable VT = new cViewerTable();
                VT.SetInputData(HB.GetOutPut());
                VT.Run();

                DS.SetInputData(VT.GetOutPut());
                DS.Title = TmpPlate.GetName();
                DS.Run();
                //DS.SetInputData(HB.Get


                DT.SetInputData(DS.GetOutPut());

            }

            DT.Run();
            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(DT.GetOutPut());
            DTW.Title = "Single cell based Histograms";
            DTW.Run();
            DTW.Display();


        }
Exemple #2
0
        private void ToolStripMenuItem_DisplayHisto(object sender, EventArgs e)
        {
            cExtendedTable CET = new cExtendedTable();
            CET.Name = Input.Name;
            foreach (DataGridViewColumn item in GridView.SelectedColumns)
                CET.Add(Input[item.Index]);

            cViewerHistogram VH = new cViewerHistogram();
            VH.SetInputData(CET);
            VH.Title = "Histogram";
            //CV1.Chart.IsBar = true;
            //CV1.Chart.ISPoint = false;
            // CV1.Chart.IsDisplayValues = true;
            VH.Run();

            cDisplayToWindow DW = new cDisplayToWindow();
            DW.Title = CET.Name + " - Histogram Viewer";
            DW.SetInputData(VH.GetOutPut());
            DW.Run();
            DW.Display();
        }
Exemple #3
0
        /// <summary>
        /// This function displays the evolution of the average value of a certain descriptor through the plates, for a specified class
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void descriptorEvolutionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //  if (CompleteScreening == null) return;

            #region extract classes of interest
            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = !_DescEvolCellByCellItem.Checked;
            GUI_ListClasses.IsSelectAll = false;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut();

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

            cDescriptorType DT = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor();

            cGUI_ListPlates GUI_ListPlates = new cGUI_ListPlates();
            GUI_ListPlates.IsCheckBoxes = true;
            GUI_ListPlates.ListInitialPlates = cGlobalInfo.CurrentScreening.ListPlatesActive;
            // GUI_ListClasses.ListInitialPlates = null;
            cFeedBackMessage FBM = GUI_ListPlates.Run();
            richTextBoxConsole.AppendText(FBM.Message);
            if (!FBM.IsSucceed) return;

            cListPlates LP = GUI_ListPlates.GetOutPut();

            if (_DescEvolCellByCellItem.Checked)
            {
                cExtendedTable FinalTable = new cExtendedTable();
                foreach (cPlate CurrentPlate in LP)
                {
                    cExtendedTable TmpFinalTable = new cExtendedTable();

                    int NumberOfWells = 0;
                    foreach (cWell item in CurrentPlate.ListActiveWells)
                    {
                        if (item.GetCurrentClassIdx() == -1) continue;
                        if (ListClassSelected[0][item.GetCurrentClassIdx()] == 1)
                        {
                            cExtendedTable TmpET = item.GetValuesList(DT);

                            if (TmpFinalTable.Count == 0)
                            {
                                TmpFinalTable = new cExtendedTable(TmpET);
                            }
                            else
                            {
                                cMerge M = new cMerge();
                                M.IsHorizontal = false;
                                M.SetInputData(TmpFinalTable, TmpET);
                                M.Run();
                                TmpFinalTable = M.GetOutPut();
                            }
                            NumberOfWells++;
                        }
                    }

                    if (NumberOfWells == 0) continue;

                    if (FinalTable.Count == 0)
                    {
                        FinalTable = new cExtendedTable(TmpFinalTable);
                        FinalTable[0].Name = CurrentPlate.GetName() + " (" + NumberOfWells + " wells)";
                    }
                    else
                    {
                        cMerge M = new cMerge();
                        M.IsHorizontal = true;
                        TmpFinalTable[0].Name = CurrentPlate.GetName() + " (" + NumberOfWells + " wells)";
                        M.SetInputData(FinalTable, TmpFinalTable);
                        M.Run();
                        FinalTable = M.GetOutPut();
                    }

                }
                cViewerHistogram VH = new cViewerHistogram();
                FinalTable.Name = DT.GetName();
                VH.Chart.LabelAxisX = DT.GetName();
                VH.Chart.IsArea = true;
                VH.Chart.IsPoint = false;
                //VH.Chart.IsBar = false;
                //VH.Chart.IsShadow = true;
                VH.Chart.IsXGrid = VH.Chart.IsYGrid = false;
                VH.Chart.Opacity = 200;
                VH.Chart.IsLegend = true;
                VH.SetInputData(FinalTable);
                VH.Chart.CurrentTitle.Text = cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";
                VH.Run();

                cDisplayToWindow DTW = new cDisplayToWindow();
                DTW.SetInputData(VH.GetOutPut());
                DTW.Title = "Cell-by-Cell Descriptor Evolution";
                DTW.Run();

                DTW.Display();

                //cExtendedTable ET = CompleteScreening.GetCurrentDisplayPlate().DBConnection.GetWellValues(
                //    this.AssociatedPlate.DBConnection.GetWellValues(this,
                //                         LCDT,
                //                         ListCellularPhenotypesToBeSelected);
            }
            else
            {
                cDisplayDescriptorEvolutions DEV = new cDisplayDescriptorEvolutions();
                DEV.ListPlates = LP;
                DEV.SetInputData(ListClassSelected);
                DEV.Run(cGlobalInfo.CurrentScreening);
            }
        }
Exemple #4
0
        public void ExportToHTML(cDescriptorType Desc)
        {
            if (Desc.IsConnectedToDatabase == false) return;
            List<cDescriptorType> LCDT = new List<cDescriptorType>();
            LCDT.Add(Desc);

            List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>();

            cGUI_ListClasses GUIClasses = new cGUI_ListClasses();
            GUIClasses.IsCheckBoxes = true;
            GUIClasses.IsSelectAll = true;
            GUIClasses.ClassType = eClassType.PHENOTYPE;
            if (!GUIClasses.Run().IsSucceed) return;

            int IDx = 0;
            foreach (var item in cGlobalInfo.ListCellularPhenotypes)
            {
                if ((GUIClasses.GetOutPut()[0][IDx++] != 0))
                    ListCellularPhenotypesToBeSelected.Add(item);
            }

            cExtendedTable ET = new cExtendedTable(cGlobalInfo.CurrentScreening.Columns, cGlobalInfo.CurrentScreening.Rows, 0);
            ET.Name = this.Name + " [" + Desc.GetName() + "]";
            ET.ListRowNames = new List<string>();

            for (int i = 0; i < ET[0].Count; i++)
            {
                ET.ListRowNames.Add(((char)(i + 65)).ToString());
            }

            FormForProgress MyProgressBar = new FormForProgress();

            MyProgressBar.progressBar.Maximum = this.ListActiveWells.Count;
            MyProgressBar.Show();

            //ET.ListTags = new List<object>();
            for (int i = 0; i < cGlobalInfo.CurrentScreening.Columns; i++)
            {
                ET[i].ListTags = new List<object>();
                ET[i].Name = (i + 1).ToString();

                for (int j = 0; j < cGlobalInfo.CurrentScreening.Rows; j++)
                {

                    MyProgressBar.progressBar.Update();

                    cWell TmpWell = this.GetWell(i, j, true);
                    if (TmpWell == null)
                    {
                        ET[i].ListTags.Add("n.a.");
                        continue;
                    }
                    MyProgressBar.progressBar.Value++;
                    cExtendedTable TmpET = null;
                    if (cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxHTMLExportStackedHisto.Checked)
                        TmpET = TmpWell.GetValuesList(LCDT, ListCellularPhenotypesToBeSelected, true);
                    else
                        TmpET = TmpWell.GetValuesList(LCDT, ListCellularPhenotypesToBeSelected, false);
                    TmpET.Name = "[" + TmpWell.GetPos() + "] - " + TmpET[0].Count + " Objects";
                    // get the values associated to this well and descriptor

                    if (cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxHTMLExportStackedHisto.Checked)
                    {
                        cExtendedTable FinalTable = new cExtendedTable();
                        FinalTable.Name = "Stacked Histogram - " + this.GetName();

                        int Idx = 0;
                        foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                        {
                            FinalTable.Add(new cExtendedList());
                            FinalTable[Idx].Name = item.Name;
                            FinalTable[Idx].Tag = item;

                            for (int k = 0; k < TmpET[1].Count; k++)
                            {
                                if (TmpET[1][k] == Idx)
                                    FinalTable[Idx].Add(TmpET[0][k]);
                            }
                            Idx++;
                        }

                        cViewerStackedHistogram VSH = new cViewerStackedHistogram();
                        VSH.SetInputData(FinalTable);//TmpET);
                        VSH.Chart.LabelAxisX = Desc.GetName();
                        VSH.Chart.IsLine = false;
                        VSH.Chart.CurrentTitle.Text = TmpET.Name;
                        if ((cGlobalInfo.OptionsWindow.radioButtonHistoDisplayManualMinMax.Checked) || (cGlobalInfo.OptionsWindow.radioButtonHistoDisplayAutomatedMinMax.Checked))
                        {
                            VSH.Chart.DefaultAxisXMin = new cExtendedList();
                            VSH.Chart.DefaultAxisXMin.Add((double)cGlobalInfo.OptionsWindow.numericUpDownManualMin.Value);

                            VSH.Chart.DefaultAxisXMax = new cExtendedList();
                            VSH.Chart.DefaultAxisXMax.Add((double)cGlobalInfo.OptionsWindow.numericUpDownManualMax.Value);

                            if (cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxHTMLExportBackColorClass.Checked)
                                VSH.Chart.BackgroundColor = TmpWell.GetClassColor();
                        }

                        VSH.Chart.BinNumber = Desc.GetBinNumber();
                        VSH.Chart.IsShadow = false;
                        VSH.Chart.IsBorder = false;
                        VSH.Run();
                        ET[i].ListTags.Add((Chart)VSH.Chart);
                    }
                    else
                    {
                        cViewerHistogram VH = new cViewerHistogram();
                        VH.SetInputData(TmpET);
                        VH.Chart.LabelAxisX = Desc.GetName();
                        VH.Chart.CurrentTitle.Text = TmpET.Name;
                        if ((cGlobalInfo.OptionsWindow.radioButtonHistoDisplayManualMinMax.Checked) || (cGlobalInfo.OptionsWindow.radioButtonHistoDisplayAutomatedMinMax.Checked))
                        {
                            VH.Chart.DefaultAxisXMin = new cExtendedList();
                            VH.Chart.DefaultAxisXMin.Add((double)cGlobalInfo.OptionsWindow.numericUpDownManualMin.Value);

                            VH.Chart.DefaultAxisXMax = new cExtendedList();
                            VH.Chart.DefaultAxisXMax.Add((double)cGlobalInfo.OptionsWindow.numericUpDownManualMax.Value);

                            if (cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxHTMLExportBackColorClass.Checked)
                                VH.Chart.BackgroundColor = TmpWell.GetClassColor();
                        }

                        VH.Run();
                        ET[i].ListTags.Add((Chart)VH.Chart);
                    }
                }
            }

            MyProgressBar.Close();

            cTableToHTML TToHTML = new cTableToHTML();
            TToHTML.IsDisplayUIForFilePath = true;
            TToHTML.SetInputData(ET);

            TToHTML.Run();
        }