Skip to content

Commit

Permalink
add(pacbio orderform parsing) (#3899) (patch)
Browse files Browse the repository at this point in the history
# Description

add pacbio orderform parsing
  • Loading branch information
ChrOertlin authored Oct 29, 2024
1 parent 6581cb4 commit ffd9802
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cg/apps/orderform/excel_orderform_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class ExcelOrderformParser(OrderformParser):
f"{Orderform.METAGENOME}:{Orderform.get_current_orderform_version(Orderform.METAGENOME)}", # Microbial meta genomes
f"{Orderform.SARS_COV_2}:{Orderform.get_current_orderform_version(Orderform.SARS_COV_2)}", # Orderform SARS-CoV-2
f"{Orderform.MICROBIAL_FASTQ}:{Orderform.get_current_orderform_version(Orderform.MICROBIAL_FASTQ)}", # Microbial FASTQ
f"{Orderform.PACBIO_LONG_READ}:{Orderform.get_current_orderform_version(Orderform.PACBIO_LONG_READ)}",
]
samples: list[ExcelSample] = []

Expand Down Expand Up @@ -145,6 +146,7 @@ def get_project_type(self, document_title: str) -> str:
Orderform.MICROSALT: OrderType.MICROSALT,
Orderform.SARS_COV_2: OrderType.SARS_COV_2,
Orderform.MICROBIAL_FASTQ: OrderType.MICROBIAL_FASTQ,
Orderform.PACBIO_LONG_READ: OrderType.PACBIO_LONG_READ,
}
for document_number, value in document_number_to_project_type.items():
if document_number in document_title:
Expand Down
2 changes: 2 additions & 0 deletions cg/constants/orderforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Orderform(StrEnum):
RML: str = "1604"
SARS_COV_2: str = "2184"
MICROBIAL_FASTQ: str = "microbial_sequencing"
PACBIO_LONG_READ: str = "pacbio_revio_sequencing"

@staticmethod
def get_current_orderform_version(order_form: str) -> str:
Expand All @@ -39,6 +40,7 @@ def get_current_orderform_version(order_form: str) -> str:
Orderform.MICROSALT: "11",
Orderform.SARS_COV_2: "9",
Orderform.MICROBIAL_FASTQ: "1",
Orderform.PACBIO_LONG_READ: "1",
}
return current_order_form_versions[order_form]

Expand Down
14 changes: 14 additions & 0 deletions tests/apps/orderform/test_excel_orderform_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ def test_parse_microbial_orderform(microsalt_orderform: str):
assert orderform_parser.project_type == OrderType.MICROSALT


def test_parse_pacbio_sequencing_orderform(pacbio_revio_sequencing_orderform: str):
"""Test to parse a pacbio orderform in excel format"""
# GIVEN a order form in excel format
assert is_excel(Path(pacbio_revio_sequencing_orderform))
# GIVEN a orderform API
orderform_parser: ExcelOrderformParser = ExcelOrderformParser()

# WHEN parsing the orderform
orderform_parser.parse_orderform(excel_path=pacbio_revio_sequencing_orderform)

# THEN assert that the project type is correct
assert orderform_parser.project_type == OrderType.PACBIO_LONG_READ


def test_parse_sarscov2_orderform(sarscov2_orderform: str):
"""Test to parse a sarscov2 orderform in excel format"""

Expand Down
9 changes: 9 additions & 0 deletions tests/fixture_plugins/orders_fixtures/order_form_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ def microbial_sequencing_orderform(orderforms: Path) -> str:
).as_posix()


@pytest.fixture(scope="session")
def pacbio_revio_sequencing_orderform(orderforms: Path) -> str:
"""Orderform fixture for pacbio samples."""
return Path(
orderforms,
f"{Orderform.PACBIO_LONG_READ}_{Orderform.get_current_orderform_version(Orderform.PACBIO_LONG_READ)}.xlsx",
).as_posix()


@pytest.fixture
def sarscov2_orderform(orderforms: Path) -> str:
"""Orderform fixture for sarscov2 samples."""
Expand Down
Binary file not shown.

0 comments on commit ffd9802

Please sign in to comment.