This repository has been archived by the owner on Jan 27, 2020. It is now read-only.
forked from nf-core/sarek
-
Notifications
You must be signed in to change notification settings - Fork 7
Get the versions of the software used in the MultiQC report #595
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/usr/bin/env python | ||
from __future__ import print_function | ||
from collections import OrderedDict | ||
import re | ||
|
||
regexes = { | ||
'AlleleCount': ['v_allelecount.txt', r"(\S+)"], | ||
'ASCAT': ['v_ascat.txt', r"(\d\.\d+)"], | ||
'bcftools': ['v_bcftools.txt', r"bcftools (\S+)"], | ||
'BWA': ['v_bwa.txt', r"Version: (\S+)"], | ||
'FastQC': ['v_fastqc.txt', r"FastQC v(\S+)"], | ||
'GATK': ['v_gatk.txt', r"GATK version(\S+)"], | ||
'htslib': ['v_samtools.txt', r"htslib (\S+)"], | ||
'Manta': ['v_manta.txt', r"([0-9.]+)"], | ||
'MultiQC': ['v_multiqc.txt', r"multiqc, version (\S+)"], | ||
'Nextflow': ['v_nextflow.txt', r"(\S+)"], | ||
'FreeBayes': ['v_freebayes.txt', r"version: v(\d\.\d\.\d+)"], | ||
'Picard': ['v_picard.txt', r"Picard version:(\d\.\d\.\d+)"], | ||
'Qualimap': ['v_qualimap.txt', r"QualiMap v.(\S+)"], | ||
'R': ['v_r.txt', r"R version (\S+)"], | ||
'samtools': ['v_samtools.txt', r"samtools (\S+)"], | ||
'Sarek': ['v_sarek.txt', r"(\S+)"], | ||
'SnpEff': ['v_snpeff.txt', r"version SnpEff (\S+)"], | ||
'Strelka': ['v_strelka.txt', r"([0-9.]+)"], | ||
'vcftools': ['v_vcftools.txt', r"([0-9.]+)"], | ||
'VEP': ['v_vep.txt', r"ensembl-vep : (\S+)"], | ||
} | ||
results = OrderedDict() | ||
results['Sarek'] = '<span style="color:#999999;\">N/A</span>' | ||
results['Nextflow'] = '<span style="color:#999999;\">N/A</span>' | ||
results['BWA'] = '<span style="color:#999999;\">N/A</span>' | ||
results['samtools'] = '<span style="color:#999999;\">N/A</span>' | ||
results['htslib'] = '<span style="color:#999999;\">N/A</span>' | ||
results['GATK'] = '<span style="color:#999999;\">N/A</span>' | ||
results['Picard'] = '<span style="color:#999999;\">N/A</span>' | ||
results['Manta'] = '<span style="color:#999999;\">N/A</span>' | ||
results['Strelka'] = '<span style="color:#999999;\">N/A</span>' | ||
results['FreeBayes'] = '<span style="color:#999999;\">N/A</span>' | ||
results['AlleleCount'] = '<span style="color:#999999;\">N/A</span>' | ||
results['R'] = '<span style="color:#999999;\">N/A</span>' | ||
results['ASCAT'] = '<span style="color:#999999;\">N/A</span>' | ||
results['SnpEff'] = '<span style="color:#999999;\">N/A</span>' | ||
results['VEP'] = '<span style="color:#999999;\">N/A</span>' | ||
results['FastQC'] = '<span style="color:#999999;\">N/A</span>' | ||
results['Qualimap'] = '<span style="color:#999999;\">N/A</span>' | ||
results['bcftools'] = '<span style="color:#999999;\">N/A</span>' | ||
results['vcftools'] = '<span style="color:#999999;\">N/A</span>' | ||
results['MultiQC'] = '<span style="color:#999999;\">N/A</span>' | ||
|
||
# Search each file using its regex | ||
for k, v in regexes.items(): | ||
try: | ||
with open(v[0]) as x: | ||
versions = x.read() | ||
match = re.search(v[1], versions) | ||
if match: | ||
results[k] = "v {}".format(match.group(1)) | ||
except Exception as FileNotFoundError: | ||
print("No such file:", v[0]) | ||
|
||
# Remove empty keys (defining them above ensures correct order) | ||
for k in ['Sarek', 'Nextflow', 'BWA', 'samtools', 'htslib', 'GATK', 'Picard', 'Manta', 'Strelka', 'FreeBayes', 'AlleleCount', 'R', 'ASCAT', 'SnpEff', 'VEP', 'FastQC', 'Qualimap', 'bcftools', 'vcftools', 'MultiQC']: | ||
if results[k] == '<span style="color:#999999;\">N/A</span>': | ||
del(results[k]) | ||
|
||
# Dump to YAML | ||
print (''' | ||
id: 'Sarek' | ||
order: -1000 | ||
section_href: 'https://github.com/SciLifeLab/Sarek' | ||
plot_type: 'html' | ||
description: 'tool versions are collected at run time from output.' | ||
data: | | ||
<dl class="dl-horizontal" style="margin-bottom:0;"> | ||
''') | ||
for k,v in results.items(): | ||
print(" <dt>{}</dt><dd>{}</dd>".format(k,v)) | ||
print (" </dl>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be possible to tidy up the configs here quite a bit with the new nextflow concept of
label
(in new versions of NF only)