@@ -55,7 +55,6 @@ def attach_json_files(process, run_dir):
55
55
lims .upload_new_file (outart , f"{ run_dir } /AvitiRunStats.json" )
56
56
except OSError :
57
57
sys .stderr .write ("No AvitiRunStats.json found" )
58
- sys .exit (2 )
59
58
60
59
61
60
def parse_run_parameters (run_dir ):
@@ -158,25 +157,33 @@ def calculate_mean(input_list, key):
158
157
159
158
160
159
def set_run_stats (process , run_dir ):
160
+ global lane_stats
161
161
run_stats = parse_run_stats (run_dir )
162
- art = process .input_output_maps [0 ][0 ]["uri" ]
163
-
164
- for read in run_stats ["RunStats" ]["Reads" ]:
165
- read_key = read ["Read" ]
166
- art [f"Reads PF (M) { read_key } " ] = run_stats ["RunStats" ]["PFCount" ] / 1000000
167
- art [f"%PF { read_key } " ] = run_stats ["RunStats" ]["PercentPF" ]
168
- art [f"Yield PF (Gb) { read_key } " ] = (
169
- run_stats ["RunStats" ]["TotalYield" ] / 1000000000
170
- )
171
- art [f"% Aligned { read_key } " ] = read ["PhiXAlignmentRate" ]
172
- art [f"% Bases >=Q30 { read_key } " ] = calculate_mean (read ["Cycles" ], "PercentQ30" )
173
- art [f"% Bases >=Q40 { read_key } " ] = calculate_mean (read ["Cycles" ], "PercentQ40" )
174
- art [f"Avg Q Score { read_key } " ] = calculate_mean (read ["Cycles" ], "AverageQScore" )
175
- art [f"% Error Rate { read_key } " ] = calculate_mean (
176
- read ["Cycles" ], "PercentPhixErrorRate"
177
- )
178
-
179
- art .put ()
162
+ for art in process .all_outputs ():
163
+ if "Lane" in art .name :
164
+ lane_nbr = int (art .name .split (" " )[1 ])
165
+ lane_stats = next (
166
+ d for d in run_stats ["LaneStats" ] if d ["Lane" ] == lane_nbr
167
+ )
168
+ for read in lane_stats ["Reads" ]:
169
+ read_key = read ["Read" ]
170
+ art .udf [f"Reads PF (M) { read_key } " ] = lane_stats ["PFCount" ] / 1000000
171
+ art .udf [f"%PF { read_key } " ] = lane_stats ["PercentPF" ]
172
+ art .udf [f"Yield PF (Gb) { read_key } " ] = lane_stats ["TotalYield" ] / 1000000000
173
+ art .udf [f"% Aligned { read_key } " ] = read ["PhiXAlignmentRate" ]
174
+ art .udf [f"% Bases >=Q30 { read_key } " ] = calculate_mean (
175
+ read ["Cycles" ], "PercentQ30"
176
+ )
177
+ art .udf [f"% Bases >=Q40 { read_key } " ] = calculate_mean (
178
+ read ["Cycles" ], "PercentQ40"
179
+ )
180
+ art .udf [f"Avg Q Score { read_key } " ] = calculate_mean (
181
+ read ["Cycles" ], "AverageQScore"
182
+ )
183
+ art .udf [f"% Error Rate { read_key } " ] = calculate_mean (
184
+ read ["Cycles" ], "PercentPhixErrorRate"
185
+ )
186
+ art .put ()
180
187
process .put ()
181
188
182
189
0 commit comments