1 from gaworkflow.frontend import settings
7 s_paren = re.compile("^\w+")
9 def get_flowcell_result_dict(flowcell_id):
11 returns a dictionary following the following pattern for
15 d['C1-33']['summary'] = #Summary.htm file path
16 d['C1-33']['eland_results'][5] # C1-33 lane 5 file eland results file path
19 flowcell_id = flowcell_id.strip()
23 ################################
25 fc_dir = glob.glob(os.path.join(settings.RESULT_HOME_DIR, flowcell_id))
32 assert len(fc_dir) <= 1
37 ################################
39 c_dir_list = glob.glob(os.path.join(fc_dir, 'C*'))
42 if len(c_dir_list) == 0:
45 for c_dir_path in c_dir_list:
46 summary_file = glob.glob(os.path.join(c_dir_path, 'Summary.htm'))
47 pathdir, c_dir = os.path.split(c_dir_path)
49 # Create sub-dictionary
53 ###############################
57 if len(summary_file) == 0:
58 d[c_dir]['summary'] = None
63 assert len(summary_file) == 1
65 summary_file = summary_file[0]
66 d[c_dir]['summary'] = summary_file
68 ###############################
71 d[c_dir]['eland_results'] = {}
73 result_filepaths = glob.glob(os.path.join(c_dir_path, 's_*_eland_result.txt*'))
75 for filepath in result_filepaths:
77 junk, result_name = os.path.split(filepath)
79 #lanes 1-8, single digit, therefore s_#; # == index 2
80 lane = int(result_name[2])
81 d[c_dir]['eland_results'][lane] = filepath
83 ###############################
85 run_xml_filepath = glob.glob(os.path.join(c_dir_path, 'run_*.xml'))
87 if len(run_xml_filepath) == 0:
88 d[c_dir]['run_xml'] = None
91 assert len(run_xml_filepath) == 1
93 d[c_dir]['run_xml'] = run_xml_filepath[0]
95 ###############################
97 scores_filepath = glob.glob(os.path.join(c_dir_path, 'scores*'))
99 if len(scores_filepath) == 0:
100 d[c_dir]['scores'] = None
103 assert len(scores_filepath) == 1
105 d[c_dir]['scores'] = scores_filepath[0]
112 Converts CN-M (i.e. C1-33, C1-26, C4-28) cycle information into
113 number of base pairs.
118 def flowcellIdStrip(flowcell_id):
120 Removes (<words>) from flowcell id
122 mo = s_paren.search(flowcell_id)
125 return flowcell_id[mo.start():mo.end()]