Beispiel #1
0
        public void ExtractPeptides()
        {
            if (PeptideExtractionStarted != null)
            {
                PeptideExtractionStarted(this);
            }
            totalRows = _SourceDataTable.Rows.Count;
            #region Peptide Extraction Loop
            for (rowIndex = 0; rowIndex < totalRows; rowIndex++)
            {
                row      = _SourceDataTable.Rows[rowIndex];
                sequence = row[_NameOfSequenceFeildName].ToString();
                position = int.Parse(row[_NameOfPositionFeildName].ToString());

                if (_IsExtendedSequence == true)
                {
                    pd = PeptideCutter.ToPeptideFromExtendedSequence(sequence, position, _SizeOfOneSide);
                }
                else
                {
                    pd = PeptideCutter.ToPeptideFromStandardSequence(sequence, position, _SizeOfOneSide);
                }

                peptideID  = row[_NamePIDFeildName].ToString() + "-" + position.ToString();
                peptideRow = _PeptideDataTable.NewRow();
                peptideRow["PeptideID"]        = peptideID;
                peptideRow["ExtendedSequence"] = pd.ExtendedPeptideSequence;
                if (_MarkClassificationLabel == true)
                {
                    peptideRow["Class"] = _ClassificationLabel;
                }
                ctr = 0;
                for (index = (-1 * _SizeOfOneSide); index <= _SizeOfOneSide; index++)
                {
                    peptideRow["P" + index.ToString()] = pd.PeptideSequence[ctr];
                    ctr++;
                }
                _PeptideDataTable.Rows.Add(peptideRow);


                if (PeptideExtractionProgress != null)
                {
                    progress = (((float)(rowIndex + 1) / (float)totalRows) * 100);
                    PeptideExtractionProgressEventArg.AssociatedData     = null;
                    PeptideExtractionProgressEventArg.ProgressPercentage = progress;
                    PeptideExtractionProgress(this, PeptideExtractionProgressEventArg);
                }
            }
            #endregion Peptide Extraction Loop
            if (PeptideExtractionCompleted != null)
            {
                PeptideExtractionCompletedEventArg.UserStateMessage = "";
                PeptideExtractionCompletedEventArg.Result           = PeptideDataTable;
                PeptideExtractionCompleted(this, PeptideExtractionCompletedEventArg);
            }
        }
Beispiel #2
0
        public static DataTable ExtractPeptide(string sequence, List <string> listOfTargetResidues, int sizeOfOneSide, bool isExtendedSequence)
        {
            List <int> listOfTargetPositions = new List <int>();
            int        aminoIndex, totalAminoAcids;
            string     aminoAcid;

            _SizeOfOneSide = sizeOfOneSide;

            peptideDataTable = new DataTable("PeptideDataTable");
            peptideDataTable.Columns.Add("ExtendedSequence");
            peptideDataTable.Columns.Add("Position");

            int index;

            for (index = (-1 * sizeOfOneSide); index <= sizeOfOneSide; index++)
            {
                peptideDataTable.Columns.Add("P" + index.ToString());
            }

            if (isExtendedSequence == true)
            {
                char[]   sep            = { ',' };
                string[] aminoAcidArray = sequence.Split(sep);
                totalAminoAcids = aminoAcidArray.Length;
                for (aminoIndex = 0; aminoIndex < totalAminoAcids; aminoIndex++)
                {
                    aminoAcid = aminoAcidArray[aminoIndex];
                    if (listOfTargetResidues.Contains(aminoAcid) == true)
                    {
                        peptideData = PeptideCutter.ToPeptideFromExtendedSequence(sequence, aminoIndex + 1, sizeOfOneSide);
                        UpdatePeptideDataTable(aminoIndex + 1);
                    }
                }
            }
            else
            {
                totalAminoAcids = sequence.Length;
                for (aminoIndex = 0; aminoIndex < totalAminoAcids; aminoIndex++)
                {
                    aminoAcid = sequence[aminoIndex].ToString();
                    if (listOfTargetResidues.Contains(aminoAcid) == true)
                    {
                        peptideData = PeptideCutter.ToPeptideFromStandardSequence(sequence, aminoIndex + 1, sizeOfOneSide);
                        UpdatePeptideDataTable(aminoIndex + 1);
                    }
                }
            }
            return(peptideDataTable);
        }
Beispiel #3
0
        public void Dispose()
        {
            if (_SourceDataTable != null)
            {
                _SourceDataTable.Clear();
                _SourceDataTable.Dispose();
                _SourceDataTable = null;
            }
            if (_PeptideDataTable != null)
            {
                _PeptideDataTable.Clear();
                _PeptideDataTable.Dispose();
                _PeptideDataTable = null;
            }

            if (pd != null)
            {
                pd.Dispose();
                pd = null;
            }
        }