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
17 d['C1-33']['run_xml'] # run_*.xml file path
18 d['C1-33']['scores'] # scores.tar.gz file path
21 flowcell_id = flowcell_id.strip()
25 ################################
27 fc_dir = glob.glob(os.path.join(settings.RESULT_HOME_DIR, flowcell_id))
34 assert len(fc_dir) <= 1
39 ################################
41 c_dir_list = glob.glob(os.path.join(fc_dir, 'C*'))
44 if len(c_dir_list) == 0:
47 for c_dir_path in c_dir_list:
48 summary_file = glob.glob(os.path.join(c_dir_path, 'Summary.htm'))
49 pathdir, c_dir = os.path.split(c_dir_path)
51 # Create sub-dictionary
55 ###############################
59 if len(summary_file) == 0:
60 d[c_dir]['summary'] = None
65 assert len(summary_file) == 1
67 summary_file = summary_file[0]
68 d[c_dir]['summary'] = summary_file
70 ###############################
73 d[c_dir]['eland_results'] = {}
75 result_filepaths = glob.glob(os.path.join(c_dir_path, 's_*_eland_result.txt*'))
77 for filepath in result_filepaths:
79 junk, result_name = os.path.split(filepath)
81 #lanes 1-8, single digit, therefore s_#; # == index 2
82 lane = int(result_name[2])
83 d[c_dir]['eland_results'][lane] = filepath
85 ###############################
87 run_xml_filepath = glob.glob(os.path.join(c_dir_path, 'run_*.xml'))
89 if len(run_xml_filepath) == 0:
90 d[c_dir]['run_xml'] = None
93 assert len(run_xml_filepath) == 1
95 d[c_dir]['run_xml'] = run_xml_filepath[0]
97 ###############################
99 scores_filepath = glob.glob(os.path.join(c_dir_path, 'scores*'))
101 if len(scores_filepath) == 0:
102 d[c_dir]['scores'] = None
105 assert len(scores_filepath) == 1
107 d[c_dir]['scores'] = scores_filepath[0]
114 Converts CN-M (i.e. C1-33, C1-26, C4-28) cycle information into
115 number of base pairs.
120 def flowcellIdStrip(flowcell_id):
122 Removes (<words>) from flowcell id
124 mo = s_paren.search(flowcell_id)
127 return flowcell_id[mo.start():mo.end()]