protein.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. from Bio.Graphics import *
  2. from Bio.Seq import Seq
  3. from Bio.PDB.MMCIFParser import MMCIFParser
  4. from Bio.PDB.Polypeptide import Polypeptide
  5. from Bio.PDB.StructureBuilder import StructureBuilder
  6. parser = MMCIFParser()
  7. #create a function that shows 3d models of proteins
  8. def show_3d(pdb_code):
  9. #get the structure of the protein
  10. structure = parser.get_structure(pdb_code)
  11. #show it
  12. ppb = PPBuilder()
  13. show_structure(structure)
  14. #create a function that shows the sequence of a protein
  15. def show_sequence(pdb_code):
  16. #get the structure of the protein
  17. structure = parser.get_structure(pdb_code)
  18. #get the residues
  19. ppb = PPBuilder()
  20. for pp in ppb.build_peptides(structure):
  21. #show the sequence
  22. print(pp.get_sequence())
  23. #create a function that shows the secondary structure of a protein
  24. def show_secondary_structure(pdb_code):
  25. #get the structure of the protein
  26. structure = parser.get_structure(pdb_code)
  27. #get the secondary structure
  28. ppb = PPBuilder()
  29. for pp in ppb.build_peptides(structure):
  30. #show the secondary structure
  31. print(pp.get_sec_struct())
  32. #create a function that shows the sequence and secondary structure of a protein
  33. def show_sequence_and_secondary_structure(pdb_code):
  34. #get the structure of the protein
  35. structure = parser.get_structure(pdb_code)
  36. #get the residues
  37. ppb = PPBuilder()
  38. for pp in ppb.build_peptides(structure):
  39. #show the sequence
  40. print(pp.get_sequence())
  41. #show the secondary structure
  42. print(pp.get_sec_struct())
  43. #create a function that shows the sequence and secondary structure of a protein
  44. def show_sequence_and_secondary_structure_with_gaps(pdb_code):
  45. #get the structure of the protein
  46. structure = parser.get_structure(pdb_code)
  47. #get the residues
  48. ppb = PPBuilder()
  49. for pp in ppb.build_peptides(structure):
  50. #show the sequence
  51. print(pp.get_sequence())
  52. #show the secondary structure
  53. print(pp.get_sec_struct_with_gaps())
  54. #create a function that shows the sequence and secondary structure of a protein
  55. def show_sequence_and_secondary_structure_with_gaps_and_missing_residues(pdb_code):
  56. #get the structure of the protein
  57. structure = parser.get_structure(pdb_code)
  58. #get the residues
  59. ppb = PPBuilder()
  60. for pp in ppb.build_peptides(structure):
  61. #show the sequence
  62. print(pp.get_sequence())
  63. #show the secondary structure
  64. print(pp.get_sec_struct_with_gaps_and_missing_residues())
  65. #create a function that shows the sequence and secondary structure of a protein
  66. def show_sequence_and_secondary_structure_with_gaps_and_missing_residues_and_disordered_residues(pdb_code):
  67. #get the structure of the protein
  68. structure = parser.get_structure(pdb_code)
  69. #get the residues
  70. ppb = PPBuilder()
  71. for pp in ppb.build_peptides(structure):
  72. #show the sequence
  73. print(pp.get_sequence())
  74. #show the secondary structure
  75. print(pp.get_sec_struct_with_gaps_and_missing_residues_and_disordered_residues())
  76. #create a function that shows the sequence and secondary structure of a protein
  77. def show_sequence_and_secondary_structure_with_gaps_and_missing_residues_and_disordered_residues_and_insertions(pdb_code):
  78. #get the structure of the protein
  79. structure = get_structure(pdb_code)
  80. #get the residues
  81. ppb = PPBuilder()
  82. for pp in ppb.build_peptides(structure):
  83. #show the sequence
  84. print(pp.get_sequence())
  85. #show the secondary structure
  86. print(pp.get_sec_struct_with_gaps_and_missing_residues_and_disordered_residues_and_insertions())
  87. #create a function that shows the sequence and secondary structure of a protein
  88. def show_sequence_and_secondary_structure_with_gaps_and_missing_residues_and_disordered_residues_and_insertions_and_terminal_residues(pdb_code):
  89. #get the structur of the protein
  90. structure = get_structure(pdb_code)
  91. #get the residues
  92. ppb = PPBuilder()
  93. for pp in ppb.build_peptides(structure):
  94. #show the sequence
  95. print(pp.get_sequence())
  96. #show the secondary structure
  97. print(pp.get_sec_struct_with_gaps_and_missing_residues_and_disordered_residues_and_insertions_and_terminal_residues())