Skip to content

Commit

Permalink
Revert earlier changes (#3689)
Browse files Browse the repository at this point in the history
### Fixed

- Reverted changes from earlier PRs.
  • Loading branch information
beatrizsavinhas authored Sep 4, 2024
1 parent 234f273 commit 786c61d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
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
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 786c61d

Please sign in to comment.