2021-09-29 13:27:00 +00:00
|
|
|
// Import generic module functions
|
|
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
|
|
|
|
|
|
|
params.options = [:]
|
|
|
|
options = initOptions(params.options)
|
|
|
|
|
|
|
|
process CUSTOM_DUMPSOFTWAREVERSIONS {
|
|
|
|
label 'process_low'
|
|
|
|
publishDir "${params.outdir}",
|
|
|
|
mode: params.publish_dir_mode,
|
|
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'pipeline_info', meta:[:], publish_by_meta:[]) }
|
|
|
|
|
|
|
|
// Requires `pyyaml` which does not have a dedicated container but is in the MultiQC container
|
|
|
|
conda (params.enable_conda ? "bioconda::multiqc=1.11" : null)
|
|
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
|
|
container "https://depot.galaxyproject.org/singularity/multiqc:1.11--pyhdfd78af_0"
|
|
|
|
} else {
|
|
|
|
container "quay.io/biocontainers/multiqc:1.11--pyhdfd78af_0"
|
|
|
|
}
|
|
|
|
|
|
|
|
input:
|
|
|
|
path versions
|
|
|
|
|
|
|
|
output:
|
2021-10-01 13:04:56 +00:00
|
|
|
path "software_versions.yml" , emit: yml
|
|
|
|
path "software_versions_mqc.yml", emit: mqc_yml
|
|
|
|
path "versions.yml" , emit: versions
|
2021-09-29 13:27:00 +00:00
|
|
|
|
|
|
|
script:
|
|
|
|
"""
|
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
import yaml
|
|
|
|
import platform
|
|
|
|
from textwrap import dedent
|
|
|
|
|
|
|
|
def _make_versions_html(versions):
|
|
|
|
html = [
|
|
|
|
dedent(
|
|
|
|
'''\\
|
|
|
|
<style>
|
|
|
|
#nf-core-versions tbody:nth-child(even) {
|
|
|
|
background-color: #f2f2f2;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
<table class="table" style="width:100%" id="nf-core-versions">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th> Process Name </th>
|
|
|
|
<th> Software </th>
|
|
|
|
<th> Version </th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
'''
|
|
|
|
)
|
|
|
|
]
|
|
|
|
for process, tmp_versions in sorted(versions.items()):
|
|
|
|
html.append("<tbody>")
|
|
|
|
for i, (tool, version) in enumerate(sorted(tmp_versions.items())):
|
|
|
|
html.append(
|
|
|
|
dedent(
|
|
|
|
f'''\\
|
|
|
|
<tr>
|
|
|
|
<td><samp>{process if (i == 0) else ''}</samp></td>
|
|
|
|
<td><samp>{tool}</samp></td>
|
|
|
|
<td><samp>{version}</samp></td>
|
|
|
|
</tr>
|
|
|
|
'''
|
|
|
|
)
|
|
|
|
)
|
|
|
|
html.append("</tbody>")
|
|
|
|
html.append("</table>")
|
|
|
|
return "\\n".join(html)
|
|
|
|
|
2021-09-30 08:00:33 +00:00
|
|
|
module_versions = {}
|
|
|
|
module_versions["${getProcessName(task.process)}"] = {
|
|
|
|
'python': platform.python_version(),
|
|
|
|
'yaml': yaml.__version__
|
|
|
|
}
|
|
|
|
|
2021-09-29 13:27:00 +00:00
|
|
|
with open("$versions") as f:
|
2021-10-06 06:16:36 +00:00
|
|
|
workflow_versions = yaml.load(f, Loader=yaml.BaseLoader) | module_versions
|
2021-09-29 13:27:00 +00:00
|
|
|
|
2021-09-30 08:00:33 +00:00
|
|
|
workflow_versions["Workflow"] = {
|
2021-09-29 13:27:00 +00:00
|
|
|
"Nextflow": "$workflow.nextflow.version",
|
|
|
|
"$workflow.manifest.name": "$workflow.manifest.version"
|
|
|
|
}
|
|
|
|
|
|
|
|
versions_mqc = {
|
|
|
|
'id': 'software_versions',
|
|
|
|
'section_name': '${workflow.manifest.name} Software Versions',
|
|
|
|
'section_href': 'https://github.com/${workflow.manifest.name}',
|
|
|
|
'plot_type': 'html',
|
|
|
|
'description': 'are collected at run time from the software output.',
|
2021-09-30 08:00:33 +00:00
|
|
|
'data': _make_versions_html(workflow_versions)
|
2021-09-29 13:27:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
with open("software_versions.yml", 'w') as f:
|
2021-09-30 08:00:33 +00:00
|
|
|
yaml.dump(workflow_versions, f, default_flow_style=False)
|
2021-09-29 13:27:00 +00:00
|
|
|
with open("software_versions_mqc.yml", 'w') as f:
|
|
|
|
yaml.dump(versions_mqc, f, default_flow_style=False)
|
|
|
|
|
|
|
|
with open('versions.yml', 'w') as f:
|
2021-09-30 08:00:33 +00:00
|
|
|
yaml.dump(module_versions, f, default_flow_style=False)
|
2021-09-29 13:27:00 +00:00
|
|
|
"""
|
|
|
|
}
|