Réimplémentation du programme DSSP en Python

structure.py 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. class Turn:
  2. def __init__(self, turn_type):
  3. self.turn_type = turn_type
  4. class Bridge:
  5. def __init__(self, bridge_type):
  6. self.bridge_type = bridge_type
  7. class Helix:
  8. def __init__(self, residues):
  9. self.residues = residues
  10. def get_turns(residues):
  11. turns = []
  12. for i,res in enumerate(residues):
  13. for j in range(3,6):
  14. if(i+j<len(residues)):
  15. if(res.h_bond(residues[i+j])):
  16. turns.append(Turn(j))
  17. return(turns)
  18. def get_bridges(residues):
  19. # TODO : non-overlaping check to add
  20. bridges = []
  21. for i,res in enumerate(residues):
  22. for j, res in enumerate(residues):
  23. if(i-1>=0 and i+1<len(residues)
  24. and j-1>=0 and j+1<len(residues)):
  25. if((residues[i-1].h_bond(residues[j])
  26. and residues[j].h_bond(residues[i+1]))
  27. or(residues[j-1].h_bond(residues[i])
  28. and residues[i].h_bond(residues[j+1]))):
  29. bridges.append(Bridge("para"))
  30. if(i-1>=0 and i+1<len(residues)
  31. and j-1>=0 and j+1<len(residues)):
  32. if((residues[i].h_bond(residues[j])
  33. and residues[j].h_bond(residues[i]))
  34. or(residues[i-1].h_bond(residues[j+1])
  35. and residues[j-1].h_bond(residues[i+1]))):
  36. bridges.append(Bridge("anti"))
  37. return(bridges)
  38. def get_helix(turns):
  39. pass