예제 #1
0
        private void findGeneToolStripMenuItem_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;

            // 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) continue;

                        if (TmpWell.Name == FormForRequest.textBoxForName.Text)
                        {

                            CurrentPlateToProcess.DisplayDistribution(CompleteScreening.ListDescriptors.CurrentSelectedDescriptor, false);
                            int Col = IdxValue + 1;
                            int row = IdxValue0 + 1;
                            MessageBox.Show("Column " + Col + " x Row " + row, TmpWell.Name, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
            }

            MessageBox.Show("Gene not found !", FormForRequest.textBoxForName.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
예제 #2
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();
        }
예제 #3
0
        private void SingleCellOperationPhenotypToDesc(object sender, EventArgs e)
        {
            string description = "This descriptor has been generated by converting single cell phenotypic class into feature\n";

            FormForNameRequest FFNR = new FormForNameRequest();
            FFNR.Text = "Descriptor Name";
            FFNR.textBoxForName.Text = "Phenotype Class";
            if (FFNR.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
            if (FFNR.textBoxForName.Text == "") return;

            cDescriptorType NewDescType = new cDescriptorType(FFNR.textBoxForName.Text, true, cGlobalInfo.ListCellularPhenotypes.Count, true);
            cGlobalInfo.CurrentScreening.ListDescriptors.AddNew(NewDescType);

            FormForProgress ProgressWindow = new FormForProgress();
            ProgressWindow.Show();

            int IdxProgress = 0;
            int MaxProgress = 0;

            foreach (cPlate CurrentPlateToProcess in cGlobalInfo.CurrentScreening.ListPlatesAvailable)
                MaxProgress += (int)CurrentPlateToProcess.ListActiveWells.Count;

            ProgressWindow.progressBar.Maximum = MaxProgress;

            foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesAvailable)
            {
                CurrentPlate.DBConnection.OpenConnection();

                CurrentPlate.DBConnection.CreateNewColumnFromExisting(NewDescType, "Phenotype_Class", GlobalInfo, ref CurrentPlate.ListActiveWells);

                CurrentPlate.DBConnection.CloseConnection();
                ProgressWindow.progressBar.Value = IdxProgress++;
                ProgressWindow.progressBar.Refresh();
            }

            ProgressWindow.Close();
            int IdxNull = 0;
            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
            {
                foreach (cWell TmpWell in TmpPlate.ListActiveWells)
                    if (TmpWell.ListSignatures.Count != cGlobalInfo.CurrentScreening.ListDescriptors.Count)
                        IdxNull++;
            }
            if (IdxNull > 0)
                System.Windows.Forms.MessageBox.Show("List signature count is different from list descriptor count", "Critical Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);

            cGlobalInfo.CurrentScreening.ListDescriptors.UpDateDisplay();
            //  CompleteScreening.UpDatePlateListWithFullAvailablePlate();

            for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesAvailable.Count; idxP++)
                cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax();

            StartingUpDateUI();

            this.toolStripcomboBoxPlateList.Items.Clear();

            for (int IdxPlate = 0; IdxPlate < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; IdxPlate++)
            {
                string Name = cGlobalInfo.CurrentScreening.ListPlatesActive.GetPlate(IdxPlate).GetName();
                this.toolStripcomboBoxPlateList.Items.Add(Name);
                PlateListWindow.listBoxPlateNameToProcess.Items.Add(Name);
                PlateListWindow.listBoxAvaliableListPlates.Items.Add(Name);
            }
            cGlobalInfo.CurrentScreening.CurrentDisplayPlateIdx = 0;
            cGlobalInfo.CurrentScreening.SetSelectionType(comboBoxClass.SelectedIndex - 1);

            UpdateUIAfterLoading();

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