Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dataflow_transfer/run_classes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
MiSeqRun, # noqa: F401
NextSeqRun, # noqa: F401
NovaSeqXPlusRun, # noqa: F401
MiSeqi100Run, # noqa: F401
)
from dataflow_transfer.run_classes.ont_runs import MinIONRun, PromethIONRun # noqa: F401

Expand Down
2 changes: 1 addition & 1 deletion dataflow_transfer/run_classes/element_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ class AVITIRun(ElementRun):

def __init__(self, run_dir, configuration):
self.run_id_format = (
"^\d{8}_AV\d{6}_(A|BP)\d{10}$" # 20251007_AV242106_A2507535225
r"^\d{8}_AV\d{6}_(A|BP)\d{10}$" # 20251007_AV242106_A2507535225
)
super().__init__(run_dir, configuration)
17 changes: 14 additions & 3 deletions dataflow_transfer/run_classes/illumina_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class NovaSeqXPlusRun(IlluminaRun):

def __init__(self, run_dir, configuration):
self.run_id_format = (
"^\d{8}_[A-Z0-9]+_\d{4}_[A-Z0-9]+$" # 20251010_LH00202_0284_B22CVHTLT1
r"^\d{8}_[A-Z0-9]+_\d{4}_[A-Z0-9]+$" # 20251010_LH00202_0284_B22CVHTLT1
)
super().__init__(run_dir, configuration)

Expand All @@ -33,7 +33,7 @@ class NextSeqRun(IlluminaRun):

def __init__(self, run_dir, configuration):
self.run_id_format = (
"^\d{6}_[A-Z0-9]+_\d{3}_[A-Z0-9]+$" # 251015_VH00203_572_AAHFHCCM5
r"^\d{6}_[A-Z0-9]+_\d{3}_[A-Z0-9]+$" # 251015_VH00203_572_AAHFHCCM5
)
super().__init__(run_dir, configuration)

Expand All @@ -46,6 +46,17 @@ class MiSeqRun(IlluminaRun):

def __init__(self, run_dir, configuration):
self.run_id_format = (
"^\d{6}_[A-Z0-9]+_\d{4}_[A-Z0-9\-]+$" # 251015_M01548_0646_000000000-M6D7K
r"^\d{6}_[A-Z0-9]+_\d{4}_[A-Z0-9\-]+$" # 251015_M01548_0646_000000000-M6D7K
)
super().__init__(run_dir, configuration)


@register_run_class
class MiSeqi100Run(IlluminaRun):
"""Defines a MiSeqi100 sequencing run"""

run_type = "MiSeqi100"

def __init__(self, run_dir, configuration):
self.run_id_format = r"^\d{8}_[A-Z0-9]+_\d{4}_[A-Z0-9]{10}-SC3$" # 20260128_SH01140_0002_ASC2150561-SC3
super().__init__(run_dir, configuration)
4 changes: 2 additions & 2 deletions dataflow_transfer/run_classes/ont_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PromethIONRun(ONTRun):
run_type = "PromethION"

def __init__(self, run_dir, configuration):
self.run_id_format = "^\d{8}_\d{4}_[A-Z0-9]{2}_P[A-Z0-9]+_[a-f0-9]{8}$" # 20251015_1051_3B_PBG60686_0af3a2e0
self.run_id_format = r"^\d{8}_\d{4}_[A-Z0-9]{2}_P[A-Z0-9]+_[a-f0-9]{8}$" # 20251015_1051_3B_PBG60686_0af3a2e0
super().__init__(run_dir, configuration)


Expand All @@ -30,5 +30,5 @@ class MinIONRun(ONTRun):
run_type = "MinION"

def __init__(self, run_dir, configuration):
self.run_id_format = "^\d{8}_\d{4}_MN[A-Z0-9]+_[A-Z0-9]+_[a-f0-9]{8}$" # 20240229_1404_MN19414_ASH657_7a74bf8f
self.run_id_format = r"^\d{8}_\d{4}_MN[A-Z0-9]+_[A-Z0-9]+_[a-f0-9]{8}$" # 20240229_1404_MN19414_ASH657_7a74bf8f
super().__init__(run_dir, configuration)
56 changes: 56 additions & 0 deletions dataflow_transfer/tests/test_run_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,32 @@ def miseqseq_testobj(tmp_path):
return illumina_runs.MiSeqRun(str(run_dir), config)


@pytest.fixture
def miseqseqi100_testobj(tmp_path):
config = {
"log": {"file": "test.log"},
"transfer_details": {"user": "testuser", "host": "testhost"},
"statusdb": {
"username": "dbuser",
"password": "dbpass",
"url:": "dburl",
"database": "dbname",
},
"sequencers": {
"MiSeqi100": {
"miarka_destination": "/data/MiSeqi100",
"metadata_for_statusdb": ["RunInfo.xml", "RunParameters.xml"],
"ignore_folders": ["nosync"],
"rsync_options": ["--chmod=Dg+s,g+rw"],
}
},
}
run_id = "20260128_SH01140_0002_ASC2150561-SC3"
run_dir = tmp_path / run_id
run_dir.mkdir()
return illumina_runs.MiSeqi100Run(str(run_dir), config)


@pytest.fixture(autouse=True)
def mock_statusdbsession(monkeypatch):
class MockStatusdbSession:
Expand All @@ -106,6 +132,7 @@ def update_db_doc(self, doc):
("novaseqxplus_testobj", "NovaSeqXPlus"),
("nextseq_testobj", "NextSeq"),
("miseqseq_testobj", "MiSeq"),
("miseqseqi100_testobj", "MiSeqi100"),
],
)
def test_confirm_run_type(run_fixture, expected_run_type, request):
Expand All @@ -124,6 +151,7 @@ def test_confirm_run_type(run_fixture, expected_run_type, request):
"novaseqxplus_testobj",
"nextseq_testobj",
"miseqseq_testobj",
"miseqseqi100_testobj",
],
)
def test_sequencing_ongoing(run_fixture, request):
Expand All @@ -146,6 +174,8 @@ def test_sequencing_ongoing(run_fixture, request):
("nextseq_testobj", True),
("miseqseq_testobj", False),
("miseqseq_testobj", True),
("miseqseqi100_testobj", False),
("miseqseqi100_testobj", True),
],
)
def test_generate_rsync_command(run_fixture, final_sync, request):
Expand Down Expand Up @@ -174,6 +204,10 @@ def test_generate_rsync_command(run_fixture, final_sync, request):
("miseqseq_testobj", True, False),
("miseqseq_testobj", False, True),
("miseqseq_testobj", True, True),
("miseqseqi100_testobj", False, False),
("miseqseqi100_testobj", True, False),
("miseqseqi100_testobj", False, True),
("miseqseqi100_testobj", True, True),
],
)
def test_start_transfer(run_fixture, rsync_running, final, request, monkeypatch):
Expand Down Expand Up @@ -219,6 +253,8 @@ def mock_update_statusdb(status, additional_info=None):
("nextseq_testobj", False),
("miseqseq_testobj", True),
("miseqseq_testobj", False),
("miseqseqi100_testobj", True),
("miseqseqi100_testobj", False),
],
)
def test_final_sync_successful(run_fixture, sync_successful, request):
Expand Down Expand Up @@ -249,6 +285,10 @@ def test_final_sync_successful(run_fixture, sync_successful, request):
("miseqseq_testobj", "sequencing_started", True),
("miseqseq_testobj", "sequencing_finished", False),
("miseqseq_testobj", "sequencing_finished", True),
("miseqseqi100_testobj", "sequencing_started", False),
("miseqseqi100_testobj", "sequencing_started", True),
("miseqseqi100_testobj", "sequencing_finished", False),
("miseqseqi100_testobj", "sequencing_finished", True),
],
)
def test_has_status(run_fixture, status_to_check, expected_result, request):
Expand All @@ -268,6 +308,12 @@ def get_events(self, run_id):
@pytest.mark.parametrize(
"run_fixture, existing_statuses, status_to_update",
[
("novaseqxplus_testobj", [], "sequencing_started"),
(
"novaseqxplus_testobj",
[{"event_type": "sequencing_started"}],
"transfer_started",
),
(
"nextseq_testobj",
[],
Expand All @@ -288,6 +334,16 @@ def get_events(self, run_id):
[{"event_type": "sequencing_started"}],
"transfer_started",
),
(
"miseqseqi100_testobj",
[],
"sequencing_started",
),
(
"miseqseqi100_testobj",
[{"event_type": "sequencing_started"}],
"transfer_started",
),
],
)
def test_update_statusdb(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ignore = [

[project]
name = "dataflow_transfer"
version = "1.0.4"
version = "1.0.5"
description = "Script for transferring sequencing data from sequencers to storage"
authors = [
{ name = "Sara Sjunnebo", email = "sara.sjunnebo@scilifelab.se" },
Expand Down