diff --git a/bin/report.py b/bin/report.py index 259d286..c1ba670 100755 --- a/bin/report.py +++ b/bin/report.py @@ -4,6 +4,7 @@ import argparse from aplanat.components import fastcat +from aplanat.components import simple as scomponents from aplanat.report import WFReport import conda_versions @@ -13,6 +14,9 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument("report", help="Report output file") parser.add_argument("summaries", nargs='+', help="Read summary file.") + parser.add_argument( + "--versions", required=True, + help="directory containing CSVs containing name,version.") parser.add_argument( "--revision", default='unknown', help="git branch/tag of the executed workflow") @@ -27,17 +31,8 @@ def main(): report.add_section( section=fastcat.full_report(args.summaries)) - - section = report.add_section() - section.markdown(''' -### Software versions -The table below highlights versions of key software used within the analysis. -''') - req = [ - 'python', 'aplanat', 'pysam', 'fastcat'] - versions = conda_versions.scrape_data( - as_dataframe=True, include=req) - section.table(versions[['Name', 'Version', 'Build']], index=False) + report.add_section( + section=scomponents.version_table(args.versions)) # write report report.write(args.report) diff --git a/environment.yaml b/environment.yaml index 9cfcee2..24d7e5f 100644 --- a/environment.yaml +++ b/environment.yaml @@ -6,6 +6,6 @@ channels: - defaults dependencies: - python==3.8.* - - aplanat >=0.3.5 + - aplanat >=0.5.0 - pysam - fastcat diff --git a/main.nf b/main.nf index 2eed4e0..579cf23 100644 --- a/main.nf +++ b/main.nf @@ -46,14 +46,27 @@ process summariseReads { } +process getVersions { + label "pysam" + cpus 1 + output: + path "versions.txt" + script: + """ + python -c "import pysam; print(f'pysam,{pysam.__version})" >> versions.txt + fastcat --version | sed 's/^/fastcat,/' >> versions.txt + """ +} + process makeReport { label "pysam" input: path "seqs.txt" + path "versions/*" output: path "wf-template-report.html" """ - report.py wf-template-report.html seqs.txt + report.py wf-template-report.html --versions versions.txt seqs.txt """ } @@ -81,7 +94,8 @@ workflow pipeline { reads main: summary = summariseReads(reads) - report = makeReport(summary) + software_versions = getVersions() + report = makeReport(summary, software_versions.collect()) emit: summary.concat(report) } diff --git a/nextflow.config b/nextflow.config index 9f3f214..f6f677c 100644 --- a/nextflow.config +++ b/nextflow.config @@ -55,7 +55,7 @@ profiles { } process { withLabel:pysam { - conda = "environment.yaml" + conda = "${projectDir}/environment.yaml" } shell = ['/bin/bash', '-euo', 'pipefail'] }