Skip to content

Commit 70938ee

Browse files
authored
Merge branch 'master' into aviti-manifest-fix
2 parents 8082fd0 + d4a2d25 commit 70938ee

File tree

2 files changed

+31
-20
lines changed

2 files changed

+31
-20
lines changed

VERSIONLOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# Scilifelab_epps Version Log
22

3-
## 20240912.1
3+
## 20240912.2
44

55
Generate composite run manifests for AVITI based on index lengths.
66

7+
## 20240912.1
8+
9+
Update AVITI run stats parser to handle multiple lanes
10+
711
## 20240910.5
812

913
Fix simple naming bug.

scripts/aviti_run_parameter_parser.py

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def attach_json_files(process, run_dir):
5555
lims.upload_new_file(outart, f"{run_dir}/AvitiRunStats.json")
5656
except OSError:
5757
sys.stderr.write("No AvitiRunStats.json found")
58-
sys.exit(2)
5958

6059

6160
def parse_run_parameters(run_dir):
@@ -158,25 +157,33 @@ def calculate_mean(input_list, key):
158157

159158

160159
def set_run_stats(process, run_dir):
160+
global lane_stats
161161
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()
180187
process.put()
181188

182189

0 commit comments

Comments
 (0)