diff --git a/.nf-core.yml b/.nf-core.yml index 63e4910..7fa367c 100644 --- a/.nf-core.yml +++ b/.nf-core.yml @@ -37,9 +37,6 @@ lint: multiqc_config: - report_comment nextflow_config: - - config_default: - - params.hmm_gtdb_pfam - - params.hmm_gtdb_tigrfam - process.cpus - process.memory - process.time diff --git a/conf/modules.config b/conf/modules.config index 13ccec7..eb94b44 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -79,16 +79,10 @@ process { ext.prefix = { "${meta.id}.hic" } } - withName: 'HMMSEARCH_GTDB_PFAM' { + withName: 'HMMER_HMMSEARCH' { ext.args = { "" } - ext.prefix = { "${meta.id}_${meta.assembler}_pfam" } - tag = { "${meta.id}_${meta.assembler}" } - } - - withName: 'HMMSEARCH_GTDB_TIGRFAM' { - ext.args = { "" } - ext.prefix = { "${meta.id}_${meta.assembler}_tigrfam" } - tag = { "${meta.id}_${meta.assembler}" } + ext.prefix = { "${meta.id}_${meta.assembler}_${hmmfile}" } + tag = { "${meta.id}_${meta.assembler}_${hmmfile}" } } withName: 'MAGSCOT_MAGSCOT' { @@ -175,7 +169,7 @@ process { } withName: 'PYRODIGAL' { - ext.args = { "" } + ext.args = { "-p meta" } ext.prefix = { "${meta.id}_${meta.assembler}" } tag = { "${meta.id}_${meta.assembler}" } publishDir = [ diff --git a/modules/local/magscot/magscot/main.nf b/modules/local/magscot/magscot/main.nf index 4d10edc..0d344e0 100644 --- a/modules/local/magscot/magscot/main.nf +++ b/modules/local/magscot/magscot/main.nf @@ -26,5 +26,10 @@ process MAGSCOT_MAGSCOT { mv MAGScoT.scores.out ${prefix}.MAGScoT.scores.out mv MAGScoT.refined.out ${prefix}.MAGScoT.refined.out mv MAGScoT.refined.contig_to_bin.out ${prefix}.MAGScoT.refined.contig_to_bin.out + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + magscot: 1.1 + END_VERSIONS """ } diff --git a/modules/nf-core/pyrodigal/main.nf b/modules/nf-core/pyrodigal/main.nf index 7cb9759..8ef1213 100644 --- a/modules/nf-core/pyrodigal/main.nf +++ b/modules/nf-core/pyrodigal/main.nf @@ -1,6 +1,6 @@ process PYRODIGAL { tag "$meta.id" - label 'process_single' + label 'process_medium' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? @@ -28,6 +28,7 @@ process PYRODIGAL { pigz -cdf ${fasta} > pigz_fasta.fna pyrodigal \\ + --jobs ${task.cpus} \\ $args \\ -i pigz_fasta.fna \\ -f $output_format \\ diff --git a/nextflow_schema.json b/nextflow_schema.json index 26e8373..5a35e58 100644 --- a/nextflow_schema.json +++ b/nextflow_schema.json @@ -99,12 +99,10 @@ "default": true }, "hmm_gtdb_pfam": { - "type": "string", - "default": "${baseDir}/assets/gtdbtk_rel207_Pfam-A.hmm" + "type": "string" }, "hmm_gtdb_tigrfam": { - "type": "string", - "default": "${baseDir}/assets/gtdbtk_rel207_tigrfam.hmm" + "type": "string" } } }, diff --git a/subworkflows/local/bin_refinement.nf b/subworkflows/local/bin_refinement.nf index 401f6f8..2b18515 100644 --- a/subworkflows/local/bin_refinement.nf +++ b/subworkflows/local/bin_refinement.nf @@ -2,8 +2,7 @@ include { DASTOOL_DASTOOL } from '../../modules/nf-cor include { DASTOOL_FASTATOCONTIG2BIN } from '../../modules/nf-core/dastool/fastatocontig2bin/main' include { GAWK as PROCESS_HMM_TBLOUT } from '../../modules/nf-core/gawk/main' include { GAWK as MAGSCOT_PROCESS_CONTIG2BIN } from '../../modules/nf-core/gawk/main' -include { HMMER_HMMSEARCH as HMMSEARCH_GTDB_PFAM } from '../../modules/nf-core/hmmer/hmmsearch/main' -include { HMMER_HMMSEARCH as HMMSEARCH_GTDB_TIGRFAM } from '../../modules/nf-core/hmmer/hmmsearch/main' +include { HMMER_HMMSEARCH } from '../../modules/nf-core/hmmer/hmmsearch/main' include { MAGSCOT_CONTIG2BIN2FASTA } from '../../modules/local/magscot/contig2bin2fasta/main' include { MAGSCOT_MAGSCOT } from '../../modules/local/magscot/magscot/main' include { PYRODIGAL } from '../../modules/nf-core/pyrodigal/main' @@ -18,10 +17,11 @@ workflow BIN_REFINEMENT { ch_refined_bins = Channel.empty() DASTOOL_FASTATOCONTIG2BIN(bins, 'fa') + ch_versions = ch_versions.mix(DASTOOL_FASTATOCONTIG2BIN.out.versions) if(params.enable_dastool) { ch_contig2bins_to_merge = DASTOOL_FASTATOCONTIG2BIN.out.fastatocontig2bin - | map {meta, tsv -> [meta.subMap(['id', 'assembler']), tsv] } + | map {meta, tsv -> [meta - meta.subMap(['binner']), tsv] } | groupTuple(by: 0) ch_dastool_input = assemblies @@ -29,10 +29,7 @@ workflow BIN_REFINEMENT { DASTOOL_DASTOOL(ch_dastool_input, [], []) - ch_versions = ch_versions.mix( - DASTOOL_FASTATOCONTIG2BIN.out.versions, - DASTOOL_DASTOOL.out.versions - ) + ch_versions = ch_versions.mix(DASTOOL_DASTOOL.out.versions) ch_dastool_bins = DASTOOL_DASTOOL.out.bins | map {meta, fasta -> [ meta + [binner: "DASTool"], fasta ]} @@ -43,21 +40,20 @@ workflow BIN_REFINEMENT { if(params.enable_magscot) { PYRODIGAL(assemblies, 'gff') - ch_hmmsearch_gtdb_pfam_input = PYRODIGAL.out.faa - | map { meta, faa -> - [meta, file(params.hmm_gtdb_pfam), faa, false, true, false] - } + ch_magscot_gtdb_hmm_db = Channel.of( + file(params.hmm_gtdb_pfam), + file(params.hmm_gtdb_tigrfam) + ) - ch_hmmsearch_gtdb_tigrfam_input = PYRODIGAL.out.faa - | map { meta, faa -> - [meta, file(params.hmm_gtdb_tigrfam), faa, false, true, false] + ch_hmmsearch_gtdb_input = PYRODIGAL.out.faa + | combine(ch_magscot_gtdb_hmm_db) + | map { meta, faa, hmmfile -> + [ meta, hmmfile, faa, false, true, false ] } - HMMSEARCH_GTDB_PFAM(ch_hmmsearch_gtdb_pfam_input) - HMMSEARCH_GTDB_TIGRFAM(ch_hmmsearch_gtdb_tigrfam_input) + HMMER_HMMSEARCH(ch_hmmsearch_gtdb_input) - ch_hmm_output = HMMSEARCH_GTDB_PFAM.out.target_summary - | mix(HMMSEARCH_GTDB_TIGRFAM.out.target_summary) + ch_hmm_output = HMMER_HMMSEARCH.out.target_summary | groupTuple(by: 0) PROCESS_HMM_TBLOUT(ch_hmm_output, []) @@ -68,7 +64,7 @@ workflow BIN_REFINEMENT { ) ch_magscot_contig2bin = MAGSCOT_PROCESS_CONTIG2BIN.out.output - | map { meta, c2b -> [ meta.subMap(['id', 'assembler']), c2b ] } + | map { meta, c2b -> [ meta - meta.subMap(['binner']), c2b ] } | groupTuple(by: 0) ch_magscot_input = PROCESS_HMM_TBLOUT.out.output @@ -85,6 +81,16 @@ workflow BIN_REFINEMENT { | map { meta, rbins -> [ meta + [binner: "magscot"], rbins] } ch_refined_bins = ch_refined_bins.mix(ch_magscot_bins) + + ch_versions = ch_versions + | mix( + PYRODIGAL.out.versions, + HMMER_HMMSEARCH.out.versions, + PROCESS_HMM_TBLOUT.out.versions, + MAGSCOT_PROCESS_CONTIG2BIN.out.versions, + MAGSCOT_MAGSCOT.out.versions, + MAGSCOT_CONTIG2BIN2FASTA.out.versions + ) } emit: diff --git a/subworkflows/local/prepare_data.nf b/subworkflows/local/prepare_data.nf index ef8da45..6f09d07 100644 --- a/subworkflows/local/prepare_data.nf +++ b/subworkflows/local/prepare_data.nf @@ -26,6 +26,12 @@ workflow PREPARE_DATA { HIC_TO_FASTQ(ch_hic_cram, false) ch_hic_fastq = HIC_TO_FASTQ.out.fastq + ch_versions = ch_versions + | mix( + MERGE_HIC_CRAM.out.versions, + HIC_TO_FASTQ.out.versions + ) + emit: hic_reads = ch_hic_fastq versions = ch_versions diff --git a/subworkflows/local/read_mapping.nf b/subworkflows/local/read_mapping.nf index 67ef1cc..0f33398 100644 --- a/subworkflows/local/read_mapping.nf +++ b/subworkflows/local/read_mapping.nf @@ -25,6 +25,13 @@ workflow READ_MAPPING { SORT_HIC_BAM(BWAMEM2_MEM.out.bam, [[],[]]) ch_hic_bam = SORT_HIC_BAM.out.bam + + ch_versions = ch_versions + | mix( + BWAMEM2_INDEX.out.versions, + BWAMEM2_MEM.out.versions, + SORT_HIC_BAM.out.versions + ) } else { ch_hic_bam = Channel.empty() } @@ -47,9 +54,6 @@ workflow READ_MAPPING { ch_versions = ch_versions | mix( - BWAMEM2_INDEX.out.versions, - BWAMEM2_MEM.out.versions, - SORT_HIC_BAM.out.versions, MINIMAP2_ALIGN.out.versions, COVERM_CONTIG.out.versions ) diff --git a/workflows/longreadmag.nf b/workflows/longreadmag.nf index a5c216d..a2d22e8 100644 --- a/workflows/longreadmag.nf +++ b/workflows/longreadmag.nf @@ -34,6 +34,7 @@ workflow LONGREADMAG { PREPARE_DATA( hic_cram ) + ch_versions = ch_versions.mix(PREPARE_DATA.out.versions) if(params.enable_assembly) { ASSEMBLY(pacbio_fasta) @@ -44,6 +45,7 @@ workflow LONGREADMAG { pacbio_fasta, PREPARE_DATA.out.hic_reads ) + ch_versions = ch_versions.mix(READ_MAPPING.out.versions) if(params.enable_binning) { BINNING( @@ -60,18 +62,21 @@ workflow LONGREADMAG { BINNING.out.bins ) } + + ch_bins = BINNING.out.bins + | BIN_REFINEMENT.out.refined_bins } } // // Collate and save software versions // - softwareVersionsToYAML(ch_versions) - .collectFile( - storeDir: "${params.outdir}/pipeline_info", - name: '' + 'pipeline_software_' + 'mqc_' + 'versions.yml', - sort: true, - newLine: true - ).set { ch_collated_versions } + // softwareVersionsToYAML(ch_versions) + // .collectFile( + // storeDir: "${params.outdir}/pipeline_info", + // name: '' + 'pipeline_software_' + 'mqc_' + 'versions.yml', + // sort: true, + // newLine: true + // ).set { ch_collated_versions } // //