@@ -0,0 +1,1880 @@
+# -*- coding: utf-8 -*-%0A%0A%0A%0Aimport sqlite3%0Aimport json%0Aimport argparse%0Aimport datetime%0Aimport os%0Afrom os import path%0Afrom os.path import isfile, join%0Afrom os import listdir%0A#from metrix.utils.json_parser import parse_xia2_json%0Afrom json_parser import parse_xia2%0A%0Aoutput = open('json_output.txt', 'w') # Used for an error counting script%0A%0Apdb_fh = open('pdb_id_list.txt', 'r+')%0Afor line in pdb_fh:%0A  line = line.strip()%0A  pdb_id = line%0A%0A  #run json_parser.py with inputing PDB_id from list and path to processing%0A  input_path = '/dls/tmp/ghp45345/xia2_stresstest/'%0A  proc_dirs = sorted(os.listdir(input_path))%0A  latest_proc_dir = proc_dirs%5B-1%5D%0A%0A  xia2dir = os.path.join(input_path, latest_proc_dir, pdb_id)%0A#  xia2dir = os.path.join(input_path, pdb_id)%0A%0A  if xia2dir is None:%0A    raise RuntimeError('Need to specify the path to the xia2 processing directory')%0A  else:%0A    if not os.path.exists(xia2dir):%0A      print '%25s does not exist' %25 xia2dir%0A      with open('json_output.txt', 'a') as text_file:%0A        text_file.write('%25s does not exist %5Cn' %25(xia2dir))%0A      text_file.close()%0A%0A%0A  # Find xia2.json%0A  x2j = os.path.join(xia2dir, 'xia2.json')%0A  if not os.path.exists(x2j):%0A    print '%25s does not exist' %25 x2j%0A    with open('json_output.txt', 'a') as text_file:%0A      text_file.write('%25s does not exist %5Cn' %25(x2j))%0A    text_file.close()%0A    continue%0A%0A  %0A  # Find xia2.txt%0A  x2t = os.path.join(xia2dir, 'xia2.txt')%0A  if not os.path.exists(x2t):%0A    print '%25s does not exist' %25 x2t%0A    with open('json_output.txt', 'a') as text_file:%0A      text_file.write('%25s does not exist %5Cn' %25(x2t))%0A    text_file.close()%0A    continue%0A%0A  #command =%5B'parse_xia2_json', '--pdb_id=%25s' %25(pdb_id), '--xia2dir=%25s' %25(xia2dir)%5D%0A  print %22Parsing %25s, %25s%22 %25 (pdb_id, xia2dir)%0A  parse_xia2(pdb_id, xia2dir)%0A%0A  #print ' '.join(command)%0A%0A%0A# parse_xia2_json(db, pdb_id, xia2_json_filename, dials_version)%0A%0A%0A%0A%0A

Add files via upload