Skip to content

Commit

Permalink
add new option for max volume
Browse files Browse the repository at this point in the history
  • Loading branch information
Karl-Svard committed Sep 30, 2024
1 parent 5f9f0a0 commit 841d346
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cg_lims/EPPs/udf/calculate/calculate_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def calculate_volumes(
volume_udf: str,
buffer_udf: str,
sample_volume_limit: float,
maximum_volume: float,
):
"""Calculates buffer volume and total volume"""

Expand All @@ -39,7 +40,7 @@ def calculate_volumes(
sample_volume=sample_volume, sample_volume_limit=sample_volume_limit
)
total_volume = buffer_volume + sample_volume
if total_volume > sample_volume_limit:
if total_volume > maximum_volume:
high_volume_warning = True
artifact.udf[buffer_udf] = buffer_volume
artifact.udf[total_volume_udf] = total_volume
Expand All @@ -50,7 +51,7 @@ def calculate_volumes(
f'Udf "Sample Volume (ul)" missing for {missing_udfs} out of {len(artifacts)} samples '
)
if high_volume_warning:
warning_message += f"Total volume higher than {sample_volume_limit} ul for some samples!"
warning_message += f"Total volume higher than {maximum_volume} ul for some samples!"
if warning_message:
raise MissingUDFsError(message=warning_message)

Expand All @@ -60,13 +61,15 @@ def calculate_volumes(
@options.volume_udf()
@options.buffer_udf()
@options.sample_volume_limit()
@options.maximum_volume()
@click.pass_context
def volume_buffer(
context: click.Context,
total_volume_udf: str,
volume_udf: str,
buffer_udf: str,
sample_volume_limit: float,
maximum_volume: float,
):
"""Buffer volume calculation."""

Expand All @@ -82,6 +85,7 @@ def volume_buffer(
volume_udf=volume_udf,
buffer_udf=buffer_udf,
sample_volume_limit=sample_volume_limit,
maximum_volume=maximum_volume,
)
message = "Volumes have been calculated."
LOG.info(message)
Expand Down
6 changes: 6 additions & 0 deletions cg_lims/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,3 +705,9 @@ def maximum_amount(
help: str = "Maximum amount",
) -> click.option:
return click.option("--max-amount", required=True, help=help)


def maximum_volume(
help: str = "Maximum volume",
) -> click.option:
return click.option("--max-volume", required=True, help=help)

0 comments on commit 841d346

Please sign in to comment.