Advertisement
alicemiriel

Untitled

Mar 13th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.37 KB | None | 0 0
  1. def classification (irmsd, lmrsd, fnat):
  2.     if fnat < 0.1 or lmrsd > 10.0 and irmsd > 4.0:
  3.         return "incorrect"
  4.     elif (fnat >= 0.3 and lmrsd > 5.0 and irmsd > 2.0):
  5.         return "acceptable"
  6.     elif(fnat >= 0.1 and fnat < 0.3) and (lmrsd <= 10.0 or irmsd <= 4.0):
  7.         return "acceptable"
  8.     elif (fnat >= 0.5 and lmrsd > 1.0 and irmsd> 1.0):
  9.         return "medium"
  10.     elif (fnat >= 0.3 and fnat < 0.5) and lmrsd <= 5.0 or irmsd <= 2.0:
  11.         return "medium"
  12.     elif (fnat >= 0.5 and lmrsd <= 1.0 and irmsd <= 1.0):
  13.         return "high"
  14.     else:
  15.         return "No category"
  16.  
  17. number_to_structure ={}
  18. map_file = open("C:\\development\\sources\\task0_mapfile.txt").readlines()
  19. for line in map_file:
  20.     spline = line.strip().split()
  21.     number = spline[1]
  22.     name = spline[0].replace("1kxp_", "").replace("la", "a").replace("lb", "b").replace("lc", "c").replace("ld", "d")
  23.     number_to_structure[number] = name
  24.  
  25. properties_file = open("C:\\development\\sources\\task0_properties.txt").readlines()
  26. output = open("C:\\development\\workdir\\task0_output.txt", "w")
  27. for line in properties_file:
  28.     spline = line.split()
  29.     number = spline[1]
  30.     irmsd = float(spline[3])
  31.     lmrsd = float(spline[4])
  32.     fnat = float(spline[5])
  33.     property = classification(irmsd,lmrsd,fnat)
  34.     output.write("%s\t%s\n" % (number_to_structure[number],property))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement