add module for mykrobe predict and genotyphi parse (#1818)

* add module for mykrobe predict and genotyphi parse

* Update meta.yml

Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com>
This commit is contained in:
Robert A. Petit III 2022-09-26 08:18:04 -06:00 committed by GitHub
parent 876bb807af
commit 6d6e3a018f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 239 additions and 0 deletions

View file

@ -0,0 +1,33 @@
process GENOTYPHI_PARSE {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::genotyphi=1.9.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/genotyphi:1.9.1--hdfd78af_1':
'quay.io/biocontainers/genotyphi:1.9.1--hdfd78af_1' }"
input:
tuple val(meta), path(json)
output:
tuple val(meta), path("*.tsv"), emit: tsv
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}"
"""
parse_typhi_mykrobe.py \\
--jsons $json \\
--prefix ${prefix}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
genotyphi: \$(echo \$(genotyphi --version 2>&1) | sed 's/^.*GenoTyphi v//;' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,42 @@
name: "genotyphi_parse"
description: Genotype Salmonella Typhi from Mykrobe results
keywords:
- genotype
- Salmonella Typhi
tools:
- "genotyphi":
description: "Assign genotypes to Salmonella Typhi genomes based on VCF files (mapped to Typhi CT18 reference genome)"
homepage: "https://github.com/katholt/genotyphi"
documentation: "https://github.com/katholt/genotyphi"
tool_dev_url: "https://github.com/katholt/genotyphi"
doi: "https://github.com/katholt/genotyphi"
licence: "['GPL v3']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- json:
type: file
description: JSON formatted file of Mykrobe results
pattern: "*.json"
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"
- tsv:
type: file
description: A tab-delimited file of predicted genotypes
pattern: "*.tsv"
authors:
- "@rpetit3"

View file

@ -0,0 +1,41 @@
process MYKROBE_PREDICT {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::mykrobe=0.11.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mykrobe:0.11.0--py39h2add14b_1':
'quay.io/biocontainers/mykrobe:0.11.0--py39h2add14b_1' }"
input:
tuple val(meta), path(seqs)
val species
output:
tuple val(meta), path("${prefix}.csv") , emit: csv
tuple val(meta), path("${prefix}.json"), emit: json
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
"""
mykrobe \\
predict \\
$args \\
--species $species \\
--threads $task.cpus \\
--sample $prefix \\
--format json_and_csv \\
--output ${prefix} \\
--seq $seqs
cat <<-END_VERSIONS > versions.yml
"${task.process}":
mykrobe: \$(echo \$(mykrobe --version 2>&1) | sed 's/^.*mykrobe v//' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,51 @@
name: "mykrobe_predict"
description: AMR predictions for supported species
keywords:
- fastq
- bam
- antimicrobial resistance
tools:
- "mykrobe":
description: "Antibiotic resistance prediction in minutes"
homepage: "http://www.mykrobe.com/"
documentation: "https://github.com/Mykrobe-tools/mykrobe/wiki"
tool_dev_url: "https://github.com/Mykrobe-tools/mykrobe"
doi: "10.1038/ncomms10063"
licence: "['MIT']"
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- seqs:
type: file
description: BAM or FASTQ file
pattern: "*.{bam,fastq.gz,fq.gz}"
- species:
type: string
description: Species to make AMR prediction against
pattern: "*"
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"
- csv:
type: file
description: AMR predictions in CSV format
pattern: "*.csv"
- json:
type: file
description: AMR predictions in JSON format
pattern: "*.json"
authors:
- "@rpetit3"

View file

@ -1063,6 +1063,10 @@ genomescope2:
- modules/genomescope2/**
- tests/modules/genomescope2/**
genotyphi/parse:
- modules/genotyphi/parse/**
- tests/modules/genotyphi/parse/**
genrich:
- modules/genrich/**
- tests/modules/genrich/**
@ -1675,6 +1679,10 @@ muscle:
- modules/muscle/**
- tests/modules/muscle/**
mykrobe/predict:
- modules/mykrobe/predict/**
- tests/modules/mykrobe/predict/**
nanolyse:
- modules/nanolyse/**
- tests/modules/nanolyse/**

View file

@ -0,0 +1,17 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { MYKROBE_PREDICT } from '../../../../modules/mykrobe/predict/main.nf'
include { GENOTYPHI_PARSE } from '../../../../modules/genotyphi/parse/main.nf'
workflow test_mykrobe_predict {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
MYKROBE_PREDICT ( input, "typhi" )
GENOTYPHI_PARSE ( MYKROBE_PREDICT.out.json )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,12 @@
- name: genotyphi parse test_mykrobe_predict
command: nextflow run ./tests/modules/genotyphi/parse -entry test_mykrobe_predict -c ./tests/config/nextflow.config -c ./tests/modules/genotyphi/parse/nextflow.config
tags:
- genotyphi/parse
- genotyphi
files:
- path: output/genotyphi/test_predictResults.tsv
contains: ["genome", "confidence", "supported", "test", "NA"]
- path: output/mykrobe/test.csv
contains: ["susceptibility", "genotype_model", "variants", "test.paired_end.bam"]
- path: output/mykrobe/test.json
contains: ["susceptibility", "kmer_count", "files", "test.paired_end.bam"]

View file

@ -0,0 +1,15 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { MYKROBE_PREDICT } from '../../../../modules/mykrobe/predict/main.nf'
workflow test_mykrobe_predict {
input = [
[ id:'test', single_end:false ], // meta map
file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true)
]
MYKROBE_PREDICT ( input, "typhi" )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,10 @@
- name: mykrobe predict test_mykrobe_predict
command: nextflow run ./tests/modules/mykrobe/predict -entry test_mykrobe_predict -c ./tests/config/nextflow.config -c ./tests/modules/mykrobe/predict/nextflow.config
tags:
- mykrobe/predict
- mykrobe
files:
- path: output/mykrobe/test.csv
contains: ["susceptibility", "genotype_model", "variants", "test.paired_end.bam"]
- path: output/mykrobe/test.json
contains: ["susceptibility", "kmer_count", "files", "test.paired_end.bam"]