-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
228 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def cgweb_orders_dir(fixtures_dir: Path) -> Path: | ||
"""Return the path to the cgweb_orders dir.""" | ||
return Path(fixtures_dir, "cgweb_orders") | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def invalid_cgweb_orders_dir(fixtures_dir: Path) -> Path: | ||
"""Return the path to the invalid_cgweb_orders dir.""" | ||
return Path(fixtures_dir, "invalid_cgweb_orders") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
72 changes: 72 additions & 0 deletions
72
tests/fixtures/invalid_cgweb_orders/fluffy_no_index_sequence.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"cases": [], | ||
"comment": null, | ||
"customer": "cust000", | ||
"data_delivery": null, | ||
"delivery_type": "statina", | ||
"name": "1604.19.rml", | ||
"project_type": "fluffy", | ||
"samples": [ | ||
{ | ||
"age_at_sampling": null, | ||
"application": "RMLP15R100", | ||
"capture_kit": null, | ||
"collection_date": null, | ||
"comment": "comment", | ||
"concentration": "2", | ||
"concentration_ng_ul": null, | ||
"concentration_sample": "4", | ||
"container": null, | ||
"container_name": null, | ||
"control": "positive", | ||
"custom_index": null, | ||
"customer": "cust000", | ||
"data_analysis": "FLUFFY", | ||
"data_delivery": "statina", | ||
"elution_buffer": null, | ||
"extraction_method": null, | ||
"family_name": null, | ||
"father": null, | ||
"formalin_fixation_time": null, | ||
"index": "IDT DupSeq 10 bp Set B", | ||
"index_number": "3", | ||
"index_sequence": "", | ||
"internal_id": null, | ||
"lab_code": null, | ||
"mother": null, | ||
"name": "fluffysample1", | ||
"organism": null, | ||
"organism_other": null, | ||
"original_lab": null, | ||
"original_lab_address": null, | ||
"phenotype_groups": null, | ||
"phenotype_terms": null, | ||
"pool": "pool1", | ||
"post_formalin_fixation_time": null, | ||
"pre_processing_method": null, | ||
"primer": null, | ||
"priority": "research", | ||
"quantity": null, | ||
"reagent_label": "C01 IDT_10nt_568 (TGTGAGCGAA-AACTCCGATC)", | ||
"reference_genome": null, | ||
"region": null, | ||
"region_code": null, | ||
"require_qc_ok": false, | ||
"rml_plate_name": "plate1", | ||
"selection_criteria": null, | ||
"sex": null, | ||
"source": null, | ||
"status": null, | ||
"subject_id": null, | ||
"tissue_block_size": null, | ||
"tumour": null, | ||
"tumour_purity": null, | ||
"verified_organism": null, | ||
"volume": "20", | ||
"well_position": null, | ||
"well_position_rml": "A:1" | ||
} | ||
], | ||
"ticket": null, | ||
"user_id": 1 | ||
} |
72 changes: 72 additions & 0 deletions
72
tests/fixtures/invalid_cgweb_orders/rml_no_index_sequence.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
{ | ||
"cases": [], | ||
"comment": null, | ||
"customer": "cust000", | ||
"data_delivery": null, | ||
"delivery_type": "fastq", | ||
"name": "1604.19.rml", | ||
"project_type": "rml", | ||
"samples": [ | ||
{ | ||
"age_at_sampling": null, | ||
"application": "RMLP15R500", | ||
"capture_kit": null, | ||
"collection_date": null, | ||
"comment": "", | ||
"concentration": "2", | ||
"concentration_ng_ul": null, | ||
"concentration_sample": null, | ||
"container": null, | ||
"container_name": null, | ||
"control": "", | ||
"custom_index": null, | ||
"customer": "cust000", | ||
"data_analysis": "RAW-DATA", | ||
"data_delivery": "fastq", | ||
"elution_buffer": null, | ||
"extraction_method": null, | ||
"family_name": null, | ||
"father": null, | ||
"formalin_fixation_time": null, | ||
"index": "NEXTflex® v2 UDI Barcodes 1 - 96", | ||
"index_number": "3", | ||
"index_sequence": "", | ||
"internal_id": null, | ||
"lab_code": null, | ||
"mother": null, | ||
"name": "rmlsample4", | ||
"organism": null, | ||
"organism_other": null, | ||
"original_lab": null, | ||
"original_lab_address": null, | ||
"phenotype_groups": null, | ||
"phenotype_terms": null, | ||
"pool": "pool4", | ||
"post_formalin_fixation_time": null, | ||
"pre_processing_method": null, | ||
"primer": null, | ||
"priority": "priority", | ||
"quantity": null, | ||
"reagent_label": "UDI 3 (CGCTGCTC-GGCAGATC)", | ||
"reference_genome": null, | ||
"region": null, | ||
"region_code": null, | ||
"require_qc_ok": false, | ||
"rml_plate_name": "rmplate4", | ||
"selection_criteria": null, | ||
"sex": null, | ||
"source": null, | ||
"status": null, | ||
"subject_id": null, | ||
"tissue_block_size": null, | ||
"tumour": null, | ||
"tumour_purity": null, | ||
"verified_organism": null, | ||
"volume": "23", | ||
"well_position": null, | ||
"well_position_rml": "A:1" | ||
} | ||
], | ||
"ticket": null, | ||
"user_id": 1 | ||
} |
35 changes: 35 additions & 0 deletions
35
tests/services/orders/validation_service/test_model_validator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import pytest | ||
|
||
from cg.services.orders.validation.model_validator.model_validator import ModelValidator | ||
from cg.services.orders.validation.models.order import Order | ||
from cg.services.orders.validation.workflows.fluffy.models.order import FluffyOrder | ||
from cg.services.orders.validation.workflows.rml.models.order import RmlOrder | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"order_fixture, expected_index_sequence, order_model", | ||
[ | ||
( | ||
"fluffy_order_to_submit_without_index_sequence", | ||
"C01 IDT_10nt_568 (TGTGAGCGAA-AACTCCGATC)", | ||
FluffyOrder, | ||
), | ||
("rml_order_to_submit_without_index_sequence", "UDI 3 (CGCTGCTC-GGCAGATC)", RmlOrder), | ||
], | ||
ids=["fluffy", "rml"], | ||
) | ||
def test_validate_pool_sample_default_index( | ||
order_fixture: str, | ||
expected_index_sequence: str, | ||
order_model: type[Order], | ||
model_validator: ModelValidator, | ||
request: pytest.FixtureRequest, | ||
): | ||
# GIVEN a pool raw order with a sample without index sequence but correct index and index number | ||
raw_order: dict = request.getfixturevalue(order_fixture) | ||
|
||
# WHEN validating the order | ||
order, _ = model_validator.validate(order=raw_order, model=order_model) | ||
|
||
# THEN the index sequence should be set to the default index sequence | ||
assert order.samples[0].index_sequence == expected_index_sequence |