Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration test for post processing of flat flow cell demultiplexed with bclconvert #2236

Merged
merged 13 commits into from
Aug 1, 2023
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2670,6 +2670,14 @@ def flow_cell_directory_name_demultiplexed_with_bcl_convert(
return f"230504_A00689_0804_B{flow_cell_name_demultiplexed_with_bcl_convert}"


@pytest.fixture
def flow_cell_directory_name_demultiplexed_with_bcl_convert_flat(
Vince-janv marked this conversation as resolved.
Show resolved Hide resolved
flow_cell_name_demultiplexed_with_bcl_convert: str,
):
"""Return the name of a flow cell directory that has been demultiplexed with Bcl Convert using a flat output directory structure."""
return f"230505_A00689_0804_B{flow_cell_name_demultiplexed_with_bcl_convert}"


@pytest.fixture
def demultiplexed_flow_cells_directory(tmp_path) -> Path:
original_dir = Path(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Settings]
BarcodeMismatchesIndex1,0
BarcodeMismatchesIndex2,0
[Data]
FCID,Lane,Sample_ID,SampleRef,index,index2,SampleName,Control,Recipe,Operator,Sample_Project
HY7FFDRX2,1,ACC11927A2,hg19,GTCCTTCGGC,CTGTGCATGA,anonymous_1,N,R1,script,405887
HY7FFDRX2,1,ACC11927A5,hg19,GTTTCACGAT,TTTGGCCGAA,anonymous_2,N,R1,script,405887
HY7FFDRX2,2,ACC11927A2,hg19,GTCCTTCGGC,CTGTGCATGA,anonymous_1,N,R1,script,405887
HY7FFDRX2,2,ACC11927A5,hg19,GTTTCACGAT,TTTGGCCGAA,anonymous_2,N,R1,script,405887
65 changes: 65 additions & 0 deletions tests/meta/demultiplex/test_demux_post_processing.py
seallard marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -774,3 +774,68 @@ def test_post_processing_of_flow_cell_demultiplexed_with_bclconvert(
)

delivery_path.exists()


def test_post_processing_of_flow_cell_demultiplexed_with_bclconvert_flat_output_structure(
demultiplex_context: CGConfig,
flow_cell_directory_name_demultiplexed_with_bcl_convert_flat: str,
flow_cell_name_demultiplexed_with_bcl_convert: str,
demultiplexed_flow_cells_directory: Path,
bcl_convert_demultiplexed_flow_cell_sample_ids: List[str],
):
# GIVEN a DemuxPostProcessing API
demux_post_processing_api = DemuxPostProcessingAPI(demultiplex_context)

# GIVEN a directory with a flow cell demultiplexed with BCL Convert
Vince-janv marked this conversation as resolved.
Show resolved Hide resolved
demux_post_processing_api.demux_api.out_dir = demultiplexed_flow_cells_directory

# WHEN post processing the demultiplexed flow cell
demux_post_processing_api.finish_flow_cell_temp(
flow_cell_directory_name_demultiplexed_with_bcl_convert_flat
)

# THEN a flow cell was created in statusdb
assert demux_post_processing_api.status_db.get_flow_cell_by_name(
flow_cell_name_demultiplexed_with_bcl_convert
)

# THEN sequencing metrics were created for the flow cell
assert (
demux_post_processing_api.status_db._get_query(table=SampleLaneSequencingMetrics)
.filter(
SampleLaneSequencingMetrics.flow_cell_name
== flow_cell_name_demultiplexed_with_bcl_convert
)
.all()
)
Vince-janv marked this conversation as resolved.
Show resolved Hide resolved

# THEN the read count was calculated for all samples in the flow cell directory
for sample_id in bcl_convert_demultiplexed_flow_cell_sample_ids:
sample = demux_post_processing_api.status_db.get_sample_by_internal_id(sample_id)
assert sample is not None
assert sample.calculated_read_count

# THEN a flow cell bundle was added to Housekeeper
assert demux_post_processing_api.hk_api.bundle(flow_cell_name_demultiplexed_with_bcl_convert)

# THEN a sample sheet was added to Housekeeper
assert demux_post_processing_api.hk_api.get_files(
tags=[SequencingFileTag.SAMPLE_SHEET],
bundle=flow_cell_name_demultiplexed_with_bcl_convert,
).all()

# THEN sample fastq files were added to Housekeeper tagged with FASTQ and the flow cell name
for sample_id in bcl_convert_demultiplexed_flow_cell_sample_ids:
assert demux_post_processing_api.hk_api.get_files(
tags=[SequencingFileTag.FASTQ, flow_cell_name_demultiplexed_with_bcl_convert],
bundle=sample_id,
).all()

# THEN a delivery file was created in the flow cell directory
delivery_path = Path(
demux_post_processing_api.demux_api.out_dir,
flow_cell_name_demultiplexed_with_bcl_convert,
DemultiplexingDirsAndFiles.DELIVERY,
)

delivery_path.exists()