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
        /// <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 #3
0
        void LoadProperty()
        {
            cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty();
            GUI_ListWellProperty.IsCheckBoxes = false;

            if (GUI_ListWellProperty.Run().IsSucceed == false) return;
            List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut();

            cCSVToTable CSVT = new cCSVToTable();
            CSVT.IsDisplayUIForFilePath = true;
            CSVT.IsContainRowNames = true;
            CSVT.IsContainColumnHeaders = true;
            CSVT.AddAsObject = true;
            CSVT.Run();

            cExtendedTable PlateDesign = CSVT.GetOutPut();
            if (PlateDesign == null) return;


            cListPlates LP = new cListPlates();

            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                LP = cGlobalInfo.CurrentScreening.ListPlatesActive;
            }
            else
            {
                cGUI_ListPlates GUIListPlate = new cGUI_ListPlates();
                if (GUIListPlate.Run().IsSucceed == false) return;
                LP = GUIListPlate.GetOutPut();
            }


            for (int Col = 0; Col < cGlobalInfo.CurrentScreening.Columns; Col++)
                for (int Row = 0; Row < cGlobalInfo.CurrentScreening.Rows; Row++)
                {
                    if ((Col < PlateDesign.Count) && (Row < PlateDesign[Col].ListTags.Count))
                    {
                        object TmpObj = PlateDesign[Col].ListTags[Row];

                        //string TmpVal = "";

                        //if (TmpObj != null)
                        //    TmpVal = (string)TmpObj;

                        foreach (cPlate CurrentPlate in LP)
                        {
                            cWell TmpWell = CurrentPlate.GetWell(Col, Row, false);
                            if ((TmpWell != null))
                            {
                                if (TmpObj == null)
                                {
                                    TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null);
                                }
                                else
                                {
                                    if (/*(TmpObj.GetType() == typeof(string)) &&*/ (ListSelectedProp[0].Type == eDataType.STRING))
                                        TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (string)TmpObj);
                                    else if (/*(TmpObj.GetType() == typeof(double)) &&*/ (ListSelectedProp[0].Type == eDataType.DOUBLE))
                                    {
                                        double Res;
                                        if (double.TryParse((string)TmpObj, out Res))
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, Res);
                                        else
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null);
                                    }
                                    else if (/*(TmpObj.GetType() == typeof(int)) &&*/ (ListSelectedProp[0].Type == eDataType.INTEGER))
                                    {
                                        int IntRes;
                                        if (int.TryParse((string)TmpObj, out IntRes))
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, IntRes);
                                        else
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null);

                                    }
                                }

                                // TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (int)Convert.ToDouble(TmpObj.ToString()));

                                //else if (TmpObj.GetType() == typeof(int) && (ListSelectedProp[0].Type == eDataType.INTEGER))
                                //  TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (int)TmpObj);
                            }

                        }
                    }
                }

            richTextBoxConsole.AppendText(LP.Count + " plates updated !\n");

            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false);

        }
Exemple #4
0
        private void copyPropertyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (cGlobalInfo.CurrentScreening == null) return;

            cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty();
            GUI_ListWellProperty.IsCheckBoxes = false;
            if (GUI_ListWellProperty.Run().IsSucceed == false) return;
            List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut();

            cListPlates LP = new cListPlates();

            if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cGUI_ListPlates GUI_ListPlates = new cGUI_ListPlates();
                GUI_ListPlates.IsCheckBoxes = true;
                cFeedBackMessage FBM = GUI_ListPlates.Run();
                cGlobalInfo.WindowHCSAnalyzer.richTextBoxConsole.AppendText(FBM.Message);
                if (!FBM.IsSucceed) return;

                LP = GUI_ListPlates.GetOutPut();
            }
            else if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            }
            else
            {
                LP = cGlobalInfo.CurrentScreening.ListPlatesActive;
            }

            cGlobalInfo.CurrentScreening.CopyPropertyToClipBoard(ListSelectedProp, LP);
        }