Skip to content

Commit

Permalink
Merge branch 'master' into add-raredisease-scout-upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rannick authored Sep 6, 2024
2 parents 67b828e + f429b92 commit 6e5090b
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 47 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 = 62.2.10
current_version = 62.2.14
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__ = "62.2.10"
__version__ = "62.2.14"
Binary file modified cg/apps/invoice/templates/KI_pool_invoice.xlsx
Binary file not shown.
Binary file modified cg/apps/invoice/templates/KI_sample_invoice.xlsx
Binary file not shown.
Binary file modified cg/apps/invoice/templates/KTH_pool_invoice.xlsx
Binary file not shown.
Binary file modified cg/apps/invoice/templates/KTH_sample_invoice.xlsx
Binary file not shown.
2 changes: 2 additions & 0 deletions cg/apps/tb/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def add_pending_analysis(
ticket: str = None,
workflow_manager: str = WorkflowManager.Slurm,
tower_workflow_id: str | None = None,
is_hidden: bool = False,
) -> TrailblazerAnalysis:
request_body = {
"case_id": case_id,
Expand All @@ -132,6 +133,7 @@ def add_pending_analysis(
"ticket": ticket,
"workflow_manager": workflow_manager,
"tower_workflow_id": tower_workflow_id,
"is_hidden": is_hidden,
}
LOG.debug(f"Submitting job to Trailblazer: {request_body}")
if response := self.query_trailblazer(
Expand Down
7 changes: 7 additions & 0 deletions cg/meta/workflow/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from cg.constants.constants import (
AnalysisType,
CaseActions,
CustomerId,
FileFormat,
GenomeVersion,
WorkflowManager,
Expand Down Expand Up @@ -292,6 +293,7 @@ def add_pending_trailblazer_analysis(
ticket: str = self.status_db.get_latest_ticket_from_case(case_id)
workflow: Workflow = self.workflow
workflow_manager: str = self.get_workflow_manager()
is_case_for_development: bool = self._is_case_for_development(case_id)
self.trailblazer_api.add_pending_analysis(
analysis_type=application_type,
case_id=case_id,
Expand All @@ -304,8 +306,13 @@ def add_pending_trailblazer_analysis(
workflow=workflow,
workflow_manager=workflow_manager,
tower_workflow_id=tower_workflow_id,
is_hidden=is_case_for_development,
)

def _is_case_for_development(self, case_id: str) -> bool:
case: Case = self.status_db.get_case_by_internal_id(case_id)
return case.customer.internal_id == CustomerId.CG_INTERNAL_CUSTOMER

def _get_order_id_from_case_id(self, case_id) -> int:
case: Case = self.status_db.get_case_by_internal_id(case_id)
return case.latest_order.id
Expand Down
5 changes: 0 additions & 5 deletions cg/services/illumina/post_processing/housekeeper_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
get_undetermined_fastqs,
rename_fastq_file_if_needed,
)
from cg.store.models import Sample
from cg.store.store import Store
from cg.utils.files import get_files_matching_pattern

Expand All @@ -33,10 +32,6 @@ def _should_fastq_path_be_stored_in_housekeeper(
Check if a sample fastq file should be tracked in Housekeeper.
Only fastq files that pass the q30 threshold should be tracked.
"""
sample: Sample = store.get_sample_by_internal_id(internal_id=sample_id)

if sample.is_negative_control:
return True

lane = get_lane_from_sample_fastq(sample_fastq_path)
q30_threshold: int = get_q30_threshold(sequencer_type)
Expand Down
5 changes: 1 addition & 4 deletions cg/store/crud/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ def update_sample_reads_illumina(self, internal_id: str, sequencer_type: Sequenc
q30_threshold: int = get_q30_threshold(sequencer_type)

for sample_metric in sample_metrics:
if (
sample_metric.base_passing_q30_percent >= q30_threshold
or sample.is_negative_control
):
if sample_metric.base_passing_q30_percent >= q30_threshold:
total_reads_for_sample += sample_metric.total_reads_in_lane

sample.reads = total_reads_for_sample
Expand Down
10 changes: 0 additions & 10 deletions cg/store/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from enum import Enum
from typing import Annotated

from pydantic import ConfigDict
from sqlalchemy import (
BLOB,
DECIMAL,
Expand All @@ -25,7 +24,6 @@
from cg.constants.constants import (
CaseActions,
ControlOptions,
CustomerId,
PrepCategory,
SequencingQCStatus,
SexOptions,
Expand Down Expand Up @@ -820,14 +818,6 @@ def has_reads(self) -> bool:
def is_negative_control(self) -> bool:
return self.control == ControlOptions.NEGATIVE

@property
def is_internal_negative_control(self) -> bool:
return self.is_negative_control and self.customer == CustomerId.CG_INTERNAL_CUSTOMER

@property
def is_external_negative_control(self) -> bool:
return self.is_negative_control and self.customer != CustomerId.CG_INTERNAL_CUSTOMER

@property
def flow_cells(self) -> list[Flowcell]:
"""Return the flow cells a sample has been sequenced on."""
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 = "62.2.10"
version = "62.2.14"
description = "Clinical Genomics command center"
authors = ["Clinical Genomics <[email protected]>"]
readme = "README.md"
Expand Down
25 changes: 0 additions & 25 deletions tests/store/crud/update/test_update.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import datetime

from cg.constants import SequencingRunDataAvailability
from cg.constants.constants import ControlOptions
from cg.constants.sequencing import Sequencers
from cg.store.models import (
IlluminaSampleSequencingMetrics,
Expand Down Expand Up @@ -87,30 +86,6 @@ def test_update_sample_reads_illumina_fail_q30(
assert sample.reads == 0


def test_update_sample_reads_illumina_negative_control(
store_with_illumina_sequencing_data: Store, selected_novaseq_x_sample_ids: list[str]
):
# GIVEN a store with Illumina Sequencing Runs and a sample id
sample: Sample = store_with_illumina_sequencing_data.get_sample_by_internal_id(
selected_novaseq_x_sample_ids[0]
)
assert sample.reads == 0
# GIVEN that the sample is a negative control sample
sample.control = ControlOptions.NEGATIVE

# WHEN updating the sample reads for a sequencing run
store_with_illumina_sequencing_data.update_sample_reads_illumina(
internal_id=selected_novaseq_x_sample_ids[0], sequencer_type=Sequencers.NOVASEQX
)

# THEN the total reads for the sample is updated
total_reads_for_sample: int = 0
sample_metrics: list[IlluminaSampleSequencingMetrics] = sample.sample_run_metrics
for sample_metric in sample_metrics:
total_reads_for_sample += sample_metric.total_reads_in_lane
assert sample.reads == total_reads_for_sample


def test_update_sample_last_sequenced_at(
store_with_illumina_sequencing_data: Store,
selected_novaseq_x_sample_ids: list[str],
Expand Down

0 comments on commit 6e5090b

Please sign in to comment.