Beispiel #1
0
        private void ToolStripMenuItem_SaveAsHTML(object sender, EventArgs e)
        {
            cTableToHTML THTML = new cTableToHTML();
            THTML.SetInputData(this.Input);
            THTML.IsDisplayUIForFilePath = true;

            THTML.ListProperties.FindByName("Open HTML File ?").SetNewValue((bool)true);
            THTML.ListProperties.FindByName("Open HTML File ?").IsGUIforValue = true;

               // THTML.IsDisplayResult = true;
            THTML.Run();
        }
        void ToolStripMenuItem_DRCAnalysisMultiDesc_Click(object sender, EventArgs e)
        {
            List<cDescriptorType> ListSelectedDescs = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors();

            cListListWells CurrentSelectedGroups = this.BuildListListWells();

            #region select folder
            var dlg1 = new Ionic.Utils.FolderBrowserDialogEx();
            dlg1.Description = "Select the folder containing your databases.";
            dlg1.ShowNewFolderButton = true;
            dlg1.ShowEditBox = true;
            dlg1.ShowFullPathInEditBox = true;

            DialogResult result = dlg1.ShowDialog();
            if (result != DialogResult.OK) return;

            string Path = dlg1.SelectedPath;
            if (Directory.Exists(Path) == false) return;

            string FolderName = dlg1.SelectedPath;
            #endregion

            foreach (var item in ListSelectedDescs)
            {
                string TmpFolder = FolderName + "\\" + item.GetName();
                Directory.CreateDirectory(TmpFolder);

                int IdxNode = 0;

                List<cDescriptorType> ListSelectedDesc = new List<cDescriptorType>();
                ListSelectedDesc.Add(item);

                cExtendedTable TableForGeneralResuts = new cExtendedTable();
                TableForGeneralResuts.Add(new cExtendedList("p-Value"));
                TableForGeneralResuts.Add(new cExtendedList("EC50"));
                TableForGeneralResuts.Add(new cExtendedList("Slope"));
                TableForGeneralResuts.Add(new cExtendedList("Bottom"));
                TableForGeneralResuts.Add(new cExtendedList("Top"));
                TableForGeneralResuts.Add(new cExtendedList("Window"));
                TableForGeneralResuts.Add(new cExtendedList("Area Under Curve"));

                TableForGeneralResuts.ListRowNames = new List<string>();
                TableForGeneralResuts.ListTags = new List<object>();

                foreach (cListWells TmpListWells in CurrentSelectedGroups)
                {
                    // List<cDescriptorType> LType = new List<cDescriptorType>();
                    //  LType.Add(ListSelectedDesc[i]);
                    cExtendedTable CompleteTable = TmpListWells.GetAverageDescriptorValues(ListSelectedDesc, true, false);

                    //cExtendedTable CompleteTable = GLP.GetOutPut();

                    cCurveForGraph CFG = new cCurveForGraph();
                    CFG.SetInputData(CompleteTable);
                    CFG.Run();

                    cSigmoidFitting SF = new cSigmoidFitting();
                    SF.SetInputData(CompleteTable);
                    if (SF.Run().IsSucceed == false) continue;

                    // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1];

                    cANOVA A = new cANOVA();

                    cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1);
                    A.SignificanceThreshold = 1E-11;
                    A.SetInputData(NewTable);
                    A.Run();

                    cExtendedTable Sigmoid = SF.GetFittedRawValues(CFG.GetListXValues());
                    CompleteTable[0] = Sigmoid[1];
                    CompleteTable[0].Name = ListSelectedDesc[0].GetName() + "\n" + Sigmoid[1].Name;
                    cDesignerSplitter DS = new cDesignerSplitter();

                    //cViewerTableAsRichText VT = new cViewerTableAsRichText();
                    cViewerTable VT = new cViewerTable();
                    cExtendedTable TableResults = SF.GetOutPut();

                    if ((A.GetOutPut() != null) && (A.GetOutPut().Count > 0))
                    {
                        TableResults[0].Add(A.GetOutPut()[0][0]);
                        TableResults[0].Add(A.GetOutPut()[0][1]);
                        TableResults.ListRowNames.Add("p-Value");
                        TableResults.ListRowNames.Add("Rejected?");

                        TableForGeneralResuts[0].Add(A.GetOutPut()[0][0]);
                    }
                    else
                    {
                        TableForGeneralResuts[0].Add(1);
                    }

                    TableResults.Name = TV.Nodes[IdxNode].Text;
                    TableResults[0].Name = "Fitting Parameters";
                    VT.SetInputData(TableResults);
                    VT.DigitNumber = -1;
                    VT.Run();

                    cViewerGraph1D VS1 = new cViewerGraph1D();

                    cExtendedTable MyTable = new cExtendedTable(Sigmoid[1]);
                    MyTable.Name = TmpListWells.Name;// TV.Nodes[IdxNode].Text;
                    VS1.SetInputData(MyTable);
                    VS1.AddCurve(CFG);

                    VS1.Chart.X_AxisValues = Sigmoid[0];
                    VS1.Chart.IsLogAxis = true;
                    VS1.Chart.IsLine = true;
                    VS1.Chart.IsShadow = false;
                    VS1.Chart.Opacity = 210;
                    VS1.Chart.LineWidth = 3;
                    VS1.Chart.MarkerSize = 8;
                    VS1.Chart.IsDisplayValues = cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDRCDisplayValues.Checked;
                    VS1.Chart.LabelAxisX = "Concentration";
                    VS1.Chart.LabelAxisY = CompleteTable[1].Name;
                    VS1.Chart.XAxisFormatDigitNumber = cGlobalInfo.OptionsWindow.FFAllOptions.GetDRCNumberOfDigit();
                    VS1.Chart.IsZoomableX = true;

                    Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]);
                    //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/);
                    VS1.Chart.ListVerticalLines.Add(VLForEC50);

                    TableForGeneralResuts.ListRowNames.Add(TV.Nodes[IdxNode].Text);
                    TableForGeneralResuts.ListTags.Add((Chart)VS1.Chart);//ListSelectedDesc[0]);

                    //EC50
                    TableForGeneralResuts[1].Add(SF.GetOutPut()[0][2]);

                    // Slope
                    TableForGeneralResuts[2].Add(SF.GetOutPut()[0][3]);

                    // Bottom
                    TableForGeneralResuts[3].Add(SF.GetOutPut()[0][0]);

                    // Top
                    TableForGeneralResuts[4].Add(SF.GetOutPut()[0][1]);

                    // Window
                    double Window = SF.GetOutPut()[0][1] / SF.GetOutPut()[0][0];
                    TableForGeneralResuts[5].Add(Window);

                    TableForGeneralResuts[6].Add(SF.GetOutPut()[0][5]);

                    VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[CompleteTable.Count];

                    for (int IdxCurve = 0; IdxCurve < CompleteTable.Count; IdxCurve++)
                    {
                        cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign();
                        TmpSerieInfo.color = cGlobalInfo.ListCellularPhenotypes[IdxCurve % cGlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay;
                        TmpSerieInfo.markerStyle = MarkerStyle.None;

                        VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo;
                    }

                    VS1.Run();

                    //DS.SetInputData(VS1.GetOutPut());
                    //DS.SetInputData(VT.GetOutPut());
                    //DS.Orientation = Orientation.Horizontal;
                    //DS.Title = TV.Nodes[IdxNode++].Text; //TmpListWells.ti;// ListSelectedDesc[0].GetName();
                    //DS.Run();

                    IdxNode++;

                    //   DT.SetInputData(DS.GetOutPut());
                }
                cTableToHTML THTML = new cTableToHTML();
                TableForGeneralResuts.Name = item.GetName();
                THTML.SetInputData(TableForGeneralResuts);
                THTML.IsDisplayUIForFilePath = false;
                THTML.FolderName = TmpFolder;

                THTML.ListProperties.FindByName("Open HTML File ?").SetNewValue((bool)false);
                THTML.ListProperties.FindByName("Open HTML File ?").IsGUIforValue = false;

                THTML.Run();
            }

            System.Diagnostics.Process.Start(FolderName);
        }
Beispiel #3
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();
        }