public static Peptide getPeptide(AminoAcid[] StandardProteinSequence, int ModificationSite) { AminoAcid[] PeptAminoAcids = new AminoAcid[9]; int PeptIndex, SeqncIndex; for (int i = 0; i < StandardProteinSequence.Length; i++) { if ((i + 1) == ModificationSite) { PeptAminoAcids[4] = StandardProteinSequence.ElementAt(i); PeptIndex = 3; SeqncIndex = (i - 1); while (PeptIndex != -1) { if (SeqncIndex < 0) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex--; SeqncIndex--; } PeptIndex = 5; SeqncIndex = (i + 1); while (PeptIndex != 9) { if (SeqncIndex > (StandardProteinSequence.Length - 1)) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex++; SeqncIndex++; } break; } } return(new Peptide(PeptAminoAcids)); }
public static AminoAcid[] getStandardProteinSequence(String ProteinSequence) { #region Amino Acid List List <AminoAcid> AminoAcidList = new List <AminoAcid>(); AminoAcidList.Add(new AminoAcid("Alanine", 'A')); AminoAcidList.Add(new AminoAcid("Arginine", 'R')); AminoAcidList.Add(new AminoAcid("Asparagine", 'N')); AminoAcidList.Add(new AminoAcid("Aspartic Acid", 'D')); AminoAcidList.Add(new AminoAcid("Cystein", 'C')); AminoAcidList.Add(new AminoAcid("Glutamine", 'Q')); AminoAcidList.Add(new AminoAcid("Glutamic Acid", 'E')); AminoAcidList.Add(new AminoAcid("Glycine", 'G')); AminoAcidList.Add(new AminoAcid("Histidine", 'H')); AminoAcidList.Add(new AminoAcid("Isoleucine", 'I')); AminoAcidList.Add(new AminoAcid("Leucine", 'L')); AminoAcidList.Add(new AminoAcid("Lysine", 'K')); AminoAcidList.Add(new AminoAcid("Methionine", 'M')); AminoAcidList.Add(new AminoAcid("Phenylalanine", 'F')); AminoAcidList.Add(new AminoAcid("Proline", 'P')); AminoAcidList.Add(new AminoAcid("Serine", 'S')); AminoAcidList.Add(new AminoAcid("Threonine", 'T')); AminoAcidList.Add(new AminoAcid("Tryptophan", 'W')); AminoAcidList.Add(new AminoAcid("Tyrosine", 'Y')); AminoAcidList.Add(new AminoAcid("Valine", 'V')); #endregion AminoAcid[] StandardProteinSequence = new AminoAcid[ProteinSequence.Length]; char SequenceChar; for (int i = 0; i < ProteinSequence.Length; i++) { SequenceChar = ProteinSequence.ElementAt(i); for (int j = 0; j < AminoAcidList.Count; j++) { if (AminoAcidList.ElementAt(j).getSymbol().Equals(SequenceChar)) { StandardProteinSequence[i] = AminoAcidList.ElementAt(j); break; } } } return(StandardProteinSequence); }
public void setModifAminoAcid(AminoAcid ModifAminoAcid) { this.ModifAminoAcid = ModifAminoAcid; }
public static List <Peptide> getPeptideList(AminoAcid[] StandardProteinSequence, Boolean SerineChecked, Boolean ThreonineChecked, Boolean TyrosineChecked, Boolean AllChecked) { List <Peptide> peptides = new List <Peptide>(); int PeptIndex, SeqncIndex; for (int i = 0; i < StandardProteinSequence.Length; i++) { AminoAcid[] PeptAminoAcids = new AminoAcid[9]; if (SerineChecked == true) { if (StandardProteinSequence.ElementAt(i).getSymbol().Equals('S')) { PeptAminoAcids[4] = StandardProteinSequence.ElementAt(i); PeptIndex = 3; SeqncIndex = (i - 1); while (PeptIndex != -1) { if (SeqncIndex < 0) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex--; SeqncIndex--; } PeptIndex = 5; SeqncIndex = (i + 1); while (PeptIndex != 9) { if (SeqncIndex > (StandardProteinSequence.Length - 1)) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex++; SeqncIndex++; } Peptide peptide = new Peptide(PeptAminoAcids); peptides.Add(peptide); } } else if (ThreonineChecked == true) { if (StandardProteinSequence.ElementAt(i).getSymbol().Equals('T')) { PeptAminoAcids[4] = StandardProteinSequence.ElementAt(i); PeptIndex = 3; SeqncIndex = (i - 1); while (PeptIndex != -1) { if (SeqncIndex < 0) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex--; SeqncIndex--; } PeptIndex = 5; SeqncIndex = (i + 1); while (PeptIndex != 9) { if (SeqncIndex > (StandardProteinSequence.Length - 1)) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex++; SeqncIndex++; } Peptide peptide = new Peptide(PeptAminoAcids); peptides.Add(peptide); } } else if (TyrosineChecked == true) { if (StandardProteinSequence.ElementAt(i).getSymbol().Equals('Y')) { PeptAminoAcids[4] = StandardProteinSequence.ElementAt(i); PeptIndex = 3; SeqncIndex = (i - 1); while (PeptIndex != -1) { if (SeqncIndex < 0) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex--; SeqncIndex--; } PeptIndex = 5; SeqncIndex = (i + 1); while (PeptIndex != 9) { if (SeqncIndex > (StandardProteinSequence.Length - 1)) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex++; SeqncIndex++; } Peptide peptide = new Peptide(PeptAminoAcids); peptides.Add(peptide); } } else if (AllChecked == true) { if (StandardProteinSequence.ElementAt(i).getSymbol().Equals('S') || StandardProteinSequence.ElementAt(i).getSymbol().Equals('T') || StandardProteinSequence.ElementAt(i).getSymbol().Equals('Y')) { PeptAminoAcids[4] = StandardProteinSequence.ElementAt(i); PeptIndex = 3; SeqncIndex = (i - 1); while (PeptIndex != -1) { if (SeqncIndex < 0) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex--; SeqncIndex--; } PeptIndex = 5; SeqncIndex = (i + 1); while (PeptIndex != 9) { if (SeqncIndex > (StandardProteinSequence.Length - 1)) { PeptAminoAcids[PeptIndex] = new AminoAcid("Null", 'X'); } else { PeptAminoAcids[PeptIndex] = StandardProteinSequence[SeqncIndex]; } PeptIndex++; SeqncIndex++; } Peptide peptide = new Peptide(PeptAminoAcids); peptides.Add(peptide); } } } return(peptides); }
public static List <Protein> getProteinRecordsFromTestingDataset(String Dataset_File_Path) { Excel.Application ExcelApplication = new Excel.Application(); Excel.Workbook ExcelWorkbook = ExcelApplication.Workbooks.Open(Dataset_File_Path); Excel.Worksheet ExcelWorksheet = ExcelWorkbook.Sheets[2]; Excel.Range ExcelSheetRange = ExcelWorksheet.UsedRange; int NumberOfRows = ExcelSheetRange.Rows.Count; int NumberOfColumn = ExcelSheetRange.Columns.Count; String ProteinID = "", ModifiedResidueName = "", AminoAcidName = "", KineaseName = "", ProteinSequence = ""; int ModificationSite = 0, SequenceLength = 0; char Symbol = '\0'; List <Protein> Proteins = new List <Protein>(); for (int RowCount = 2; RowCount <= NumberOfRows; RowCount++) { for (int ColumnCount = 1; ColumnCount <= NumberOfColumn; ColumnCount++) { if (ExcelSheetRange.Cells[RowCount, ColumnCount] != null && ExcelSheetRange.Cells[RowCount, ColumnCount].Value2 != null) { switch (ColumnCount) { case 1: { ProteinID = ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString(); break; } case 2: { ModificationSite = Int32.Parse(ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString()); break; } case 3: { ModifiedResidueName = ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString(); break; } case 4: { AminoAcidName = ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString(); break; } case 5: { Symbol = char.Parse(ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString()); break; } case 6: { KineaseName = ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString(); break; } case 7: { ProteinSequence = ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString(); break; } case 8: { SequenceLength = Int32.Parse(ExcelSheetRange.Cells[RowCount, ColumnCount].Value2.ToString()); break; } } } } AminoAcid ModifAminoAcid = new AminoAcid(AminoAcidName, Symbol); AminoAcid[] StandardProteinSequence = getStandardProteinSequence(ProteinSequence); Peptide ModifPeptide = getPeptide(StandardProteinSequence, ModificationSite); ModifiedResidue ModifResidue = new ModifiedResidue(ModificationSite, ModifiedResidueName, ModifAminoAcid, KineaseName, ModifPeptide); Protein protein = new Protein(ProteinID, ProteinSequence, SequenceLength); protein.addModifiedResidue(ModifResidue); Proteins.Add(protein); } GC.Collect(); GC.WaitForPendingFinalizers(); Marshal.ReleaseComObject(ExcelSheetRange); Marshal.ReleaseComObject(ExcelWorksheet); ExcelWorkbook.Close(); Marshal.ReleaseComObject(ExcelWorkbook); ExcelApplication.Quit(); Marshal.ReleaseComObject(ExcelApplication); return(Proteins); }