Пример #1
0
 public void addModifiedResidue(ModifiedResidue ModifResidue)
 {
     this.ModifiedResidues.Add(ModifResidue);
 }
Пример #2
0
        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);
        }