Projet de classification de conformations de protéines par k-medoids

projet8.py 668B

12345678910111213141516171819202122232425
  1. #!/bin/python3
  2. import pandas as pd
  3. import pbxplore as pbx
  4. import sys
  5. if __name__ == "__main__":
  6. if len(sys.argv) != 2:
  7. print("Error : usage $ python3 projet8 md.pdb")
  8. exit()
  9. conformations = [] # list to store PB format chains
  10. for chain_name, chain in pbx.chains_from_files([sys.argv[1]]):
  11. dihedrals = chain.get_phi_psi_angles()
  12. pb_seq = pbx.assign(dihedrals)
  13. conformations.append(pb_seq)
  14. df = pd.DataFrame() # pandas dataframe to store conformations
  15. for conf in conformations:
  16. df = df.append(pd.Series(list(conf)), ignore_index=True)
  17. df.to_csv("results/md.csv", index=False)