Skip to content

Commit

Permalink
Add software version scrape (#42)
Browse files Browse the repository at this point in the history
### Added
Software versions file
  • Loading branch information
talnor authored Dec 14, 2021
1 parent c2bf7dd commit b359185
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 1 deletion.
46 changes: 46 additions & 0 deletions bin/get_versions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python
import os
import sys
import re

version_regex = {
"artic": r"artic (\S+)",
"bcftools": r"bcftools (\S+)",
"bwa": r"Version: (\S+)",
"constellations": r"constellations v(\S+)",
"fastqc": r"FastQC v(\S+)",
"freebayes": r"version: v(\d\.\d\.\d+)",
"gofasta": r"gofasta version (\S+)",
"ivar": r"iVar version (\S+)",
"mafft": r"v(\S+)",
"medaka": r"medaka (\S+)",
"minimap2": r"(\S+)",
"multiqc": r"multiqc, version (\S+)",
"muscle": r"MUSCLE (\S+)",
"nanopolish": r"nanopolish version (\S+)",
"nextclade": r"(\S+)",
"pango_designation": r"pango-designation (\S+)",
"pangoLEARN": r"pangoLEARN (\S+)",
"pangolin": r"pangolin (\S+)",
"picard": r"Version:(\S+)",
"porechop": r"(\S+)",
"python": r"Python (\S+)",
"samtools": r"samtools (\S+)",
"scorpio": r"scorpio (\S+)",
"snakemake": r"(\S+)",
"trim_galore": r"version (\S+)",
"usher": r"UShER \((\S+)\)"
}
# Create csv file for all versions
output = sys.argv[1]
with open(output, "w") as out:
for tool, regex in version_regex.items():
# Search for version number
version_file = "version_{}.txt".format(tool)
if os.path.isfile(version_file):
with open(version_file) as f:
contents = f.read()
match = re.search(regex, contents)
if match:
# Add version number to output
out.write("{},{}\n".format(tool, match.group(1)))
54 changes: 54 additions & 0 deletions modules/analysis.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,57 @@ process makeReport {
makeReport.py ${sampleName}
"""
}

process versions {
publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "*", mode: 'copy'

output:
file "*versions.csv"

script:
if ( params.illumina )
"""
bcftools -v > version_bcftools.txt
bwa > version_bwa.txt 2>&1 || true
scorpio -cv > version_constellations.txt
fastqc -v > version_fastqc.txt
gofasta -v > version_gofasta.txt
freebayes --version > version_freebayes.txt
ivar version > version_ivar.txt
multiqc --version > version_multiqc.txt
nextclade --version > version_nextclade.txt
pangolin -dv > version_pango_designation.txt
pangolin -pv > version_pangoLEARN.txt
pangolin -v > version_pangolin.txt
picard CollectWgsMetrics -version > version_picard.txt 2>&1 || true
python --version > version_python.txt
samtools --version > version_samtools.txt
scorpio -v > version_scorpio.txt
snakemake -v > version_snakemake.txt
trim_galore -v > version_trim_galore.txt
usher --version > version_usher.txt
get_versions.py ${params.prefix}_versions.csv
"""
else if ( params.medaka || params.nanopolish )
"""
artic --version > version_artic.txt
bwa > version_bwa.txt 2>&1 || true
scorpio -cv > version_constellations.txt
gofasta -v > version_gofasta.txt
mafft --version > version_mafft.txt 2>&1
medaka --version > version_medaka.txt
minimap2 --version > version_minimap2.txt
muscle -version > version_muscle.txt
nanopolish --version > version_nanopolish.txt
nextclade --version > version_nextclade.txt
pangolin -dv > version_pango_designation.txt
pangolin -pv > version_pangoLEARN.txt
pangolin -v > version_pangolin.txt
porechop --version > version_porechop.txt
python --version > version_python.txt
samtools --version > version_samtools.txt
scorpio -v > version_scorpio.txt
snakemake -v > version_snakemake.txt
get_versions.py ${params.prefix}_versions.csv
"""
}
13 changes: 13 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ profiles {
docker.enabled = true
fixOwnership = true
runOptions = "-u \$(id -u):\$(id -g)"
if ( params.medaka || params.nanopolish ){
process {
container="genomicmedicinesweden/gms-artic-nanopore:latest"
}
}
else {
process {
container="genomicmedicinesweden/gms-artic-illumina:latest"
}
}
}
singularity {
singularity.enabled = true
Expand Down Expand Up @@ -91,6 +101,9 @@ profiles {
withName:makeReport {
container="docker://genomicmedicinesweden/gms-artic-nanopore:latest"
}
withName:versions {
container="docker://genomicmedicinesweden/gms-artic-nanopore:latest"
}
}
} else if (params.illumina) {
process.container = "docker://genomicmedicinesweden/gms-artic-illumina:latest"
Expand Down
5 changes: 4 additions & 1 deletion workflows/articNcovNanopore.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include {pangolinTyping} from '../modules/typing.nf'
include {nextclade} from '../modules/typing.nf'
include {getVariantDefinitions} from '../modules/analysis.nf'
include {makeReport} from '../modules/analysis.nf'
include {versions} from '../modules/analysis.nf'

include {bamToCram} from '../modules/out.nf'

Expand All @@ -33,8 +34,10 @@ workflow sequenceAnalysisNanopolish {
ch_seqSummary

main:
versions()

articDownloadScheme()

articGuppyPlex(ch_runFastqDirs.flatten())

articMinIONNanopolish(articGuppyPlex.out.fastq
Expand Down
3 changes: 3 additions & 0 deletions workflows/illuminaNcov.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include {pangolinTyping} from '../modules/typing.nf'
include {nextclade} from '../modules/typing.nf'
include {getVariantDefinitions} from '../modules/analysis.nf'
include {makeReport} from '../modules/analysis.nf'
include {versions} from '../modules/analysis.nf'
include {cramToFastq} from '../modules/illumina.nf'

include {makeQCCSV} from '../modules/qc.nf'
Expand Down Expand Up @@ -99,6 +100,8 @@ workflow sequenceAnalysis {
ch_bedFile

main:
versions()

fastqc(ch_filePairs)

readTrimming(ch_filePairs)
Expand Down

0 comments on commit b359185

Please sign in to comment.