Skip to content

Commit e45a2c5

Browse files
authored
Merge branch 'master' into add_tomte_scout_upload_to_dna_case
2 parents 71e1e39 + 55ee4fc commit e45a2c5

File tree

22 files changed

+123
-142
lines changed

22 files changed

+123
-142
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 62.2.1
2+
current_version = 62.2.4
33
commit = True
44
tag = True
55
tag_name = v{new_version}

cg/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
__title__ = "cg"
2-
__version__ = "62.2.1"
2+
__version__ = "62.2.4"

cg/apps/invoice/render.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import datetime as dt
2+
from pathlib import Path
23

34
from openpyxl import Workbook, load_workbook
45
from openpyxl.styles import Border, Font, PatternFill, Side
5-
from pkg_resources import resource_filename
6+
7+
from cg.constants import FileExtensions
8+
from cg.utils.files import get_project_root_dir
69

710

811
def render_xlsx(data: dict) -> Workbook:
@@ -34,11 +37,17 @@ def render_xlsx(data: dict) -> Workbook:
3437
}]
3538
}
3639
"""
37-
pkg_dir = __name__.rpartition(".")[0]
40+
project_root_dir = get_project_root_dir()
3841
sample_type = "pool" if data["pooled_samples"] else "sample"
3942
costcenter = data["cost_center"]
40-
template_path = resource_filename(pkg_dir, f"templates/{costcenter}_{sample_type}_invoice.xlsx")
41-
workbook = load_workbook(template_path)
43+
template_path = Path(
44+
project_root_dir,
45+
"apps",
46+
"invoice",
47+
"templates",
48+
f"{costcenter}_{sample_type}_invoice{FileExtensions.XLSX}",
49+
)
50+
workbook = load_workbook(template_path.as_posix())
4251
if data["pooled_samples"]:
4352
worksheet = workbook["Bilaga Prover"]
4453
worksheet["C1"] = costcenter.upper()

cg/cli/post_process/post_process.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,4 @@ def post_process_sequencing_run(context: CGConfig, run_name: str, dry_run: bool)
3535
post_processing_service.post_process(run_name=run_name, dry_run=dry_run)
3636

3737

38-
post_process_group: click.Group
3938
post_process_group.add_command(post_process_sequencing_run)

cg/constants/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ class FileExtensions(StrEnum):
223223
TSV: str = ".tsv"
224224
TXT: str = ".txt"
225225
VCF: str = ".vcf"
226+
XLSX: str = ".xlsx"
226227
XML: str = ".xml"
227228
YAML: str = ".yaml"
228229

cg/constants/report.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
"""Delivery report constants."""
22

3-
from importlib.resources import files
43
from pathlib import Path
54

65
from cg.constants import DataDelivery
76
from cg.constants.constants import CancerAnalysisType, FileExtensions, Workflow
87
from cg.constants.subject import Sex
8+
from cg.utils.files import get_project_root_dir
9+
10+
project_root_dir: Path = get_project_root_dir()
911

1012
DELIVERY_REPORT_FILE_NAME: str = f"delivery-report{FileExtensions.HTML}"
1113
SWEDAC_LOGO_PATH = Path(
12-
files("cg"), "meta", "report", "templates", "static", "images", "SWEDAC_logo.png"
14+
project_root_dir, "meta", "report", "templates", "static", "images", "SWEDAC_logo.png"
1315
)
1416

1517
BALSAMIC_REPORT_ACCREDITED_PANELS: list[str] = ["gmsmyeloid"]

cg/resources/__init__.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from pathlib import Path
22

3-
import pkg_resources
4-
53
from cg.constants import FileExtensions
4+
from cg.utils.files import get_project_root_dir
5+
6+
project_root_dir: Path = get_project_root_dir()
67

78
RAREDISEASE_BUNDLE_FILENAMES: str = (
89
Path("resources", "raredisease_bundle_filenames").with_suffix(FileExtensions.YAML).as_posix()
@@ -20,18 +21,10 @@
2021
Path("resources", "tomte_bundle_filenames").with_suffix(FileExtensions.YAML).as_posix()
2122
)
2223

23-
RAREDISEASE_BUNDLE_FILENAMES_PATH = Path(
24-
pkg_resources.resource_filename("cg", RAREDISEASE_BUNDLE_FILENAMES)
25-
)
24+
RAREDISEASE_BUNDLE_FILENAMES_PATH = Path(project_root_dir, RAREDISEASE_BUNDLE_FILENAMES)
2625

27-
RNAFUSION_BUNDLE_FILENAMES_PATH: Path = Path(
28-
pkg_resources.resource_filename("cg", RNAFUSION_BUNDLE_FILENAMES)
29-
)
26+
RNAFUSION_BUNDLE_FILENAMES_PATH = Path(project_root_dir, RNAFUSION_BUNDLE_FILENAMES)
3027

31-
TAXPROFILER_BUNDLE_FILENAMES_PATH: Path = Path(
32-
pkg_resources.resource_filename("cg", TAXPROFILER_BUNDLE_FILENAMES)
33-
)
28+
TAXPROFILER_BUNDLE_FILENAMES_PATH = Path(project_root_dir, TAXPROFILER_BUNDLE_FILENAMES)
3429

35-
TOMTE_BUNDLE_FILENAMES_PATH: Path = Path(
36-
pkg_resources.resource_filename("cg", TOMTE_BUNDLE_FILENAMES)
37-
)
30+
TOMTE_BUNDLE_FILENAMES_PATH = Path(project_root_dir, TOMTE_BUNDLE_FILENAMES)

cg/server/admin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,13 @@ class SampleView(BaseView):
551551
"last_sequenced_at",
552552
"sex",
553553
]
554-
column_filters = ["customer.internal_id", "priority", "sex", "application_version.application"]
554+
column_filters = [
555+
"customer.internal_id",
556+
"priority",
557+
"sex",
558+
"application_version.application",
559+
"capture_kit",
560+
]
555561
column_formatters = {
556562
"is_external": is_external_application,
557563
"internal_id": view_case_sample_link,

cg/server/invoices/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def invoice_template(invoice_id):
197197
workbook = render_xlsx(invoice_dict)
198198

199199
temp_dir = tempfile.gettempdir()
200-
filename = "Invoice_{}_{}.xlsx".format(invoice_obj.id, cost_center)
200+
filename = f"Invoice_{invoice_obj.id}_{cost_center}.xlsx"
201201
excel_path = os.path.join(temp_dir, filename)
202202
workbook.save(excel_path)
203203

cg/services/run_devices/exc.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,42 @@
22

33

44
class PostProcessingRunFileManagerError(CgError):
5+
"""Error raised if something goes wrong managing the sequencing run files."""
6+
57
pass
68

79

810
class PostProcessingRunDataGeneratorError(CgError):
11+
"""Error raised if something goes wrong parsing the run directory data."""
12+
913
pass
1014

1115

1216
class PostProcessingParsingError(CgError):
17+
"""Error raised if something goes wrong parsing the sequencing run metrics."""
18+
1319
pass
1420

1521

1622
class PostProcessingDataTransferError(CgError):
23+
"""Error raised if something goes wrong creating the DTOs for post-processing."""
24+
1725
pass
1826

1927

2028
class PostProcessingStoreDataError(CgError):
29+
"""Error raised if something goes wrong storing the post-processing data in StatusDB."""
30+
2131
pass
2232

2333

2434
class PostProcessingStoreFileError(CgError):
35+
"""Error raised if something goes wrong storing the post-processing files in Housekeeper."""
36+
2537
pass
2638

2739

2840
class PostProcessingError(CgError):
41+
"""Error raised if something goes wrong during post-processing."""
42+
2943
pass

0 commit comments

Comments
 (0)