Пример #1
0
        void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string[] fg_list = { "black" };
            string[] bg_list = { "orange" };
            string[] intersection_gene_pathways = new string[1];

            intersection_gene_pathways[0] = "hsa:" + LocusID;

            string pathway_map_html = "";
            KEGG ServKegg = new KEGG();
            foreach (string item in ListP.listBoxPathways.SelectedItems)
            {
                pathway_map_html = ServKegg.get_html_of_colored_pathway_by_objects(item, intersection_gene_pathways, fg_list, bg_list);
            }

            string GenInfo = ServKegg.bget((string)ListP.listBoxPathways.SelectedItem);
            string[] Genes = GenInfo.Split(new char[] { '\n' });
            string Res = "";
            foreach (string item in Genes)
            {
                string[] fre = item.Split(' ');
                string[] STRsection = fre[0].Split('_');

                if (STRsection[0] != "NAME") continue;

                for (int i = 1; i < fre.Length; i++)
                {
                    if (fre[i] == "") continue;
                    Res += fre[i] + " ";
                }
            }

            FormForKegg KeggWin = new FormForKegg();

            if (pathway_map_html.Length == 0) return;

            KeggWin.Text = Res;
            KeggWin.Show();

            KeggWin.webBrowser.Navigate(pathway_map_html);
        }
Пример #2
0
        private FormForPie PathWayAnalysis(int Class)
        {
            //int Idx = 0;
            int NumberOfPlates = CompleteScreening.ListPlatesActive.Count;

            KEGG ServKegg = new KEGG();

            List<cPathWay> ListPathway = new List<cPathWay>();

            // loop on all the plate
            for (int PlateIdx = 0; PlateIdx < NumberOfPlates; PlateIdx++)
            {
                cPlate CurrentPlateToProcess = CompleteScreening.ListPlatesActive.GetPlate(CompleteScreening.ListPlatesActive[PlateIdx].Name);

                for (int IdxValue = 0; IdxValue < CompleteScreening.Columns; IdxValue++)
                    for (int IdxValue0 = 0; IdxValue0 < CompleteScreening.Rows; IdxValue0++)
                    {
                        cWell TmpWell = CurrentPlateToProcess.GetWell(IdxValue, IdxValue0, true);
                        if ((TmpWell == null) || (TmpWell.GetClass() != Class) || (TmpWell.LocusID == -1)) continue;

                        string[] intersection_gene_pathways = new string[1];
                        intersection_gene_pathways[0] = "hsa:" + TmpWell.LocusID;
                        string[] Pathways = ServKegg.get_pathways_by_genes(intersection_gene_pathways);
                        if ((Pathways == null) || (Pathways.Length == 0)) continue;

                        for (int Idx = 0; Idx < Pathways.Length; Idx++)
                        {
                            //  string PathName = Pathways[Idx].Remove(0, 8);
                            string GenInfo = ServKegg.bget(Pathways[Idx]);
                            string[] Genes = GenInfo.Split(new char[] { '\n' });
                            string PathName = "";
                            foreach (string item in Genes)
                            {
                                string[] fre = item.Split(' ');
                                string[] STRsection = fre[0].Split('_');

                                if (STRsection[0] == "NAME")
                                {
                                    for (int i = 1; i < fre.Length; i++)
                                    {
                                        if (fre[i] == "") continue;
                                        PathName += fre[i] + " ";
                                    }
                                    break;
                                }
                            }

                            if (ListPathway.Count == 0)
                            {
                                cPathWay CurrPath = new cPathWay();
                                CurrPath.Name = PathName;
                                CurrPath.Occurence = 1;
                                ListPathway.Add(CurrPath);
                                continue;
                            }

                            bool DidIt = false;
                            for (int i = 0; i < ListPathway.Count; i++)
                            {
                                if (PathName == ListPathway[i].Name)
                                {
                                    ListPathway[i].Occurence++;
                                    DidIt = true;
                                    break;
                                }
                            }

                            if (DidIt == false)
                            {
                                cPathWay CurrPath1 = new cPathWay();
                                CurrPath1.Name = PathName;
                                CurrPath1.Occurence = 1;
                                ListPathway.Add(CurrPath1);
                            }
                        }
                    }
            }

            // now draw the pie
            if (ListPathway.Count == 0)
            {
                MessageBox.Show("No pathway identified !", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return null;

            }
            FormForPie Pie = new FormForPie();

            Series CurrentSeries = Pie.chartForPie.Series[0];

            // loop on all the plate
            int MaxOccurence = int.MinValue;
            int MaxIdx = 0;
            int TotalOcurrence = 0;
            for (int Idx = 0; Idx < ListPathway.Count; Idx++)
            {
                if (ListPathway[Idx].Occurence > MaxOccurence)
                {
                    MaxOccurence = ListPathway[Idx].Occurence;
                    MaxIdx = Idx;
                }
                TotalOcurrence += ListPathway[Idx].Occurence;
            }

            //CurrentSeries.CustomProperties = "PieLabelStyle=Outside";
            for (int Idx = 0; Idx < ListPathway.Count; Idx++)
            {
                CurrentSeries.Points.Add(ListPathway[Idx].Occurence);
                CurrentSeries.Points[Idx].Label = String.Format("{0:0.###}", ((100.0 * ListPathway[Idx].Occurence) / TotalOcurrence)) + " %";

                CurrentSeries.Points[Idx].LegendText = ListPathway[Idx].Name;
                CurrentSeries.Points[Idx].ToolTip = ListPathway[Idx].Name;
                if (Idx == MaxIdx)
                    CurrentSeries.Points[Idx].SetCustomProperty("Exploded", "True");
            }

            return Pie;
        }
Пример #3
0
        void DisplayPathways(object sender, EventArgs e)
        {
            if (LocusID == -1) return;
            FormForKeggGene KeggWin = new FormForKeggGene();
            KEGG ServKegg = new KEGG();
            string[] intersection_gene_pathways = new string[1];

            intersection_gene_pathways[0] = "hsa:" + LocusID;
            string[] Pathways = ServKegg.get_pathways_by_genes(intersection_gene_pathways);
            if ((Pathways == null) || (Pathways.Length == 0))
            {
                MessageBox.Show("No pathway founded !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string GenInfo = ServKegg.bget(intersection_gene_pathways[0]);

            // FormForPathway PathwaysGenes = new FormForPathway();

            KeggWin.richTextBox.Text = GenInfo;
            KeggWin.Text = "Gene Infos";
            //PathwaysGenes.Show();
            ListP = new FormForPathway();

            ListP.listBoxPathways.DataSource = Pathways;

            ListP.Text = this.Name;
            ListP.Show();
            //foreach (string item in Pathways)
            //{
            //     string PathwayInfo = ServKegg.bget(item);
            //     FormPathwaysGenes PathwaysGenes = new FormPathwaysGenes();

            //     PathwaysGenes.richTextBox1.Text = PathwayInfo;
            //     PathwaysGenes.Text = "Pathways Infos";
            //     PathwaysGenes.Show();

            //}

            string[] fg_list = { "black" };
            string[] bg_list = { "orange" };
            // string[] intersection_gene_pathways = new string[1];

            // intersection_gene_pathways[0] = "hsa:" + LocusID;

            string pathway_map_html = "";
            //  KEGG ServKegg = new KEGG();

            pathway_map_html = ServKegg.get_html_of_colored_pathway_by_objects((string)(ListP.listBoxPathways.SelectedItem), intersection_gene_pathways, fg_list, bg_list);

            // FormForKegg KeggWin = new FormForKegg();
            if (pathway_map_html.Length == 0) return;

            //
            //KeggWin.Show();
            ListP.listBoxPathways.MouseDoubleClick += new MouseEventHandler(listBox1_MouseDoubleClick);
            KeggWin.webBrowser.Navigate(pathway_map_html);

            KeggWin.Show();
        }
Пример #4
0
        void listBox1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string[] fg_list = { "black" };
            string[] bg_list = { "orange" };
            string[] intersection_gene_pathways = new string[1];

            intersection_gene_pathways[0] = "hsa:" + LocusID;

            string pathway_map_html = "";
            KEGG ServKegg = new KEGG();

            string[] ListGenesinPathway = ServKegg.get_genes_by_pathway((string)ListP.listBoxPathways.SelectedItem);
            double[] ListValues = new double[ListGenesinPathway.Length];
            int IDxGeneOfInterest = 0;
            foreach (cPlate CurrentPlate in Parent.ListPlatesActive)
            {
                foreach (cWell CurrentWell in CurrentPlate.ListActiveWells)
                {
                    string CurrentLID = "hsa:" + (int)CurrentWell.LocusID;

                    for (int IdxGene = 0; IdxGene < ListGenesinPathway.Length; IdxGene++)
                    {

                        if (CurrentLID == intersection_gene_pathways[0])
                            IDxGeneOfInterest = IdxGene;

                        if (CurrentLID == ListGenesinPathway[IdxGene])
                        {
                            ListValues[IdxGene] = CurrentWell.ListDescriptors[Parent.ListDescriptors.CurrentSelectedDescriptor].GetValue();
                            break;
                        }
                    }
                }
            }

            bg_list = new string[ListGenesinPathway.Length];
            fg_list = new string[ListGenesinPathway.Length];

            double MinValue = ListValues.Min();
            double MaxValue = ListValues.Max();

            for (int IdxCol = 0; IdxCol < bg_list.Length; IdxCol++)
            {

                int ConvertedValue = (int)((((Parent.GlobalInfo.LUTs.LUT_JET[0].Length - 1) * (ListValues[IdxCol] - MinValue)) / (MaxValue - MinValue)));

                Color Coul = Color.FromArgb(Parent.GlobalInfo.LUTs.LUT_JET[0][ConvertedValue], Parent.GlobalInfo.LUTs.LUT_JET[1][ConvertedValue], Parent.GlobalInfo.LUTs.LUT_JET[2][ConvertedValue]);

                if (IdxCol == IDxGeneOfInterest)
                    fg_list[IdxCol] = "white";
                else
                    fg_list[IdxCol] = "#000000";
                bg_list[IdxCol] = "#" + Coul.Name.Remove(0, 2);

            }

            pathway_map_html = ServKegg.get_html_of_colored_pathway_by_objects((string)ListP.listBoxPathways.SelectedItem, ListGenesinPathway, fg_list, bg_list);

            string GenInfo = ServKegg.bget((string)ListP.listBoxPathways.SelectedItem);
            string[] Genes = GenInfo.Split(new char[] { '\n' });
            string Res = "";
            foreach (string item in Genes)
            {
                string[] fre = item.Split(' ');
                string[] STRsection = fre[0].Split('_');

                if (STRsection[0] != "NAME") continue;

                for (int i = 1; i < fre.Length; i++)
                {
                    if (fre[i] == "") continue;
                    Res += fre[i] + " ";
                }
            }

            FormForKegg KeggWin = new FormForKegg();

            if (pathway_map_html.Length == 0) return;

            KeggWin.Text = Res;
            KeggWin.Show();

            KeggWin.webBrowser.Navigate(pathway_map_html);
        }