コード例 #1
0
        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();
        }
コード例 #2
0
ファイル: cWell.cs プロジェクト: HCSAnalyzer/HCS-Analyzer
        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);
        }