Skip to content

Commit

Permalink
Simplify HMMER inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Downie committed Nov 28, 2024
1 parent c207428 commit 83f586a
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 47 deletions.
3 changes: 0 additions & 3 deletions .nf-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -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' {
Expand Down Expand Up @@ -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 = [
Expand Down
5 changes: 5 additions & 0 deletions modules/local/magscot/magscot/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
}
3 changes: 2 additions & 1 deletion modules/nf-core/pyrodigal/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
},
Expand Down
44 changes: 25 additions & 19 deletions subworkflows/local/bin_refinement.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -18,21 +17,19 @@ 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
| combine(ch_contig2bins_to_merge, by: 0)

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 ]}
Expand All @@ -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, [])
Expand All @@ -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
Expand All @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions subworkflows/local/prepare_data.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 7 additions & 3 deletions subworkflows/local/read_mapping.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -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
)
Expand Down
19 changes: 12 additions & 7 deletions workflows/longreadmag.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand All @@ -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 }


// //
Expand Down

0 comments on commit 83f586a

Please sign in to comment.