Merge pull request #1620 from mahesh-panchal/kat_hist

Add module kat hist
This commit is contained in:
Mahesh Binzer-Panchal 2022-05-25 00:23:38 +02:00 committed by GitHub
commit de74c0a83b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 189 additions and 0 deletions

42
modules/kat/hist/main.nf Normal file
View file

@ -0,0 +1,42 @@
process KAT_HIST {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::kat=2.4.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/kat:2.4.2--py38hfc5f9d8_2':
'quay.io/biocontainers/kat:2.4.2--py38hfc5f9d8_2' }"
input:
tuple val(meta), path(reads)
output:
tuple val(meta), path("*.hist") , emit: hist
tuple val(meta), path("*.hist.dist_analysis.json"), emit: json
tuple val(meta), path("*.png") , emit: png , optional: true
tuple val(meta), path("*.ps") , emit: ps , optional: true
tuple val(meta), path("*.pdf") , emit: pdf , optional: true
tuple val(meta), path("*-hash.jf*") , emit: jellyfish_hash, optional: true
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}"
"""
kat hist \\
--threads $task.cpus \\
--output_prefix ${prefix}.hist \\
$args \\
$reads
ls -l
cat <<-END_VERSIONS > versions.yml
"${task.process}":
kat: \$( kat hist --version | sed 's/kat //' )
END_VERSIONS
"""
}

64
modules/kat/hist/meta.yml Normal file
View file

@ -0,0 +1,64 @@
name: "kat_hist"
description: Creates a histogram of the number of distinct k-mers having a given frequency.
keywords:
- k-mer
- histogram
- count
tools:
- "kat":
description: "KAT is a suite of tools that analyse jellyfish hashes or sequence files (fasta or fastq) using kmer counts"
homepage: https://www.earlham.ac.uk/kat-tools
documentation: https://kat.readthedocs.io/en/latest/index.html
tool_dev_url: https://github.com/TGAC/KAT
doi: http://bioinformatics.oxfordjournals.org/content/early/2016/10/20/bioinformatics.btw663.abstract
licence: "['GPL v3']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
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"
- hist:
type: file
description: KAT histogram of k-mer counts
pattern: "*.hist"
- json:
type: file
description: KAT histogram summary of distance analysis
pattern: "*.hist.dist_analysis.json"
- png:
type: file
description: KAT plot of k-mer histogram in PNG format
pattern: "*.png"
- ps:
type: file
description: KAT plot of k-mer histogram in PS format
pattern: "*.ps"
- pdf:
type: file
description: KAT plot of k-mer histogram in PDF format
pattern: "*.pdf"
- jellyfish_hash:
type: file
description: Jellyfish hash file
pattern: "*-hist.jf*"
authors:
- "@mahesh-panchal"

View file

@ -1093,6 +1093,10 @@ kallistobustools/ref:
- modules/kallistobustools/ref/** - modules/kallistobustools/ref/**
- tests/modules/kallistobustools/ref/** - tests/modules/kallistobustools/ref/**
kat/hist:
- modules/kat/hist/**
- tests/modules/kat/hist/**
khmer/normalizebymedian: khmer/normalizebymedian:
- modules/khmer/normalizebymedian/** - modules/khmer/normalizebymedian/**
- tests/modules/khmer/normalizebymedian/** - tests/modules/khmer/normalizebymedian/**

View file

@ -0,0 +1,28 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { KAT_HIST } from '../../../../modules/kat/hist/main.nf'
workflow test_kat_hist_single_end {
input = [
[ id:'test', single_end:true ], // meta map
file(params.test_data['homo_sapiens']['illumina']['test2_1_fastq_gz'], checkIfExists: true)
]
KAT_HIST ( input )
}
workflow test_kat_hist_paired_end {
input = [
[ id:'test', single_end:false ], // meta map
[
file(params.test_data['homo_sapiens']['illumina']['test2_1_fastq_gz'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test2_2_fastq_gz'], checkIfExists: true),
]
]
KAT_HIST ( input )
}

View file

@ -0,0 +1,9 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: 'test_kat_hist_single_end:KAT_HIST' {
ext.args = '-d'
}
}

View file

@ -0,0 +1,42 @@
- name: kat hist test_kat_hist_single_end
command: nextflow run tests/modules/kat/hist -entry test_kat_hist_single_end -c tests/config/nextflow.config
tags:
- kat/hist
- kat
files:
- path: output/kat/test.hist
md5sum: c6eba52b3a2653a684577a8ae20b74c1
- path: output/kat/test.hist-hash.jf27
- path: output/kat/test.hist.dist_analysis.json
# md5sum: 52a5a2d91c71b940f36f1f0a7fd5ef10 # This is variable for an unknown reason
contains:
- "nb_peaks"
- "global_minima"
- "global_maxima"
- "mean_freq"
- "est_genome_size"
- "est_het_rate"
- path: output/kat/test.hist.png
md5sum: 49861ef1a265e0edde3550b39c64a274
- path: output/kat/versions.yml
- name: kat hist test_kat_hist_paired_end
command: nextflow run tests/modules/kat/hist -entry test_kat_hist_paired_end -c tests/config/nextflow.config
tags:
- kat/hist
- kat
files:
- path: output/kat/test.hist
md5sum: 91429091e74b1718051591d83a1ccb5d
- path: output/kat/test.hist.dist_analysis.json
# md5sum: 8b0dabeaff4ba706b33aa8964d687e13 # This is variable for an unknown reason
contains:
- "nb_peaks"
- "global_minima"
- "global_maxima"
- "mean_freq"
- "est_genome_size"
- "est_het_rate"
- path: output/kat/test.hist.png
md5sum: e20774d0d2b979cb6ead7b7fb5ad36d9
- path: output/kat/versions.yml