Skip to content
This repository has been archived by the owner on Jan 27, 2020. It is now read-only.

Commit

Permalink
rework version gathering
Browse files Browse the repository at this point in the history
  • Loading branch information
maxulysse committed Sep 6, 2018
1 parent 4fa19c8 commit 8a2a181
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 285 deletions.
28 changes: 0 additions & 28 deletions annotate.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ kate: syntax groovy; space-indent on; indent-width 2;
================================================================================
*/

// Check that Nextflow version is up to date enough
// try / throw / catch works for NF versions < 0.25 when this was implemented
try {
if( ! nextflow.version.matches(">= ${params.nfRequiredVersion}") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version ${params.nfRequiredVersion} required! You are running v${workflow.nextflow.version}.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please update Nextflow.\n" +
"============================================================"
}

if (params.help) exit 0, helpMessage()
if (!SarekUtils.isAllowedParams(params)) exit 1, "params unknown, see --help for more information"
if (!checkUppmaxProject()) exit 1, "No UPPMAX project ID found! Use --project <UPPMAX Project ID>"
Expand Down Expand Up @@ -279,27 +265,13 @@ if (params.verbose) vcfCompressedoutput = vcfCompressedoutput.view {
"Index : ${it[3].fileName}"
}

process GetVersionBCFtools {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: !params.noReports
script: QC.getVersionBCFtools()
}

process GetVersionSnpEFF {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: 'snpeff' in tools || 'merge' in tools
script: QC.getVersionSnpEFF()
}

process GetVersionVCFtools {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: !params.noReports
script: QC.getVersionVCFtools()
}

process GetVersionVEP {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
Expand Down
26 changes: 13 additions & 13 deletions bin/scrape_tool_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'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+)"],
'GATK': ['v_gatk.txt', r"Version:(\S+)"],
'htslib': ['v_samtools.txt', r"htslib (\S+)"],
'Manta': ['v_manta.txt', r"([0-9.]+)"],
'MultiQC': ['v_multiqc.txt', r"multiqc, version (\S+)"],
Expand All @@ -28,24 +28,24 @@
results = OrderedDict()
results['Sarek'] = '<span style="color:#999999;\">N/A</span>'
results['Nextflow'] = '<span style="color:#999999;\">N/A</span>'
results['AlleleCount'] = '<span style="color:#999999;\">N/A</span>'
results['ASCAT'] = '<span style="color:#999999;\">N/A</span>'
results['bcftools'] = '<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['FastQC'] = '<span style="color:#999999;\">N/A</span>'
results['FreeBayes'] = '<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['htslib'] = '<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['MultiQC'] = '<span style="color:#999999;\">N/A</span>'
results['Picard'] = '<span style="color:#999999;\">N/A</span>'
results['Qualimap'] = '<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['samtools'] = '<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['Strelka'] = '<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>'
results['VEP'] = '<span style="color:#999999;\">N/A</span>'

# Search each file using its regex
for k, v in regexes.items():
Expand Down
14 changes: 0 additions & 14 deletions buildContainers.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ kate: syntax groovy; space-indent on; indent-width 2;
================================================================================
*/

// Check that Nextflow version is up to date enough
// try / throw / catch works for NF versions < 0.25 when this was implemented
try {
if( ! nextflow.version.matches(">= ${params.nfRequiredVersion}") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version ${params.nfRequiredVersion} required! You are running v${workflow.nextflow.version}.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please update Nextflow.\n" +
"============================================================"
}

if (params.help) exit 0, helpMessage()
if (!SarekUtils.isAllowedParams(params)) exit 1, "params unknown, see --help for more information"
if (!checkUppmaxProject()) exit 1, "No UPPMAX project ID found! Use --project <UPPMAX Project ID>"
Expand Down
14 changes: 0 additions & 14 deletions buildReferences.nf
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ kate: syntax groovy; space-indent on; indent-width 2;
================================================================================
*/

// Check that Nextflow version is up to date enough
// try / throw / catch works for NF versions < 0.25 when this was implemented
try {
if( ! nextflow.version.matches(">= ${params.nfRequiredVersion}") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version ${params.nfRequiredVersion} required! You are running v${workflow.nextflow.version}.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please update Nextflow.\n" +
"============================================================"
}

if (params.help) exit 0, helpMessage()
if (!SarekUtils.isAllowedParams(params)) exit 1, "params unknown, see --help for more information"
if (!checkUppmaxProject()) exit 1, "No UPPMAX project ID found! Use --project <UPPMAX Project ID>"
Expand Down
49 changes: 0 additions & 49 deletions germlineVC.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ kate: syntax groovy; space-indent on; indent-width 2;
================================================================================
*/

// Check that Nextflow version is up to date enough
// try / throw / catch works for NF versions < 0.25 when this was implemented
try {
if( ! nextflow.version.matches(">= ${params.nfRequiredVersion}") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version ${params.nfRequiredVersion} required! You are running v${workflow.nextflow.version}.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please update Nextflow.\n" +
"============================================================"
}

if (params.help) exit 0, helpMessage()
if (!SarekUtils.isAllowedParams(params)) exit 1, "params unknown, see --help for more information"
if (!checkUppmaxProject()) exit 1, "No UPPMAX project ID found! Use --project <UPPMAX Project ID>"
Expand Down Expand Up @@ -590,41 +576,6 @@ if (params.verbose) vcfReport = vcfReport.view {

vcfReport.close()

process GetVersionGATK {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: 'haplotypecaller' in tools && !params.onlyQC
script: QC.getVersionGATK()
}

process GetVersionStrelka {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: 'strelka' in tools && !params.onlyQC
script: QC.getVersionStrelka()
}

process GetVersionManta {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: 'manta' in tools && !params.onlyQC
script: QC.getVersionManta()
}

process GetVersionBCFtools {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: !params.noReports
script: QC.getVersionBCFtools()
}

process GetVersionVCFtools {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: !params.noReports
script: QC.getVersionVCFtools()
}

/*
================================================================================
= F U N C T I O N S =
Expand Down
34 changes: 0 additions & 34 deletions lib/QC.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,6 @@ class QC {
"""
}

// Get BCFtools version
static def getVersionBCFtools() {
"""
bcftools version > v_bcftools.txt
"""
}

// Get GATK version
static def getVersionGATK() {
"""
gatk ApplyBQSR --help 2>&1| awk -F/ '/java/{for(i=1;i<=NF;i++){if(\$i~/gatk4/){sub("gatk4-","",\$i);print \$i>"v_gatk.txt"}}}'
"""
}

// Get Manta version
static def getVersionManta() {
"""
configManta.py --version > v_manta.txt
"""
}

// Get SnpEFF version
static def getVersionSnpEFF() {
Expand All @@ -77,20 +57,6 @@ class QC {
"""
}

// Get Strelka version
static def getVersionStrelka() {
"""
configureStrelkaGermlineWorkflow.py --version > v_strelka.txt
"""
}

// Get VCFtools version
static def getVersionVCFtools() {
"""
vcftools --version > v_vcftools.txt
"""
}

// Get VEP version
static def getVersionVEP() {
"""
Expand Down
58 changes: 1 addition & 57 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ kate: syntax groovy; space-indent on; indent-width 2;
================================================================================
*/

// Check that Nextflow version is up to date enough
// try / throw / catch works for NF versions < 0.25 when this was implemented
try {
if( ! nextflow.version.matches(">= ${params.nfRequiredVersion}") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version ${params.nfRequiredVersion} required! You are running v${workflow.nextflow.version}.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please update Nextflow.\n" +
"============================================================"
}

if (params.help) exit 0, helpMessage()
if (!SarekUtils.isAllowedParams(params)) exit 1, "params unknown, see --help for more information"
if (!checkUppmaxProject()) exit 1, "No UPPMAX project ID found! Use --project <UPPMAX Project ID>"
Expand Down Expand Up @@ -393,7 +379,7 @@ process RecalibrateBam {
--output ${idSample}.recal.bam \
-L ${intervals} \
--create-output-bam-index true \
--bqsr-recal-file ${recalibrationReport}
--bqsr-recal-file ${recalibrationReport}
"""
}
// Creating a TSV file to restart from this step
Expand Down Expand Up @@ -452,48 +438,6 @@ if (params.verbose) bamQCreport = bamQCreport.view {
Dir : [${it.fileName}]"
}

process GetVersionBamQC {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: !params.noReports && !params.noBAMQC

script:
"""
qualimap --version &> v_qualimap.txt
"""
}

process GetVersionBWAsamtools {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: step == 'mapping' && !params.onlyQC

script:
"""
bwa &> v_bwa.txt 2>&1 || true
samtools --version &> v_samtools.txt
"""
}

process GetVersionFastQC {
publishDir directoryMap.version, mode: 'link'
output:
file("v_fastqc.txt")
when: step == 'mapping' && !params.noReports

script:
"""
fastqc -v > v_fastqc.txt
"""
}

process GetVersionGATK {
publishDir directoryMap.version, mode: 'link'
output: file("v_*.txt")
when: !params.onlyQC
script: QC.getVersionGATK()
}

/*
================================================================================
= F U N C T I O N S =
Expand Down
25 changes: 11 additions & 14 deletions runMultiQC.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ kate: syntax groovy; space-indent on; indent-width 2;
================================================================================
*/

// Check that Nextflow version is up to date enough
// try / throw / catch works for NF versions < 0.25 when this was implemented
try {
if( ! nextflow.version.matches(">= ${params.nfRequiredVersion}") ){
throw GroovyException('Nextflow version too old')
}
} catch (all) {
log.error "====================================================\n" +
" Nextflow version ${params.nfRequiredVersion} required! You are running v${workflow.nextflow.version}.\n" +
" Pipeline execution will continue, but things may break.\n" +
" Please update Nextflow.\n" +
"============================================================"
}

if (params.help) exit 0, helpMessage()
if (!SarekUtils.isAllowedParams(params)) exit 1, "params unknown, see --help for more information"
if (!checkUppmaxProject()) exit 1, "No UPPMAX project ID found! Use --project <UPPMAX Project ID>"
Expand All @@ -73,9 +59,20 @@ process GetVersionAll {

script:
"""
bcftools version > v_bcftools.txt
bwa &> v_bwa.txt 2>&1 || true
configManta.py --version > v_manta.txt
configureStrelkaGermlineWorkflow.py --version > v_strelka.txt
echo "${params.version}" &> v_sarek.txt
echo "${workflow.nextflow.version}" &> v_nextflow.txt
fastqc -v > v_fastqc.txt
freebayes --version > v_freebayes.txt
gatk ApplyBQSR --help 2>&1 | grep Version: > v_gatk.txt
multiqc --version &> v_multiqc.txt
qualimap --version &> v_qualimap.txt
samtools --version &> v_samtools.txt
vcftools --version > v_vcftools.txt
scrape_tool_versions.py &> tool_versions_mqc.yaml
"""
}
Expand Down
Loading

0 comments on commit 8a2a181

Please sign in to comment.