Skip to content

Commit

Permalink
Merge branch 'versions' into 'dev'
Browse files Browse the repository at this point in the history
Get software versions directly

See merge request epi2melabs/workflow-containers/wf-artic!43
  • Loading branch information
cjw85 committed Jun 29, 2021
2 parents 0a3b117 + c97111d commit 00665d7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 63 deletions.
49 changes: 0 additions & 49 deletions bin/conda_versions.py

This file was deleted.

29 changes: 16 additions & 13 deletions bin/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,17 @@
"""Create report file."""

import argparse
import os

from aplanat import annot, bars, hist, lines, report
from aplanat.components import bcfstats, nextclade
from aplanat.util import Colors
from bokeh.layouts import gridplot, layout
from bokeh.models import Panel, Range1d, Tabs
import conda_versions
import numpy as np
import pandas as pd


# software versions reported (from the environment where this script runs)
# TODO: pass all these through using --versions
software_versions = [
'np-artic', 'medaka', 'minimap2', 'bcftools', 'nextclade-cli',
'samtools', 'bcftools']


def load_params(path):
"""Load the parameters csv into a dataframe."""
params_cols = ['Name', 'Value']
Expand Down Expand Up @@ -112,7 +105,7 @@ def main():
help="A csv containing the parameter key/values")
parser.add_argument(
"--versions",
help="CSV containing name,version for additional software versions.")
help="directory contained CSVs containing name,version.")
args = parser.parse_args()

report_doc = report.WFReport(
Expand Down Expand Up @@ -363,10 +356,20 @@ def main():
The table below highlights versions of key software used within the analysis.
''')
versions = conda_versions.scrape_data(
as_dataframe=True, include=software_versions,
version_dir=args.versions)
section.table(versions[['Name', 'Version', 'Build']], index=False)
versions = list()
if args.versions is not None:
for fname in os.listdir(args.versions):
print("Reading versions from file:", fname)
try:
with open(os.path.join(args.versions, fname), 'r') as fh:
for line in fh.readlines():
name, version = line.strip().split(',')
versions.append((name, version))
except Exception as e:
print(e)
pass
versions = pd.DataFrame(versions, columns=('Name', 'Version'))
section.table(versions, index=False)

# Params reporting
section = report_doc.add_section()
Expand Down
19 changes: 18 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,23 @@ process combineGenotypeSummaries {
}


process get_versions {
label "artic"
cpus 1
output:
path "versions.txt"
script:
"""
medaka --version | sed 's/ /,/' >> versions.txt
minimap2 --version | sed 's/^/minimap2,/' >> versions.txt
bcftools --version | head -n 1 | sed 's/ /,/' >> versions.txt
samtools --version | head -n 1 | sed 's/ /,/' >> versions.txt
nextclade --version | sed 's/^/nextclade,/' >> versions.txt
artic --version | sed 's/ /,/' >> versions.txt
"""
}


process report {
label "artic"
cpus 1
Expand Down Expand Up @@ -294,7 +311,7 @@ workflow pipeline {
primers
ref_variants
main:
software_versions = Channel.empty()
software_versions = get_versions()
combined_genotype_summary = null
scheme_directory = copySchemeDir(scheme_directory)
read_summaries = preArticQC(samples)
Expand Down

0 comments on commit 00665d7

Please sign in to comment.