Skip to content

Commit

Permalink
Merge pull request #362 from chuan-wang/master
Browse files Browse the repository at this point in the history
Fix bugs with EPP in the BCL conversion step
  • Loading branch information
chuan-wang authored Sep 12, 2024
2 parents 8732a74 + 8a32be1 commit 5263e2d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 31 deletions.
4 changes: 4 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Scilifelab_epps Version Log

## 20240912.3

Fix bugs with EPP in the BCL conversion step

## 20240912.2

Support AVITI protocols for lobgook and comments_to_RN
Expand Down
74 changes: 44 additions & 30 deletions scripts/manage_demux_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ def get_process_stats(demux_process):

elif "AVITI Run" in seq_process.type.name:
try:
proc_stats["Chemistry"] = "AVITI" + seq_process.udf["Throughput Selection"]
proc_stats["Chemistry"] = (
"AVITI" + " " + seq_process.udf["Throughput Selection"]
)
except Exception as e:
problem_handler(
"exit", f"No flowcell version set in sequencing step: {str(e)}"
Expand Down Expand Up @@ -339,7 +341,11 @@ def set_sample_values(demux_process, parser_struct, process_stats):
sample = entry["Sample"]
# Finds name subset "P Anything Underscore Digits"
if sample != "Undetermined":
sample = proj_pattern.search(sample).group(0)
try:
sample = proj_pattern.search(sample).group(0)
# PhiX cases for AVITI
except AttributeError:
pass

if (
entry["Barcode sequence"] == "unknown"
Expand Down Expand Up @@ -414,40 +420,48 @@ def set_sample_values(demux_process, parser_struct, process_stats):
}
for old_attr, attr in def_atr.items():
# Sets default value for unwritten fields
if entry[old_attr] == "" or entry[old_attr] == "NaN":
if old_attr == "% of Raw Clusters Per Lane":
default_value = 100.0
else:
default_value = 0.0

samplesum[sample][attr] = (
default_value
if attr not in samplesum[sample]
else samplesum[sample][attr] + default_value
)
logger.info(
f"{attr} field not found. Setting default value: {default_value}"
)
if old_attr in entry.keys():
if (
entry[old_attr] == ""
or entry[old_attr] == "NaN"
):
if old_attr == "% of Raw Clusters Per Lane":
default_value = 100.0
else:
default_value = 0.0

else:
# Yields needs division by 1K, is also non-percentage
if old_attr == "Yield (Mbases)":
samplesum[sample][attr] = (
my_float(entry[old_attr].replace(",", ""))
/ 1000
default_value
if attr not in samplesum[sample]
else samplesum[sample][attr]
+ my_float(entry[old_attr].replace(",", ""))
/ 1000
else samplesum[sample][attr] + default_value
)
else:
samplesum[sample][attr] = (
my_float(entry[old_attr])
if attr not in samplesum[sample]
else samplesum[sample][attr]
+ my_float(entry[old_attr])
logger.info(
f"{attr} field not found. Setting default value: {default_value}"
)

else:
# Yields needs division by 1K, is also non-percentage
if old_attr == "Yield (Mbases)":
samplesum[sample][attr] = (
my_float(
entry[old_attr].replace(",", "")
)
/ 1000
if attr not in samplesum[sample]
else samplesum[sample][attr]
+ my_float(
entry[old_attr].replace(",", "")
)
/ 1000
)
else:
samplesum[sample][attr] = (
my_float(entry[old_attr])
if attr not in samplesum[sample]
else samplesum[sample][attr]
+ my_float(entry[old_attr])
)

except Exception as e:
problem_handler(
"exit",
Expand Down
2 changes: 1 addition & 1 deletion scripts/manage_demux_stats_thresholds.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def set_exp_lane_clust(self):
# Preliminary values for AVITI
elif self.instrument == "AVITI":
if self.chemistry == "AVITI High":
self.exp_lane_clust = 100e6
self.exp_lane_clust = 300e6
else:
self.problem_handler("exit", "Unknown run type!")
if not self.exp_lane_clust:
Expand Down

0 comments on commit 5263e2d

Please sign in to comment.