private void button2_Click(object sender, EventArgs e)
        {
            List <string> lstAttributes = new List <string>();

            foreach (object item in listBox2.Items)
            {
                lstAttributes.Add(item.ToString());
            }
            DataTableEncodingManager encodingManager = new DataTableEncodingManager(_EncodingDictionary, lstAttributes, _DataTableToEncode, checkBox1.Checked, checkBox2.Checked);

            encodingManager.EncodingCompleted += new WorkerCompletedEventHandler(encodingManager_EncodingCompleted);
            encodingManager.EncodingProgress  += new WorkerProgressUpdateEventHandler(encodingManager_EncodingProgress);
            encodingManager.Run();
        }
Exemple #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            //Perform Prediction
            CreateNeuralNetwork();

            DataTable dt = new DataTable("Runtime Result");

            dt.Columns.Add("Pattern");
            dt.Columns.Add("Position");
            dt.Columns.Add("Prediction");

            DataTable     peptideDataTable;
            List <string> listOfTargetResidue = new List <string>();

            listOfTargetResidue.Add(txtTargetResidues.Text);
            int sizeOfPeptide = int.Parse(textBox2.Text);

            peptideDataTable = ResidueBasedPeptideGenerator.ExtractPeptide(txtSequence.Text, listOfTargetResidue, sizeOfPeptide, false);

            List <string> listOfInputAttributesStringCollectionType = new List <string>();
            List <string> listOfInputAttributesListType             = new List <string>();

            for (int index = (-1 * sizeOfPeptide); index <= sizeOfPeptide; index++)
            {
                listOfInputAttributesStringCollectionType.Add("P" + index.ToString());
                listOfInputAttributesListType.Add("P" + index.ToString());
            }

            DataTableEncodingManager encodingManager = new DataTableEncodingManager(codeDictionary, listOfInputAttributesListType, peptideDataTable, true, true);

            encodingManager.Run();
            DataTable encodedPeptideDataTable = encodingManager._EncodedDataTable;

            int binaryStringLenghtPepAminoAcid = 0;

            foreach (object key in codeDictionary.Keys)
            {
                if (codeDictionary[key.ToString()].Length > binaryStringLenghtPepAminoAcid)
                {
                    binaryStringLenghtPepAminoAcid = codeDictionary[key.ToString()].Length;
                }
            }

            listOfInputAttributesStringCollectionType = new List <string>();
            int ctr;

            for (int index = (-1 * sizeOfPeptide); index <= sizeOfPeptide; index++)
            {
                for (ctr = 1; ctr <= binaryStringLenghtPepAminoAcid; ctr++)
                {
                    listOfInputAttributesStringCollectionType.Add("P" + index.ToString() + "_" + ctr.ToString());
                }
            }

            runtimeEngine = new RuntimeEngine(1, ANN, listOfInputAttributesStringCollectionType);
            DataRow row;
            string  pattern;

            float predictedValue;
            float patternIndex = 1;
            float totalPattern = encodedPeptideDataTable.Rows.Count;

            richTextBox1.Text = "Prediction Evaluation Started...";
            DataRow encodedPatternRrow;
            DataRow patternRow;

            dataGridView2.DataSource = encodedPeptideDataTable;
            for (patternIndex = 0; patternIndex < totalPattern; patternIndex++)
            {
                encodedPatternRrow = encodedPeptideDataTable.Rows[(int)patternIndex];
                patternRow         = peptideDataTable.Rows[(int)patternIndex];
                pattern            = "";
                for (ctr = 0; ctr < listOfInputAttributesListType.Count; ctr++)
                {
                    pattern = pattern + patternRow[listOfInputAttributesListType[ctr]].ToString();
                }
                //row
                runtimeEngine.PatternRow = encodedPatternRrow;
                predictedValue           = runtimeEngine.Run();
                row               = dt.NewRow();
                row["Pattern"]    = pattern;
                row["Prediction"] = predictedValue.ToString();
                row["Position"]   = patternRow["Position"].ToString();
                dt.Rows.Add(row);
                SetMessage(pattern + " => " + predictedValue.ToString());
                richTextBox1.Text = Convert.ToString((patternIndex + 1)) + " - " + pattern + " => " + predictedValue.ToString() + Environment.NewLine;
            }
            dataGridView2.DataSource = dt;
        }