Skip to content

Commit

Permalink
Mitohifi channel input (nf-core#4254)
Browse files Browse the repository at this point in the history
* Main changes

* Add check for correct input parameters

* Code clean-up

* Conda is not supported

* Dropping the hyphen, as per @mahesh-panchal suggestion

---------

Co-authored-by: Ksenia Krasheninnikova <[email protected]>
Co-authored-by: Matthieu Muffato <[email protected]>
  • Loading branch information
3 people authored and mirpedrol committed Nov 23, 2023
1 parent 82839e6 commit 0518403
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
4 changes: 0 additions & 4 deletions modules/nf-core/mitohifi/mitohifi/environment.yml

This file was deleted.

9 changes: 4 additions & 5 deletions modules/nf-core/mitohifi/mitohifi/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ process MITOHIFI_MITOHIFI {
tuple val(meta), path(input)
path ref_fa
path ref_gb
val input_mode
val mito_code

output:
Expand Down Expand Up @@ -41,13 +42,11 @@ process MITOHIFI_MITOHIFI {
}

def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
if (! ["-c", "-r"].contains(args2)) {
error "-r for reads or -c for contigs must be specified"
if (! ["c", "r"].contains(input_mode)) {
error "r for reads or c for contigs must be specified"
}
def script_input = "${args2} ${input}"
"""
mitohifi.py ${script_input} \\
mitohifi.py -${input_mode} ${input} \\
-f ${ref_fa} \\
-g ${ref_gb} \\
-o ${mito_code} \\
Expand Down
4 changes: 4 additions & 0 deletions modules/nf-core/mitohifi/mitohifi/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ input:
type: file
description: Reference annotation
pattern: "*.{gb}"
- input_mode:
type: string
description: Specifies type of input - reads or contigs
pattern: "{r,c}"
- code:
type: integer
description: Mitochndrial code for annotation
Expand Down
6 changes: 4 additions & 2 deletions tests/modules/nf-core/mitohifi/mitohifi/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ workflow test_mitohifi_mitohifi_contigs {
data_contigs = Channel.of([[id:"ilDeiPorc1"],file(params.test_data['deilephila_porcellus']['mito']['contigs'], checkIfExists: true)])
ref_gb = file(params.test_data['deilephila_porcellus']['mito']['ref_gb'], checkIfExists: true)
ref_fa = file(params.test_data['deilephila_porcellus']['mito']['ref_fa'], checkIfExists: true)
input_mode = Channel.of('c')
code = 5
MITOHIFI_MITOHIFI_CONTIGS ( data_contigs, ref_fa, ref_gb, code )
MITOHIFI_MITOHIFI_CONTIGS ( data_contigs, ref_fa, ref_gb, input_mode, code )
}


Expand All @@ -24,6 +25,7 @@ workflow test_mitohifi_mitohifi_reads {
data_reads = Channel.of([[id:"ilDeiPorc1"],file(params.test_data['deilephila_porcellus']['mito']['hifi_reads'], checkIfExists: true)])
ref_gb = file(params.test_data['deilephila_porcellus']['mito']['ref_gb'], checkIfExists: true)
ref_fa = file(params.test_data['deilephila_porcellus']['mito']['ref_fa'], checkIfExists: true)
input_mode = Channel.of('r')
code = 5
MITOHIFI_MITOHIFI_READS ( data_reads, ref_fa, ref_gb, code )
MITOHIFI_MITOHIFI_READS ( data_reads, ref_fa, ref_gb, input_mode, code )
}
8 changes: 1 addition & 7 deletions tests/modules/nf-core/mitohifi/mitohifi/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
process {
withName: MITOHIFI_MITOHIFI_CONTIGS {
ext.args2 = '-c'
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

withName: MITOHIFI_MITOHIFI_READS {
ext.args2 = '-r'
withName: MITOHIFI_MITOHIFI {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}
}
Expand Down

0 comments on commit 0518403

Please sign in to comment.