Remove params call in ivar variants module (#1203)

* Remove params call in ivar variants module

* Update main.nf
This commit is contained in:
Harshil Patel 2022-01-12 16:43:26 +00:00 committed by GitHub
parent 598d7abdb2
commit b4c6b430d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 27 deletions

View file

@ -11,6 +11,7 @@ process IVAR_VARIANTS {
tuple val(meta), path(bam) tuple val(meta), path(bam)
path fasta path fasta
path gff path gff
val save_mpileup
output: output:
tuple val(meta), path("*.tsv") , emit: tsv tuple val(meta), path("*.tsv") , emit: tsv
@ -21,14 +22,14 @@ process IVAR_VARIANTS {
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: '' def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}" def prefix = task.ext.prefix ?: "${meta.id}"
def save_mpileup = params.save_mpileup ? "tee ${prefix}.mpileup |" : "" def features = gff ? "-g $gff" : ""
def features = params.gff ? "-g $gff" : "" def mpileup = save_mpileup ? "tee ${prefix}.mpileup |" : ""
""" """
samtools mpileup \\ samtools mpileup \\
$args2 \\ $args2 \\
--reference $fasta \\ --reference $fasta \\
$bam | \\ $bam | \\
$save_mpileup \\ $mpileup \\
ivar variants \\ ivar variants \\
$args \\ $args \\
$features \\ $features \\

View file

@ -29,6 +29,9 @@ input:
type: file type: file
description: A GFF file in the GFF3 format can be supplied to specify coordinates of open reading frames (ORFs). In absence of GFF file, amino acid translation will not be done. description: A GFF file in the GFF3 format can be supplied to specify coordinates of open reading frames (ORFs). In absence of GFF file, amino acid translation will not be done.
patter: "*.gff" patter: "*.gff"
- save_mpileup:
type: boolean
description: Save mpileup file generated by ivar variants
output: output:
- meta: - meta:
type: map type: map

View file

@ -5,40 +5,40 @@ nextflow.enable.dsl = 2
include { IVAR_VARIANTS } from '../../../../modules/ivar/variants/main.nf' include { IVAR_VARIANTS } from '../../../../modules/ivar/variants/main.nf'
workflow test_ivar_variants_no_gff_no_mpileup { workflow test_ivar_variants_no_gff_no_mpileup {
params.gff = false
params.save_mpileup = false
input = [ [ id:'test'], input = [
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) [ id:'test'],
] file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
dummy = file("dummy_file.txt") gff = []
save_mpileup = false
IVAR_VARIANTS ( input, fasta, dummy )
IVAR_VARIANTS ( input, fasta, gff, save_mpileup )
} }
workflow test_ivar_variants_no_gff_with_mpileup { workflow test_ivar_variants_no_gff_with_mpileup {
params.gff = false
params.save_mpileup = true
input = [ [ id:'test'], input = [
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) [ id:'test'],
] file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
dummy = file("dummy_file.txt") gff = []
save_mpileup = true
IVAR_VARIANTS ( input, fasta, dummy ) IVAR_VARIANTS ( input, fasta, gff, save_mpileup )
} }
workflow test_ivar_variants_with_gff_with_mpileup { workflow test_ivar_variants_with_gff_with_mpileup {
params.gff = true
params.save_mpileup = true input = [
[ id:'test'],
input = [ [ id:'test'], file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true)
file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ]
]
fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)
gff = file(params.test_data['sarscov2']['genome']['genome_gff3'], checkIfExists: true) gff = file(params.test_data['sarscov2']['genome']['genome_gff3'], checkIfExists: true)
save_mpileup = true
IVAR_VARIANTS ( input, fasta, gff )
IVAR_VARIANTS ( input, fasta, gff, save_mpileup )
} }