コード例 #1
0
        public PeptideExtractionManager(int sizeOfOneSide, DataTable dtSource, string nameOfPIDFieldName, string nameOfSequenceFeild, bool isExtendedSequenceField, string nameOfPositionFeild, bool markClassificationLabel, string classificationLabel)
        {
            _SizeOfOneSide           = sizeOfOneSide;
            _SourceDataTable         = dtSource;
            _IsExtendedSequence      = isExtendedSequenceField;
            _NameOfPositionFeildName = nameOfPositionFeild;
            _NamePIDFeildName        = nameOfPIDFieldName;
            _NameOfSequenceFeildName = nameOfSequenceFeild;
            _ClassificationLabel     = classificationLabel;
            _MarkClassificationLabel = markClassificationLabel;

            _PeptideDataTable = new DataTable("Peptides");
            _PeptideDataTable.Columns.Add("PeptideID");
            _PeptideDataTable.Columns.Add("ExtendedSequence");
            if (_MarkClassificationLabel == true)
            {
                _PeptideDataTable.Columns.Add("Class");
            }

            PeptideExtractionCompletedEventArg = new WorkerCompletedEventArg();
            PeptideExtractionProgressEventArg  = new WorkerProgressEventArg();

            for (index = (-1 * _SizeOfOneSide); index <= _SizeOfOneSide; index++)
            {
                _PeptideDataTable.Columns.Add("P" + index.ToString());
            }
        }
コード例 #2
0
        public void Run()
        {
            int     rowIndex;
            DataRow row;
            int     totalRows;
            float   progress;
            int     tableIndex = 0;

            foreach (DataTable dt in _ListOfDataTables)
            {
                tableIndex++;
                totalRows = dt.Rows.Count;
                for (rowIndex = 0; rowIndex < totalRows; rowIndex++)
                {
                    row = dt.Rows[rowIndex];
                    _MegeredDataTable.ImportRow(row);
                    progress = (((float)(rowIndex + 1)) / ((float)(totalRows)) * 100);
                    if (ProgressUpdate != null)
                    {
                        ProgressArg.ProgressPercentage = progress;
                        ProgressArg.UserState          = "Merging table no. " + tableIndex.ToString();
                        ProgressUpdate(this, ProgressArg);
                    }
                }
            }

            if (ProgressCompleted != null)
            {
                WorkerCompletedEventArg e = new WorkerCompletedEventArg();
                e.Result           = _MegeredDataTable;
                e.UserStateMessage = "Finished";
                ProgressCompleted(this, e);
            }
        }
コード例 #3
0
        public NeuralNetwork(int id)
        {
            ID = id;

            NeuralNetworkTaskCompletedArgs = new WorkerCompletedEventArg();
            NeuralNetworkTaskProgressArgs  = new WorkerProgressEventArg();
            NeuralNetworkTaskStartedArgs   = new WorkerStartedEventArg();
        }
コード例 #4
0
 void dtmanager_ProgressCompleted(object sender, WorkerCompletedEventArg e)
 {
     _MergedDataTable         = (DataTable)e.Result;
     dataGridView2.DataSource = _MergedDataTable;
     lblStatus.Text           = "Total Merged Records: " + _MergedDataTable.Rows.Count.ToString();
     progressBar1.Value       = 0;
     Application.DoEvents();
 }
コード例 #5
0
ファイル: Form1.cs プロジェクト: wmqazi/ML_BootStrapping
        void _BootStrapAgent_SamplingCompleted(object sender, WorkerCompletedEventArg e)
        {
            lblStatus.Text = "Bootstrapping Done...";

            _TrainingDataTable   = _BootStrapAgent.TrainingDataTable;
            _ValidationDataTable = _BootStrapAgent.ValidateDataTable;

            gridTraining.DataSource       = _TrainingDataTable;
            gridValidaton.DataSource      = _ValidationDataTable;
            lblTrainingRecordCount.Text   = _BootStrapAgent.TrainingDataTable.Rows.Count.ToString();
            lblValidationRecordCount.Text = _BootStrapAgent.ValidateDataTable.Rows.Count.ToString();
        }
コード例 #6
0
 void encodingManager_EncodingCompleted(object sender, WorkerCompletedEventArg e)
 {
     _EncodedTable                   = (DataTable)e.Result;
     dataGridView3.DataSource        = _EncodedTable;
     lblEncodedTableRecordCount.Text = _EncodedTable.Rows.Count.ToString();
 }
コード例 #7
0
 void _ProteinDataSeperator_SeperationCompleted(object sender, WorkerCompletedEventArg e)
 {
     lblStatus.Text = "Done";
     Application.DoEvents();
 }
コード例 #8
0
        public void Run()
        {
            if (SeperationStarted != null)
            {
                SeperationStarted(this);
            }

            SeperationEventArgs         = new WorkerCompletedEventArg();
            SeperationProgressEventArgs = new WorkerProgressEventArg();

            int    total = _SiteDataTable.Rows.Count;
            string positionString;
            string pid;
            string sequence;
            int    position;

            _ProteinDataTable = new DataTable("ProteinDataTable");
            _ProteinDataTable.Columns.Add("PID");
            _ProteinDataTable.Columns.Add("Sequence");
            _ProteinDataTable.Columns.Add("SequenceLength");
            _ProteinDataTable.Columns.Add("Position");
            DataRow row;
            Dictionary <string, string>      proteinSequenceDictionary;
            Dictionary <string, List <int> > proteinPositionDictionary;

            proteinPositionDictionary = new Dictionary <string, List <int> >();
            proteinSequenceDictionary = new Dictionary <string, string>();
            int index;

            if (SeperationProgressUpdate != null)
            {
                SeperationProgressEventArgs.ProgressPercentage = 0;
                SeperationProgressEventArgs.UserState          = "Extracting and Grouping Protein's Sequence and Position Related Data";
                SeperationProgressUpdate(this, SeperationProgressEventArgs);
            }
            for (index = 0; index < total; index++)
            {
                row = _SiteDataTable.Rows[index];
                pid = row[_PIDFieldName].ToString();
                if (proteinSequenceDictionary.ContainsKey(pid) == false)
                {
                    sequence = row[_SequenceFieldName].ToString();
                    proteinSequenceDictionary.Add(pid, sequence);
                    proteinPositionDictionary.Add(pid, new List <int>());
                }

                position = int.Parse(row[_PositionFieldName].ToString());
                //if (proteinPositionDictionary[pid] == null)
                //  proteinPositionDictionary[pid] = new List<int>();

                if (proteinPositionDictionary[pid].Contains(position) == false)
                {
                    proteinPositionDictionary[pid].Add(position);
                }

                if (SeperationProgressUpdate != null)
                {
                    SeperationProgressEventArgs.ProgressPercentage = (float)(((float)index / (float)total) * 100.00f);
                    SeperationProgressEventArgs.UserState          = "Extracting and Grouping Protein's Sequence and Position Related Data";
                    SeperationProgressUpdate(this, SeperationProgressEventArgs);
                }
            }

            total = proteinPositionDictionary.Keys.Count;
            index = 1;
            int        ctr;
            List <int> positionList;


            if (SeperationProgressUpdate != null)
            {
                SeperationProgressEventArgs.ProgressPercentage = 0.00f;
                SeperationProgressEventArgs.UserState          = "Preparing Protein Profiles and Importing Them to DataTable";
                SeperationProgressUpdate(this, SeperationProgressEventArgs);
            }
            foreach (string id in proteinSequenceDictionary.Keys)
            {
                positionString = "";
                positionList   = proteinPositionDictionary[id];
                positionList.Sort();
                for (ctr = 0; ctr < positionList.Count; ctr++)
                {
                    position       = positionList[ctr];
                    positionString = positionString + position.ToString();
                    if (ctr != (positionList.Count - 1))
                    {
                        positionString = positionString + ",";
                    }
                }
                row                   = _ProteinDataTable.NewRow();
                row["PID"]            = id;
                row["Sequence"]       = proteinSequenceDictionary[id];
                row["SequenceLength"] = proteinSequenceDictionary[id].Length;
                row["Position"]       = positionString;
                _ProteinDataTable.Rows.Add(row);
                if (SeperationProgressUpdate != null)
                {
                    SeperationProgressEventArgs.ProgressPercentage = (float)(((float)index / (float)total) * 100.00f);
                    SeperationProgressEventArgs.UserState          = "Preparing Protein Profiles and Importing Them to DataTable";
                    SeperationProgressUpdate(this, SeperationProgressEventArgs);
                }
                index++;
            }

            if (SeperationCompleted != null)
            {
                SeperationCompleted(this, null);
            }
        }
コード例 #9
0
 void _PeptideExtractionManager_PeptideExtractionCompleted(object sender, WorkerCompletedEventArg e)
 {
     lblStatus.Text          = "Peptde Extraction Done...";
     gridPeptides.DataSource = _PeptideExtractionManager.PeptideDataTable;
 }
コード例 #10
0
        public void Run()
        {
            ProgressArgs = new WorkerProgressEventArg();
            int ctr;

            if (_UseBinarySplitMode == true)
            {
                sizeOfCodeString = 0;

                foreach (string key in _EncodingDictionary.Keys)
                {
                    if (sizeOfCodeString <= _EncodingDictionary[key].Length)
                    {
                        sizeOfCodeString = _EncodingDictionary[key].Length;
                    }
                }


                _EncodedDataTable = new DataTable("Encoded");
                string columnName;
                foreach (DataColumn col in _DataTableToEncode.Columns)
                {
                    columnName = col.ColumnName;
                    if (_ListOfAttributes.Contains(columnName) == false)
                    {
                        _EncodedDataTable.Columns.Add(columnName);
                    }
                    else
                    {
                        for (ctr = 1; ctr <= sizeOfCodeString; ctr++)
                        {
                            _EncodedDataTable.Columns.Add(columnName + "_" + ctr.ToString());
                        }
                    }
                }
            }
            else
            {
                _EncodedDataTable = _DataTableToEncode.Clone();
            }
            if (_AddBinaryStringAttribute == true)
            {
                _EncodedDataTable.Columns.Add("EncodedString");
                _EncodedDataTable.Columns.Add("EncodedStringLength");
            }

            int     attributeIndex;
            string  attribute;
            int     rowIndex;
            int     totalRows       = _DataTableToEncode.Rows.Count;
            int     totalAttributes = _DataTableToEncode.Columns.Count;
            float   progress;
            DataRow row;
            DataRow encodedRow;
            string  item;
            string  encodeditem;
            string  encodedString = "";

            char [] encodingStringArray;
            //int ctr;

            for (rowIndex = 0; rowIndex < totalRows; rowIndex++)
            {
                row        = _DataTableToEncode.Rows[rowIndex];
                encodedRow = _EncodedDataTable.NewRow();
                for (attributeIndex = 0; attributeIndex < totalAttributes; attributeIndex++)
                {
                    attribute = _DataTableToEncode.Columns[attributeIndex].ColumnName;
                    item      = row[attribute].ToString();
                    if (_ListOfAttributes.Contains(attribute) == true)
                    {
                        encodeditem = _EncodingDictionary[item];
                        if (_UseBinarySplitMode == true)
                        {
                            encodingStringArray = encodeditem.ToCharArray();
                            for (ctr = 1; ctr <= sizeOfCodeString; ctr++)
                            {
                                encodedRow[attribute + "_" + ctr.ToString()] = encodingStringArray[ctr - 1].ToString();
                            }
                        }
                        else
                        {
                            encodedRow[attribute] = encodeditem;
                        }

                        if (_AddBinaryStringAttribute == true)
                        {
                            encodedString = encodedString + encodeditem;
                        }
                    }
                    else
                    {
                        encodedRow[attribute] = item;
                    }
                }
                if (_AddBinaryStringAttribute == true)
                {
                    encodedRow["EncodedString"]       = encodedString;
                    encodedRow["EncodedStringLength"] = encodedString.Length;
                    encodedString = "";
                }

                _EncodedDataTable.Rows.Add(encodedRow);
                progress = (((float)(rowIndex + 1)) / ((float)(totalRows)) * 100);
                if (EncodingProgress != null)
                {
                    ProgressArgs.ProgressPercentage = progress;
                    ProgressArgs.UserState          = "";
                    EncodingProgress(this, ProgressArgs);
                }
            }

            if (EncodingCompleted != null)
            {
                CompletedArgs                  = new WorkerCompletedEventArg();
                CompletedArgs.Result           = _EncodedDataTable;
                CompletedArgs.UserStateMessage = "Finished";
                EncodingCompleted(this, CompletedArgs);
            }
        }