Skip to content

Commit

Permalink
Merge branch 'CW-4520' into 'dev'
Browse files Browse the repository at this point in the history
don't draw SeqSummary plots if there were no reads after filtering [CW-4520]

Closes CW-4520

See merge request epi2melabs/workflows/wf-amplicon!91
  • Loading branch information
julibeg committed Jul 26, 2024
2 parents 95c630f + ebd1934 commit 4ed66f0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
17 changes: 16 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ docker-run:
"ref-filter-all",
"de-novo",
"de-novo-spoa-max-len-2000", # CW-3864
"de-novo-filter-all", # CW-4520
"ref-no-reads",
"ref-single-read",
"de-novo-no-reads",
Expand Down Expand Up @@ -115,7 +116,6 @@ docker-run:
AFTER_NEXTFLOW_CMD: |
ls -p $$CI_PROJECT_NAME | grep -q barcode01/ &&
ls -p $$CI_PROJECT_NAME | grep -q barcode02/
- if: $MATRIX_NAME == "de-novo-spoa-max-len-2000"
variables:
# we run with a higher `--force_spoa_length_threshold` so that the SPOA
Expand All @@ -136,6 +136,21 @@ docker-run:
AFTER_NEXTFLOW_CMD: |
ls -p $$CI_PROJECT_NAME | grep -q barcode01/ &&
ls -p $$CI_PROJECT_NAME | grep -vq barcode02/
- if: $MATRIX_NAME == "de-novo-filter-all"
# this tests that no de-novo QC section was added to the report when there
# were no reads left after filtering
variables:
NF_WORKFLOW_OPTS: >
-executor.\$$local.memory 16GB
--fastq test_data/fastq-denovo
--max_read_length 1
--combine_results
NF_PROCESS_FILES: >
main.nf
lib/common.nf
modules/local/de-novo.nf
NF_IGNORE_PROCESSES: catFastqIntoFasta,concatTSVs,configure_igv,downsampleReads,medakaStitch,miniasm,mosdepthPerBase,mosdepthWindows,racon,spoa,trimAndQC
AFTER_NEXTFLOW_CMD: "! grep 'Quality Control' $$PWD/$$CI_PROJECT_NAME/*html"

- if: $MATRIX_NAME == "ref-no-reads"
variables:
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- The workflow failing in _de novo_ mode when all reads for a sample came from the same strand.

### Changed
- The report now skips read length histograms etc. if there were no reads left after filtering.

## [v1.1.1]
### Changed
- Updated Medaka to v1.12.0.
Expand Down
10 changes: 6 additions & 4 deletions bin/workflow_glue/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def populate_report(report, metadata, all_datasets, ref_fasta, downsampling_size
# omit all other sections
preprocessing_section(report, bad_datasets)

if de_novo:
if de_novo and bad_datasets_failed_qc:
de_novo_qc_section(report, bad_datasets_failed_qc)

return
Expand Down Expand Up @@ -617,6 +617,9 @@ def preprocessing_section(report, datasets):
]
# there could be NaNs in case some datasets didn't have any reads
preprocessing_stats.fillna(0, inplace=True)
# check if there were no reads at all after filtering + trimming (in which case
# we'll skip the `SeqSummary` plots)
no_reads_in_data = preprocessing_stats.loc["Filtered", "reads"] == 0
# some formatting
for col in ("reads", "bases"):
preprocessing_stats[col] = (
Expand All @@ -642,9 +645,8 @@ def preprocessing_section(report, datasets):
)
DataTable.from_pandas(preprocessing_stats)

# return early if there were no per-read stats (i.e. there were no reads left
# after filtering)
if preprocessing_stats.loc["Filtered", "Reads"] == 0:
# return early if there were no reads left after filtering
if no_reads_in_data:
return
# `SeqSummary` plots
html_tags.p(
Expand Down

0 comments on commit 4ed66f0

Please sign in to comment.