Skip to content

Commit

Permalink
Merge pull request #8 from bio-raum/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
marchoeppner authored Oct 2, 2024
2 parents 2ef1f25 + 5d3c162 commit 9ef1779
Show file tree
Hide file tree
Showing 38 changed files with 1,570 additions and 33 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ If you are really impatient, check out our [quickstart](docs/quickstart.md) guid
5. [Software](docs/software.md)
5. [Troubleshooting](docs/troubleshooting.md)
6. [Developer guide](docs/developer.md)

## Developer team

FooDMe2 is developed and supported by the following people and organizations:

[Marc Höppner](https://github.com/marchoeppner), Landeslabor Schleswig-Holstein, [LSH](https://www.schleswig-holstein.de/DE/landesregierung/ministerien-behoerden/LLABOR)
27 changes: 26 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
withName: SAMTOOLS_MERGE {
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/bam" },
mode: params.publish_dir_mode,
enabled: false,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
withName: 'BWAMEM2_MEM|BWAMEM2_INDEX' {
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/bwamem" },
Expand Down Expand Up @@ -175,6 +183,22 @@ process {
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
withName: 'SNIPPY_RUN' {
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/variants/" },
mode: params.publish_dir_mode,
enabled: true,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
withName: 'TABIX_TABIX|BCFTOOLS_STATS' {
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/variants/${meta.sample_id}" },
mode: params.publish_dir_mode,
enabled: true,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
withName: FASTQC {
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/qc/fastqc" },
Expand Down Expand Up @@ -430,6 +454,7 @@ process {
]
}
withName: 'CHEWBBACA_ALLELECALL_SINGLE' {
ext.args = "--no-inferred"
publishDir = [
path: { "${params.outdir}/samples/${meta.sample_id}/chewbbaca" },
mode: params.publish_dir_mode,
Expand All @@ -446,7 +471,7 @@ process {
]
}
withName: 'CHEWBBACA_ALLELECALL' {

ext.args = "--no-inferred"
publishDir = [
path: { "${params.outdir}/cgMLST/chewbbaca/${meta.sample_id}" },
mode: params.publish_dir_mode,
Expand Down
2 changes: 2 additions & 0 deletions conf/multiqc_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ report_section_order:
remove_sections:
- mosdepth-coverage-dist-cov
- mosdepth-coverage-per-contig-section
- bcftools-stats_variant_quality_plot
- bcftools-stats_indel_plot
19 changes: 13 additions & 6 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ params.version = workflow.manifest.version

summary = [:]

summary["MaxContigs"] = params.skip_failed ? params.max_contigs : "Not applied"
summary["Busco"] = params.busco_lineage
summary["ConfindR DB"] = params.confindr_db ? params.confindr_db : "built-in"
summary["Max Coverage"] = params.subsample_reads ? params.max_coverage : "Not applied"
summary["Genome size"] = params.subsample_reads ? params.genome_size : "Not applied"
summary["Shovill assembler"] = params.shovill_assembler
summary["AMRfinder"] = [:]
summary["Abricate"] = [:]
summary["AMRfinder"]["min_cov"] = params.arg_amrfinderplus_coveragemin
summary["AMRfinder"]["min_id"] = params.arg_amrfinderplus_identmin
summary["Abricate"]["min_id"] = params.arg_abricate_minid
summary["Abricate"]["min_cov"] = params.arg_abricate_mincov

run_name = (params.run_name == false) ? "${workflow.sessionId}" : "${params.run_name}"

WorkflowMain.initialise(workflow, params, log)
Expand Down Expand Up @@ -50,10 +63,6 @@ workflow.onComplete {
emailFields['session'] = workflow.sessionId
emailFields['runName'] = run_name
emailFields['Subsampling'] = params.subsample_reads
if (params.subsample_reads) {
emailFields['Maximum coverage'] = params.max_coverage
emailFields['Genome size'] = params.genome_size
}
emailFields['success'] = workflow.success
emailFields['dateStarted'] = workflow.start
emailFields['dateComplete'] = workflow.complete
Expand Down Expand Up @@ -103,13 +112,11 @@ workflow.onComplete {
if (workflow.success && !params.skip_multiqc) {
mqcReport = multiqc_report.getVal()
if (mqcReport.getClass() == ArrayList) {
// TODO: Update name of pipeline
log.warn "[bio-raum/gabi] Found multiple reports from process 'multiqc', will use only one"
mqcReport = mqcReport[0]
}
}
} catch (all) {
// TODO: Update name of pipeline
log.warn '[bio-raum/gabi] Could not attach MultiQC report to summary email'
}

Expand Down
8 changes: 8 additions & 0 deletions modules/bcftools/stats/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: bcftools_stats
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::bcftools=1.20
- bioconda::htslib=1.20
34 changes: 34 additions & 0 deletions modules/bcftools/stats/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
process BCFTOOLS_STATS {
tag "$meta.sample_id"
label 'short_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bcftools:1.20--h8b25389_0':
'quay.io/biocontainers/bcftools:1.20--h8b25389_0' }"

input:
tuple val(meta), path(vcf), path(tbi)

output:
tuple val(meta), path("*stats.txt"), emit: stats
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.sample_id}"

"""
bcftools stats \\
$args \\
$vcf > ${prefix}.bcftools_stats.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}
77 changes: 77 additions & 0 deletions modules/bcftools/stats/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: bcftools_stats
description: Generates stats from VCF files
keywords:
- variant calling
- stats
- VCF
tools:
- stats:
description: |
Parses VCF or BCF and produces text file stats which is suitable for
machine processing and can be plotted using plot-vcfstats.
homepage: http://samtools.github.io/bcftools/bcftools.html
documentation: http://www.htslib.org/doc/bcftools.html
doi: 10.1093/bioinformatics/btp352
licence: ["MIT"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: VCF input file
pattern: "*.{vcf}"
- tbi:
type: file
description: |
The tab index for the VCF file to be inspected. Optional: only required when parameter regions is chosen.
pattern: "*.tbi"
- regions:
type: file
description: |
Optionally, restrict the operation to regions listed in this file. (VCF, BED or tab-delimited)
- targets:
type: file
description: |
Optionally, restrict the operation to regions listed in this file (doesn't rely upon tbi index files)
- samples:
type: file
description: |
Optional, file of sample names to be included or excluded.
e.g. 'file.tsv'
- exons:
type: file
description: |
Tab-delimited file with exons for indel frameshifts (chr,beg,end; 1-based, inclusive, optionally bgzip compressed).
e.g. 'exons.tsv.gz'
- fasta:
type: file
description: |
Faidx indexed reference sequence file to determine INDEL context.
e.g. 'reference.fa'
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- stats:
type: file
description: Text output file containing stats
pattern: "*_{stats.txt}"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"
- "@SusiJo"
- "@TCLamnidis"
maintainers:
- "@joseespinosa"
- "@drpatelh"
- "@SusiJo"
- "@TCLamnidis"
Loading

0 comments on commit 9ef1779

Please sign in to comment.