示例#1
0
        /// <summary>
        /// LoadORFButton Click event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadORFButton_Click(object sender, RoutedEventArgs e)
        {
            // extensions setting
            extensions = "Fasta files|*.fa;*.fas;*.fasta";
            // openFileDialog method initialization
            initializeOpenFileDialog(extensions);

            // show openFileDialog file dialog
            Nullable <bool> openResult = openFileDialog.ShowDialog();

            if (openResult == true)
            {
                //new ORF object
                ORF = new ORF();

                file_seq = openFileDialog.FileName; // file handler
                // sequenceParser method initialization
                var tupleTemp = SeqParser.sequenceParser(file_seq);

                if (tupleTemp.Item2 != 1)
                {
                    string message = "Something went wrong. Probably you tried to use an improper file. Try again. \nFor more information about using Codon Context Ranking check the \"How to use\" page.";
                    ModernDialog.ShowMessage(message.ToString(), "Warning", MessageBoxButton.OK);
                }
                else
                {
                    ORF.orfSeq      = tupleTemp.Item1;
                    ORF.aminoORFseq = SeqParser.codonToAminoParser(ORF.orfSeq);
                    CalculateAndDisplayORF(ORF.orfSeq, ORF.aminoORFseq);
                    // Enabling checkboxes and button
                    MaximalizeRadioButton.IsEnabled = true;
                    MinimalizeRadioButton.IsEnabled = true;
                    OptimizeORFButton.IsEnabled     = true;
                }
            }
            else
            {
                // modern dialog initialization
                string message = "Something went wrong. Probably you tried to use an improper file. Try again. \nFor more information about using Optimalizator check the \"How to use\" page.";
                ModernDialog.ShowMessage(message.ToString(), "Warning", MessageBoxButton.OK);
            }
        }
        /// <summary>
        /// addORFeomeButton click event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddORFeomeButton_Click(object sender, RoutedEventArgs e)
        {
            // richTextBox cleaning
            ORFeomeInfoRichTextBox.Document.Blocks.Clear();
            CCranker = new CCranker();

            // openFileDialog method initialization
            OpenFileDialogInitialize();

            // show openFileDialog file dialog
            Nullable <bool> openResult = openFileDialog.ShowDialog();

            //if (openResult == true)
            //{
            string file = openFileDialog.FileName;     // file handler

            // sequenceParser method initialization
            var tupleTemp = SeqParser.sequenceParser(file);

            CCranker.orfeome  = tupleTemp.Item1;
            CCranker.cdsCount = tupleTemp.Item2;

            // adding information to ORFeomeInfoRichTextBox
            if (CCranker.cdsCount != 0)
            {
                ORFeomeInfoRichTextBox.AppendText(CCranker.cdsCount.ToString());
            }

            /*}
             * else
             * {
             *  // modern dialog initialization
             *  string message = "Something went wrong. Probably you tried to use an improper file. Try again. \nFor more information about using Codon Context Ranking check the \"How to use\" page.";
             *  ModernDialog.ShowMessage(message.ToString(), "Warning", MessageBoxButton.OK);
             * }*/
        }