Skip to content

Commit

Permalink
Huge effort to finally update modules done :)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaqManzano committed Aug 17, 2023
1 parent 4e1779d commit 6b39dd8
Show file tree
Hide file tree
Showing 12 changed files with 715 additions and 0 deletions.
39 changes: 39 additions & 0 deletions modules/local/gatk4/filtersamreads/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
process GATK4_FILTERSAMREADS {
tag "$meta.id"
label 'process_low'

conda (params.enable_conda ? "bioconda::gatk4=4.2.6.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/gatk4:4.2.6.1--hdfd78af_0':
'quay.io/biocontainers/gatk4:4.2.6.1--hdfd78af_0' }"

input:
tuple val(meta), path(bam), path(bai), path(read_ids)
val fasta // treat it as a string because FilterSamReads is unable to solve softlinking

output:
tuple val(meta), path("*.bam"), path("*.bai") , emit: bam
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.id}"
def fastastr = fasta[0].toString()

"""
gatk FilterSamReads \\
--INPUT $bam \\
--OUTPUT ${prefix}.bam \\
--TMP_DIR . \\
-R ${fastastr} \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
gatk4: \$(echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//')
END_VERSIONS
"""
}
50 changes: 50 additions & 0 deletions modules/local/gatk4/filtersamreads/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: gatk4_filtersamreads
description: |
Subsets reads from a SAM or BAM file by applying one of several filters.
keywords:
- gatk4
- reads
- BAM
- SAM
tools:
- gatk4:
description: |
Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools
with a primary focus on variant discovery and genotyping. Its powerful processing engine
and high-performance computing features make it capable of taking on projects of any size.
homepage: https://gatk.broadinstitute.org/hc/en-us
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
doi: 10.1158/1538-7445.AM2017-3590

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- bam:
type: file
description: compressed vcf file of mutect2calls
pattern: "*.bam"
- read_ids:
type: file
description: File with read ids to keep
pattern: "*.txt"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- bam:
type: file
description: compressed vcf file of mutect2calls
pattern: "*.bam"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@RaqManzano"
92 changes: 92 additions & 0 deletions modules/local/sage/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
def VERSION = '3.1' // Version information not provided by tool on CLI

process SAGE {
tag "$meta.id"
label 'process_low'

conda (params.enable_conda ? "bioconda::hmftools-sage=3.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/hmftools-sage:3.1--hdfd78af_0' :
'quay.io/biocontainers/hmftools-sage:3.1--hdfd78af_0' }"

input:
tuple val(meta), path(normal), path(normal_index), path(tumor), path(tumor_index), path(intervals)
path fasta
path fasta_fai
path dict
path highconfidence
path actionablepanel
path knownhot
path ensbl_sage

output:
tuple val(meta), path("*.vcf"), emit: vcf
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.id}"
def reference = normal ? "-reference ${meta.normal_id} -reference_bam ${normal}" : ""
def HighConfidence = highconfidence ? "-high_confidence_bed ${highconfidence}" : ""
def ActionableCodingPanel = actionablepanel ? "-panel_bed ${actionablepanel}" : ""
def KnownHotspots = knownhot ? "-hotspots ${knownhot}" : ""
def avail_mem = 4
if (!task.memory) {
log.info '[SAGE] Available memory not known - defaulting to 4GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
if (intervals){ // If no reads the intervals don't work in sage
"""
export _JAVA_OPTIONS="-Xmx${avail_mem}g"
INTER=\$(sed -E 's/\\s+0\\s+/\\t1\\t/g' $intervals | grep -v chrM | sed 's/\t/:/g' | paste -s -d ';')
SAGE \\
-out ${prefix}.vcf \\
-ref_genome $fasta \\
-threads $task.cpus \\
-tumor ${meta.tumor_id} \\
-tumor_bam ${tumor} \\
$reference \\
-ensembl_data_dir $ensbl_sage \\
$HighConfidence \\
$ActionableCodingPanel \\
$KnownHotspots \\
-specific_regions \$INTER \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
sage: $VERSION
END_VERSIONS
"""

} else {
"""
export _JAVA_OPTIONS="-Xmx${avail_mem}g"
SAGE \\
-out ${prefix}.vcf \\
-ref_genome $fasta \\
-threads $task.cpus \\
-tumor ${meta.tumor_id} \\
-tumor_bam ${tumor} \\
$reference \\
-ensembl_data_dir $ensbl_sage \\
$HighConfidence \\
$ActionableCodingPanel \\
$KnownHotspots \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
sage: $VERSION
END_VERSIONS
"""
}



}
77 changes: 77 additions & 0 deletions modules/local/sage/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: sage
description: SAGE is a precise and highly sensitive somatic SNV, MNV and small INDEL caller. It has been optimised for 100x tumor / 40x normal coverage, but has a flexible set of filters that can be adapted to lower or higher depth coverage.
keywords:
- variant caller
- SNP
- indels
- somatic variant calling
- hmftools

tools:
- sage:
description: SAGE is a precise and highly sensitive somatic SNV, MNV and small INDEL caller.
homepage: https://github.com/hartwigmedical/hmftools/blob/master/sage/README.md
documentation: https://github.com/hartwigmedical/hmftools/tree/master/sage
tool_dev_url: https://github.com/hartwigmedical/hmftools/tree/master/sage
licence: ["GPL-3.0"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- normal:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- normal_index:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai}"
- tumor:
type: file
description: BAM/CRAM/SAM file
pattern: "*.{bam,cram,sam}"
- tumor_index:
type: file
description: BAM/CRAM/SAM index file
pattern: "*.{bai,crai}"
- intervals:
type: file
description: BED file for intervals
pattern: "*.bed"
- fasta:
type: file
description: reference fasta file
pattern: ".{fa,fa.gz,fasta,fasta.gz}"
- highconfidence:
type: file
description: Optional.
pattern: "*.bed"
- actionablepanel:
type: file
description: Optional.
pattern: "*.bed"
- knownhot:
type: file
description: Optional.
pattern: "*.bed"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: Compressed VCF file
pattern: "*.vcf.gz"
- version:
type: file
description: File containing software version
pattern: "*.{version.txt}"

authors:
- "@RaqManzano"
34 changes: 34 additions & 0 deletions modules/local/vcflib/filter/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
process VCFFILTER {
tag "$meta.id"
label 'process_low'

conda (params.enable_conda ? "bioconda::vcftools=0.1.16" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/vcflib:1.0.3--hecb563c_1' :
'quay.io/biocontainers/vcflib:1.0.3--hecb563c_1' }"

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

output:
tuple val(meta), path("*.vcf.gz") , emit: vcf
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.id}"
"""
gunzip -c $vcf | vcffilter \\
$args > ${prefix}.vcf
gzip ${prefix}.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
vcffilter: \$(echo \$(vcffilter 2>&1) | sed 's/^.*vcflib ( //;s/).*//' | cut -f2 -d ' ')
END_VERSIONS
"""
}
45 changes: 45 additions & 0 deletions modules/local/vcflib/filter/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: vcffilter
description: VCF filter the specified vcf file using the set of filters

keywords:
- VCF
- filter
- variant calling
tools:
- vcffilter:
description: VCF filter the specified vcf file using the set of filters
homepage: https://github.com/vcflib/vcflib
documentation: https://github.com/vcflib/vcflib
tool_dev_url: https://github.com/vcflib/vcflib
doi: https://doi.org/10.1101/2021.05.21.445151
licence: ["MIT"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: vcf file (optional)
pattern: "*.vcf.gz"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- vcf:
type: file
description: vcf file (optional)
pattern: "*.vcf.gz"


authors:
- "@RaqManzano"
Loading

0 comments on commit 6b39dd8

Please sign in to comment.