private void findPathwayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (CompleteScreening == null) return;
            FormForNameRequest FormForRequest = new FormForNameRequest();
            if (FormForRequest.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
            int NumberOfPlates = CompleteScreening.ListPlatesActive.Count;

            FormForKeggGene KeggWin = new FormForKeggGene();
            KEGG ServKegg = new KEGG();
            string[] intersection_gene_pathways = new string[1];

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

            string[] fg_list = { "black" };
            string[] bg_list = { "orange" };

            string pathway_map_html = "";
            //  KEGG ServKegg = new KEGG();
            string[] ListGenesinPathway = ServKegg.get_genes_by_pathway("path:" + Pathways[0]);
            if (ListGenesinPathway.Length == 0)
            {
                return;
            }
            double[] ListValues = new double[ListGenesinPathway.Length];
            int IDxGeneOfInterest = 0;
            foreach (cPlate CurrentPlate in CompleteScreening.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[CompleteScreening.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)((((CompleteScreening.GlobalInfo.LUTs.LUT_GREEN_TO_RED[0].Length - 1) * (ListValues[IdxCol] - MinValue)) / (MaxValue - MinValue)));

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

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

            }

            //  foreach (string item in ListP.listBoxPathways.SelectedItems)
            {
                pathway_map_html = ServKegg.get_html_of_colored_pathway_by_objects(Pathways[0], ListGenesinPathway, fg_list, bg_list);
            }

            pathway_map_html = ServKegg.get_html_of_colored_pathway_by_objects((string)(Pathways[0]), 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();
        }
Example #2
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();
        }
Example #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();
        //}
        void DisplayPathways(object sender, EventArgs e)
        {
            object ValObj = this.ListProperties.FindValueByName("Locus ID");
            if (ValObj == null) return;

            int LocusID = (int)ValObj;

            List<string> Pathways2 = null;
            try
            {
                Pathways2 = HCSAnalyzer.HCSAnalyzer.Find_Pathways(LocusID); //appel de la function static je ne sais pas pourquoi elle doit etre static…
            }
            catch (Exception)
            {
                MessageBox.Show("No pathway founded !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (Pathways2.Count > 0)
            {
                string getvars2 = "/get/hsa:" + LocusID;
                HttpWebRequest req2 = WebRequest.Create(string.Format("http://rest.kegg.jp" + getvars2)) as HttpWebRequest;
                req2.Method = "GET";

                HttpWebResponse response = req2.GetResponse() as HttpWebResponse;
                StreamReader reader2 = new StreamReader(response.GetResponseStream());

                string GenInfo = reader2.ReadToEnd();

                reader2.Close();

                foreach (string item in Pathways2)
                {
                    FormForKeggGene KeggWin = new FormForKeggGene();

                    KeggWin.webBrowser.Navigate("http://www.kegg.jp/kegg-bin/show_pathway?" + item + "/default%3dpink/" + "hsa:" + LocusID + "%09,blue");
                    KeggWin.richTextBox.Text = GenInfo;
                    KeggWin.Text = "Gene Infos";
                    KeggWin.Show();
                }
                response.Close();
            }
            else
            {
                MessageBox.Show("No pathway founded !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }