Skip to content

Commit

Permalink
Merge branch 'master' into automatic-delivery-of-microsalt
Browse files Browse the repository at this point in the history
  • Loading branch information
seallard authored Jan 4, 2024
2 parents 47bc335 + 28190c6 commit 4004edf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 54.9.0
current_version = 54.9.1
commit = True
tag = True
tag_name = v{new_version}
Expand Down
2 changes: 1 addition & 1 deletion cg/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "cg"
__version__ = "54.9.0"
__version__ = "54.9.1"
11 changes: 9 additions & 2 deletions cg/models/downsample/downsample_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ def __init__(
def downsampled_sample_name(
self,
) -> str:
"""Return a new sample name with the number of reads to which it is down sampled in millions appended."""
return f"{self.sample_id}_{self.number_of_reads}M"
"""Return a new sample name with the number of reads to which it is down sampled in millions
appended. DS stands for downsampled. The number of reads is converted to a string and the
decimal point is replaced with a C."""
return f"{self.sample_id}DS{self.convert_number_of_reads_to_string}M"

@property
def downsampled_case_name(
Expand All @@ -51,6 +53,11 @@ def downsampled_case_name(
"""Return a case name with _downsampled appended."""
return f"{self.case_name}_downsampled"

@property
def convert_number_of_reads_to_string(self) -> str:
"""Convert the number of reads to a string."""
return str(self.number_of_reads).replace(".", "C")

def get_sample_to_downsample(self) -> Sample:
"""
Check if a sample exists in StatusDB.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "cg"
version = "54.9.0"
version = "54.9.1"
description = "Clinical Genomics command center"
authors = ["Clinical Genomics <[email protected]>"]
readme = "README.md"
Expand Down
7 changes: 3 additions & 4 deletions tests/models/downsample/test_down_sample_meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ def test_downsample_meta_data_pass_checks(
case_name=downsample_case_name,
out_dir=tmp_path_factory.mktemp("tmp"),
)
# WHEN the number of reads in millionts is converted to a string
number_of_reads: str = meta_data.convert_number_of_reads_to_string

# THEN all necessary models to run the down sample command are created
assert (
meta_data.downsampled_sample.internal_id
== f"{sample.internal_id}_{number_of_reads_in_millions}M"
)
assert meta_data.downsampled_sample.internal_id == f"{sample.internal_id}DS{number_of_reads}M"
assert meta_data.downsampled_sample.reads == number_of_reads_in_millions * 1_000_000
assert meta_data.downsampled_case.name == f"{downsample_case_name}_downsampled"

0 comments on commit 4004edf

Please sign in to comment.