diff --git a/modules/nf-core/orthofinder/main.nf b/modules/nf-core/orthofinder/main.nf index 1b706ac05308..882d310d9b64 100644 --- a/modules/nf-core/orthofinder/main.nf +++ b/modules/nf-core/orthofinder/main.nf @@ -12,8 +12,11 @@ process ORTHOFINDER { tuple val(meta2), path(prior_run) output: - tuple val(meta), path("$prefix") , emit: orthofinder - tuple val(meta), path("$prefix/WorkingDirectory") , emit: working + tuple val(meta), path("$results_dir") , emit: orthofinder + tuple val(meta), path("$results_dir/WorkingDirectory") , emit: working + tuple val(meta), path("$results_dir/Single_Copy_Orthologue_Sequences/") , emit: single_copy_seqs, optional: true + tuple val(meta), path("$results_dir/Orthogroups/Orthogroups.tsv") , emit: orthogroups + tuple val(meta), path("$results_dir/Species_Tree/SpeciesTree_rooted_node_labels.txt"), emit: sptree tuple val("${task.process}"), val('orthofinder'), eval("NO_COLOR=1 orthofinder --version | cut -d 'v' -f2 | perl -pe 's/\\e\\[[0-9;]*m//g'"), emit: versions_orthofinder, topic: versions @@ -25,6 +28,7 @@ process ORTHOFINDER { def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" def include_command = prior_run ? "-b $prior_run" : '' + results_dir = prior_run ? "${prior_run}/OrthoFinder/Results_${prefix}" : "input/OrthoFinder/Results_${prefix}" """ orthofinder \\ @@ -34,33 +38,28 @@ process ORTHOFINDER { -n $prefix \\ $include_command \\ $args - - if [ -e input/OrthoFinder/Results_$prefix ]; then - mv input/OrthoFinder/Results_$prefix $prefix - fi - - if [ -e ${prior_run}/OrthoFinder/Results_$prefix ]; then - mv ${prior_run}/OrthoFinder/Results_$prefix $prefix - fi """ stub: prefix = task.ext.prefix ?: "${meta.id}" + results_dir = prior_run ? "${prior_run}/OrthoFinder/Results_${prefix}" : "input/OrthoFinder/Results_${prefix}" """ - mkdir -p $prefix/Comparative_Genomics_Statistics - mkdir $prefix/Gene_Duplication_Events - mkdir $prefix/Gene_Trees - mkdir $prefix/Orthogroup_Sequences - mkdir $prefix/Orthogroups - mkdir $prefix/Orthologues - mkdir $prefix/Phylogenetic_Hierarchical_Orthogroups - mkdir $prefix/Phylogenetically_Misplaced_Genes - mkdir $prefix/Putative_Xenologs - mkdir $prefix/Resolved_Gene_Trees - mkdir $prefix/Single_Copy_Orthologue_Sequences - mkdir $prefix/Species_Tree - mkdir $prefix/WorkingDirectory - touch $prefix/Log.txt + mkdir -p $results_dir/Comparative_Genomics_Statistics + mkdir $results_dir/Gene_Duplication_Events + mkdir $results_dir/Gene_Trees + mkdir $results_dir/Orthogroup_Sequences + mkdir $results_dir/Orthogroups + touch $results_dir/Orthogroups/Orthogroups.tsv + mkdir $results_dir/Orthologues + mkdir $results_dir/Phylogenetic_Hierarchical_Orthogroups + mkdir $results_dir/Phylogenetically_Misplaced_Genes + mkdir $results_dir/Putative_Xenologs + mkdir $results_dir/Resolved_Gene_Trees + mkdir $results_dir/Single_Copy_Orthologue_Sequences + mkdir $results_dir/Species_Tree + touch $results_dir/Species_Tree/SpeciesTree_rooted_node_labels.txt + mkdir $results_dir/WorkingDirectory + touch $results_dir/Log.txt """ } diff --git a/modules/nf-core/orthofinder/meta.yml b/modules/nf-core/orthofinder/meta.yml index fdea7f4dd31c..f9ba27099c5f 100644 --- a/modules/nf-core/orthofinder/meta.yml +++ b/modules/nf-core/orthofinder/meta.yml @@ -46,7 +46,7 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - $prefix: + - $results_dir: type: directory description: OrthoFinder output directory working: @@ -55,9 +55,42 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - $prefix/WorkingDirectory: + - $results_dir/WorkingDirectory: type: directory description: OrthoFinder WorkingDirectory (used for the resume function) + single_copy_seqs: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - $results_dir/Single_Copy_Orthologue_Sequences/: + type: directory + description: | + Directory of FASTA files, one per orthogroup that contains exactly one gene + per species. May be empty if no single-copy orthologues were found. + orthogroups: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - $results_dir/Orthogroups/Orthogroups.tsv: + type: file + description: | + Tab-separated file listing the genes belonging to each orthogroup, one row + per orthogroup and one column per species. + pattern: "*.tsv" + sptree: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - $results_dir/Species_Tree/SpeciesTree_rooted_node_labels.txt: + type: file + description: Rooted species tree, with internal nodes labelled, in Newick format. + pattern: "*.txt" versions_orthofinder: - - ${task.process}: type: string diff --git a/modules/nf-core/orthofinder/tests/main.nf.test b/modules/nf-core/orthofinder/tests/main.nf.test index acf18c2b5d6b..d981927cefeb 100644 --- a/modules/nf-core/orthofinder/tests/main.nf.test +++ b/modules/nf-core/orthofinder/tests/main.nf.test @@ -49,13 +49,16 @@ nextflow_process { def stable_file_names = [ 'Statistics_PerSpecies.tsv', 'SpeciesTree_Gene_Duplications_0.5_Support.txt', - 'SpeciesTree_rooted.txt' + 'SpeciesTree_rooted.txt', + 'Orthogroups.tsv', + 'SpeciesTree_rooted_node_labels.txt' ] def stable_files = all_files.findAll { it.name in stable_file_names } assert snapshot( stable_files.toSorted(), + process.out.single_copy_seqs, process.out.findAll { key, val -> key.startsWith("versions") } ).match() } @@ -108,13 +111,15 @@ nextflow_process { def stable_file_names = [ 'Statistics_PerSpecies.tsv', 'OrthologuesStats_Totals.tsv', - 'Duplications_per_Species_Tree_Node.tsv' + 'Duplications_per_Species_Tree_Node.tsv', + 'Orthogroups.tsv' ] def stable_files = all_files.findAll { it.name in stable_file_names } assert snapshot( stable_files.toSorted(), + process.out.single_copy_seqs, process.out.findAll { key, val -> key.startsWith("versions") } ).match() } @@ -155,6 +160,9 @@ nextflow_process { { assert snapshot( process.out.orthofinder, process.out.working, + process.out.single_copy_seqs, + process.out.orthogroups, + process.out.sptree, process.out.findAll { key, val -> key.startsWith("versions") } ).match() } ) diff --git a/modules/nf-core/orthofinder/tests/main.nf.test.snap b/modules/nf-core/orthofinder/tests/main.nf.test.snap index 3cc400fe8eea..57363dcc3dd8 100644 --- a/modules/nf-core/orthofinder/tests/main.nf.test.snap +++ b/modules/nf-core/orthofinder/tests/main.nf.test.snap @@ -4,7 +4,20 @@ [ "Statistics_PerSpecies.tsv:md5,984b5011a34d54527fe17896bfa36a2d", "SpeciesTree_Gene_Duplications_0.5_Support.txt:md5,8b7a673e2e8b6d1aeb697f2bb88afa18", - "SpeciesTree_rooted.txt:md5,4d5ea525feebe479fca0c0768271ba81" + "Orthogroups.tsv:md5,b06cb0585d8349f6138f46c753fe6fb5", + "SpeciesTree_rooted.txt:md5,4d5ea525feebe479fca0c0768271ba81", + "SpeciesTree_rooted_node_labels.txt:md5,2425ef0fe07d301411932eea4268060e" + ], + [ + [ + { + "id": "test", + "single_end": false + }, + [ + + ] + ] ], { "versions_orthofinder": [ @@ -16,10 +29,10 @@ ] } ], - "timestamp": "2026-03-10T17:26:38.211103101", + "timestamp": "2026-09-10T17:07:41.371416517", "meta": { - "nf-test": "0.9.4", - "nextflow": "25.10.4" + "nf-test": "0.9.5", + "nextflow": "26.04.6" } }, "sarscov2 - candidatus_portiera_aleyrodidarum - proteome - stub": { @@ -45,7 +58,7 @@ ], [ - + "Orthogroups.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" ], [ @@ -66,7 +79,7 @@ ], [ - + "SpeciesTree_rooted_node_labels.txt:md5,d41d8cd98f00b204e9800998ecf8427e" ], [ @@ -85,6 +98,35 @@ ] ] ], + [ + [ + { + "id": "test", + "single_end": false + }, + [ + + ] + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "Orthogroups.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "SpeciesTree_rooted_node_labels.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], { "versions_orthofinder": [ [ @@ -95,14 +137,17 @@ ] } ], - "timestamp": "2026-03-10T17:24:36.368264614", + "timestamp": "2026-09-10T16:19:29.976259348", "meta": { - "nf-test": "0.9.4", - "nextflow": "25.10.4" + "nf-test": "0.9.5", + "nextflow": "26.04.6" } }, "sarscov2 - candidatus_portiera_aleyrodidarum - proteome - resume": { "content": [ + [ + "Orthogroups.tsv:md5,48cd9adbc60df119249251a3046b0ff8" + ], [ ], @@ -116,10 +161,10 @@ ] } ], - "timestamp": "2026-03-10T17:24:25.526656922", + "timestamp": "2026-09-10T17:25:08.25374482", "meta": { - "nf-test": "0.9.4", - "nextflow": "25.10.4" + "nf-test": "0.9.5", + "nextflow": "26.04.6" } } } \ No newline at end of file