From fba94dcd8f49243a2706164c222988c5c1ecd568 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 17 Mar 2021 11:06:24 +0000 Subject: [PATCH 1/4] Switch to variable based command --- .gitlab-ci.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c37dfb6..817d906 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,17 +2,6 @@ include: - project: "epi2melabs/ci-templates" file: "wf-containers.yaml" -.run: &run | - ${NEXTFLOWRUN} -w ${OUTPUT}/workspace --out_dir ${OUTPUT} \ - --fastq test_data +variables: + NF_WORKFLOW_OPTS: "--fastq test_data" -conda-run: - extends: .conda-run - script: - - *run - -docker-run: - extends: .docker-run - script: - - *run - - touch ${CI_PROJECT_DIR}/success From 3f99c88a9d4bfbdc4a015ebbbd9310e5a6f0b746 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 17 Mar 2021 11:24:07 +0000 Subject: [PATCH 2/4] Clean up bin --- bin/read_lengths.py | 13 ++++++++++--- bin/report.py | 27 +++++++++++++++------------ 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/bin/read_lengths.py b/bin/read_lengths.py index eac7a46..aec06ca 100755 --- a/bin/read_lengths.py +++ b/bin/read_lengths.py @@ -1,13 +1,17 @@ #!/usr/bin/env python +"""Create a simple summary of a fastq file.""" + import argparse import glob import itertools import os -import pysam + import numpy as np +import pysam def mean_qual(quals): + """Calculate mean quality of a read.""" qual = np.fromiter( (ord(x) - 33 for x in quals), dtype=int, count=len(quals)) @@ -16,9 +20,12 @@ def mean_qual(quals): def main(): + """Run entry point.""" parser = argparse.ArgumentParser() - parser.add_argument("directory", help="Directory containing .fastq(.gz) files") - parser.add_argument("output", help="Output file") + parser.add_argument( + "directory", help="Directory containing .fastq(.gz) files") + parser.add_argument( + "output", help="Output file") args = parser.parse_args() fastqs = glob.glob(os.path.join(args.directory, "*.fastq*")) diff --git a/bin/report.py b/bin/report.py index bc355b4..14fae2a 100755 --- a/bin/report.py +++ b/bin/report.py @@ -1,16 +1,16 @@ #!/usr/bin/env python +"""Create workflow report.""" import argparse -import glob + +from aplanat import annot, hist, report +from bokeh.layouts import gridplot import numpy as np import pandas as pd -from bokeh.layouts import gridplot, layout -import aplanat -from aplanat import annot, hist, report - def read_files(summaries): + """Combine a list of files into a single dataframe.""" dfs = list() for fname in sorted(summaries): dfs.append(pd.read_csv(fname, sep="\t")) @@ -18,6 +18,7 @@ def read_files(summaries): def main(): + """Run the entry point.""" parser = argparse.ArgumentParser() parser.add_argument("report", help="Report output file") parser.add_argument("summaries", nargs='+', help="Read summary file.") @@ -25,7 +26,8 @@ def main(): report_doc = report.HTMLReport( "Workflow Template Sequencing report", - "Results generated through the wf-template nextflow workflow by Oxford Nanopore Technologies") + ("Results generated through the wf-template nextflow " + "workflow by Oxford Nanopore Technologies")) report_doc.markdown(''' ### Read Quality control @@ -33,8 +35,6 @@ This section displays basic QC metrics indicating read data quality. ''') np_blue = '#0084A9' - np_dark_grey = '#455560' - np_light_blue = '#90C6E7' # read length summary seq_summary = read_files(args.summaries) @@ -72,11 +72,13 @@ This section displays basic QC metrics indicating read data quality. report_doc.markdown(''' ### About -**Oxford Nanopore Technologies products are not intended for use for health assessment -or to diagnose, treat, mitigate, cure or prevent any disease or condition.** +**Oxford Nanopore Technologies products are not intended for use for health +assessment or to diagnose, treat, mitigate, cure or prevent any disease or +condition.** -This report was produced using the [epi2me-labs/wf-template](https://github.com/epi2me-labs/wf-template). -The workflow can be run using `nextflow epi2me-labs/wf-template --help` +This report was produced using the +[epi2me-labs/wf-template](https://github.com/epi2me-labs/wf-template). The +workflow can be run using `nextflow epi2me-labs/wf-template --help` --- ''') @@ -84,5 +86,6 @@ The workflow can be run using `nextflow epi2me-labs/wf-template --help` # write report report_doc.write(args.report) + if __name__ == "__main__": main() From 67d98b9561d7e1fed49d4aa2e03a1ef5ad4545cd Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 17 Mar 2021 11:28:56 +0000 Subject: [PATCH 3/4] Add comments to ci --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 817d906..03d3fdd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,5 +3,9 @@ include: file: "wf-containers.yaml" variables: + # Workflow inputs given to nextflow. + # The workflow should define `--out_dir`, the CI template sets this. + # Only common file inputs and option values need to be given here + # (not things such as -profile) NF_WORKFLOW_OPTS: "--fastq test_data" From c149382e3c3b2efaa16b3e2aac596f56a8bf8f03 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 17 Mar 2021 12:16:47 +0000 Subject: [PATCH 4/4] Add comments to ci --- .gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 03d3fdd..eaf223c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,4 @@ +# Include shared CI include: - project: "epi2melabs/ci-templates" file: "wf-containers.yaml"