Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ONT volume script case-agnostic to "Conc. Units" UDF #347

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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

## 20240827.1

Make ONT volume calculations script case-agnostic for concentration units.

## 20240826.1

Add script for AVITI run manifest generation, re-organize repo to follow best-practice modularization and implement EPP wrapper.
Expand Down
20 changes: 10 additions & 10 deletions scripts/ont_calc_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,23 @@ def main(lims, args):
log.append(f"'Concentration': {round(conc,2)}")
conc_units = udf_tools.fetch(art_in, "Conc. Units")
log.append(f"'Conc. Units': {conc_units}")
assert conc_units in [
assert conc_units.lower() in [
"ng/ul",
"nM",
"nm",
], f'Unsupported conc. units "{conc_units}" for art {art_in.name}'

# Calculate volume to take, based on supplied info
if udf_tools.is_filled(art_out, "ONT flow cell loading amount (fmol)"):
log.append(
f"Basing calculations on 'ONT flow cell loading amount (fmol)': {round(udf_tools.fetch(art_out, 'ONT flow cell loading amount (fmol)'),2)}"
)
if conc_units == "nM":
if conc_units.lower() == "nm":
vol_to_take = min(
udf_tools.fetch(art_out, "ONT flow cell loading amount (fmol)")
/ conc,
vol,
)
elif conc_units == "ng/ul":
elif conc_units.lower() == "ng/ul":
assert size_bp is not None, "Missing size."
vol_to_take = min(
formula.fmol_to_ng(
Expand All @@ -86,9 +86,9 @@ def main(lims, args):
log.append(
f"Basing calculations on 'Amount (fmol): {round(udf_tools.fetch(art_out, 'Amount (fmol)'),2)}'"
)
if conc_units == "nM":
if conc_units.lower() == "nm":
vol_to_take = min(udf_tools.fetch(art_out, "Amount (fmol)") / conc, vol)
elif conc_units == "ng/ul":
elif conc_units.lower() == "ng/ul":
assert size_bp is not None, "Missing size."
vol_to_take = min(
formula.fmol_to_ng(
Expand All @@ -101,9 +101,9 @@ def main(lims, args):
log.append(
f"Basing calculations on 'Amount (ng)': {round(udf_tools.fetch(art_out, 'Amount (ng)'),2)}"
)
if conc_units == "ng/ul":
if conc_units.lower() == "ng/ul":
vol_to_take = min(udf_tools.fetch(art_out, "Amount (ng)") / conc, vol)
elif conc_units == "nM":
elif conc_units.lower() == "nm":
assert size_bp is not None, "Missing size."
vol_to_take = min(
formula.ng_to_fmol(udf_tools.fetch(art_out, "Amount (ng)"), size_bp)
Expand All @@ -119,13 +119,13 @@ def main(lims, args):
raise AssertionError(f"No target metrics specified for {art_out.name}")

# Based on volume to take, calculate corresponding amounts
if conc_units == "nM":
if conc_units.lower() == "nm":
amt_taken_fmol = conc * vol_to_take
if size_bp is not None:
amt_taken_ng = formula.fmol_to_ng(amt_taken_fmol, size_bp)
else:
amt_taken_ng = None
elif conc_units == "ng/ul":
elif conc_units.lower() == "ng/ul":
amt_taken_ng = conc * vol_to_take
if size_bp is not None:
amt_taken_fmol = formula.ng_to_fmol(amt_taken_ng, size_bp)
Expand Down
Loading