Merge branch 'newtemp' into 'dev'

Newtemp

See merge request epi2melabs/workflow-containers/wf-template!10
This commit is contained in:
Chris Wright 2021-03-17 12:19:47 +00:00
commit 4a72aee687
3 changed files with 32 additions and 28 deletions

View File

@ -1,18 +1,12 @@
# Include shared CI
include: include:
- project: "epi2melabs/ci-templates" - project: "epi2melabs/ci-templates"
file: "wf-containers.yaml" file: "wf-containers.yaml"
.run: &run | variables:
${NEXTFLOWRUN} -w ${OUTPUT}/workspace --out_dir ${OUTPUT} \ # Workflow inputs given to nextflow.
--fastq test_data # 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"
conda-run:
extends: .conda-run
script:
- *run
docker-run:
extends: .docker-run
script:
- *run
- touch ${CI_PROJECT_DIR}/success

View File

@ -1,13 +1,17 @@
#!/usr/bin/env python #!/usr/bin/env python
"""Create a simple summary of a fastq file."""
import argparse import argparse
import glob import glob
import itertools import itertools
import os import os
import pysam
import numpy as np import numpy as np
import pysam
def mean_qual(quals): def mean_qual(quals):
"""Calculate mean quality of a read."""
qual = np.fromiter( qual = np.fromiter(
(ord(x) - 33 for x in quals), (ord(x) - 33 for x in quals),
dtype=int, count=len(quals)) dtype=int, count=len(quals))
@ -16,9 +20,12 @@ def mean_qual(quals):
def main(): def main():
"""Run entry point."""
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("directory", help="Directory containing .fastq(.gz) files") parser.add_argument(
parser.add_argument("output", help="Output file") "directory", help="Directory containing .fastq(.gz) files")
parser.add_argument(
"output", help="Output file")
args = parser.parse_args() args = parser.parse_args()
fastqs = glob.glob(os.path.join(args.directory, "*.fastq*")) fastqs = glob.glob(os.path.join(args.directory, "*.fastq*"))

View File

@ -1,16 +1,16 @@
#!/usr/bin/env python #!/usr/bin/env python
"""Create workflow report."""
import argparse import argparse
import glob
from aplanat import annot, hist, report
from bokeh.layouts import gridplot
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from bokeh.layouts import gridplot, layout
import aplanat
from aplanat import annot, hist, report
def read_files(summaries): def read_files(summaries):
"""Combine a list of files into a single dataframe."""
dfs = list() dfs = list()
for fname in sorted(summaries): for fname in sorted(summaries):
dfs.append(pd.read_csv(fname, sep="\t")) dfs.append(pd.read_csv(fname, sep="\t"))
@ -18,6 +18,7 @@ def read_files(summaries):
def main(): def main():
"""Run the entry point."""
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("report", help="Report output file") parser.add_argument("report", help="Report output file")
parser.add_argument("summaries", nargs='+', help="Read summary file.") parser.add_argument("summaries", nargs='+', help="Read summary file.")
@ -25,7 +26,8 @@ def main():
report_doc = report.HTMLReport( report_doc = report.HTMLReport(
"Workflow Template Sequencing report", "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(''' report_doc.markdown('''
### Read Quality control ### Read Quality control
@ -33,8 +35,6 @@ This section displays basic QC metrics indicating read data quality.
''') ''')
np_blue = '#0084A9' np_blue = '#0084A9'
np_dark_grey = '#455560'
np_light_blue = '#90C6E7'
# read length summary # read length summary
seq_summary = read_files(args.summaries) seq_summary = read_files(args.summaries)
@ -72,11 +72,13 @@ This section displays basic QC metrics indicating read data quality.
report_doc.markdown(''' report_doc.markdown('''
### About ### About
**Oxford Nanopore Technologies products are not intended for use for health assessment **Oxford Nanopore Technologies products are not intended for use for health
or to diagnose, treat, mitigate, cure or prevent any disease or condition.** 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). This report was produced using the
The workflow can be run using `nextflow epi2me-labs/wf-template --help` [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 # write report
report_doc.write(args.report) report_doc.write(args.report)
if __name__ == "__main__": if __name__ == "__main__":
main() main()