Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## v1.2.0dev - unnamed - [unreleased]

### Added

### Fixed

- [#197](https://github.com/sanger-tol/genomeassembly/pull/181) Improved publishing speed by not forcing joins of fast-running and slow-running processes.

### Dependencies

## v1.1.0 - Slithersong - [2026-11-12]

### Added
Expand Down
219 changes: 119 additions & 100 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,52 @@

process {

cpus = { 1 * task.attempt }
memory = { 6.GB * task.attempt }
time = { 4.h * task.attempt }
cpus = { 1 * task.attempt }
memory = { 6.GB * task.attempt }
time = { 4.h * task.attempt }

errorStrategy = { task.exitStatus in ((130..145) + 104 + (175..177)) ? 'retry' : 'finish' }
maxRetries = 5
maxErrors = '-1'
maxErrors = -1

// Process-specific resource requirements
// NOTE - Please try and reuse the labels below as much as possible.
// These labels are used and recognised by default in DSL2 files hosted on nf-core/modules.
// If possible, it would be nice to keep the same label naming convention when
// adding in your local modules too.
withLabel:process_single {
cpus = { 1 }
withLabel: process_single {
cpus = { 1 }
memory = { 6.GB * task.attempt }
time = { 4.h * task.attempt }
time = { 4.h * task.attempt }
}
withLabel:process_low {
cpus = { 2 * task.attempt }
withLabel: process_low {
cpus = { 2 * task.attempt }
memory = { 12.GB * task.attempt }
time = { 4.h * task.attempt }
time = { 4.h * task.attempt }
}
withLabel:process_medium {
cpus = { 6 * task.attempt }
withLabel: process_medium {
cpus = { 6 * task.attempt }
memory = { 36.GB * task.attempt }
time = { 8.h * task.attempt }
time = { 8.h * task.attempt }
}
withLabel:process_high {
cpus = { 12 * task.attempt }
withLabel: process_high {
cpus = { 12 * task.attempt }
memory = { 72.GB * task.attempt }
time = { 16.h * task.attempt }
time = { 16.h * task.attempt }
}
withLabel:process_long {
time = { 20.h * task.attempt }
withLabel: process_long {
time = { 20.h * task.attempt }
}
withLabel:process_low_memory {
withLabel: process_low_memory {
memory = { 1.GB * task.attempt }
}
withLabel:process_high_memory {
withLabel: process_high_memory {
memory = { 200.GB * task.attempt }
}
withLabel:error_ignore {
withLabel: error_ignore {
errorStrategy = 'ignore'
}
withLabel:error_retry {
withLabel: error_retry {
errorStrategy = 'retry'
maxRetries = 2
}
Expand All @@ -64,166 +64,185 @@ process {
}

withName: '.*:NUCLEAR_ASSEMBLY:GENOME_STATISTICS:BUSCO_BUSCO' {
cpus = { 16 * task.attempt }
cpus = { 16 * task.attempt }
memory = { 80.GB * task.attempt }
time = { 20.h * task.attempt }
time = { 20.h * task.attempt }
}

withName:'.*:NUCLEAR_ASSEMBLY:HIFIASM_ASSEMBLY:HIFIASM.*' {
cpus = { 32 * task.attempt }
withName: '.*:NUCLEAR_ASSEMBLY:HIFIASM_ASSEMBLY:HIFIASM.*' {
cpus = { 32 * task.attempt }
memory = { 400.GB * task.attempt }
time = { 168.h * task.attempt }
time = { 168.h * task.attempt }
}

withName:'.*:NUCLEAR_ASSEMBLY:MITOHIFI_ASSEMBLY:MITOHIFI_MITOHIFI' {
withName: '.*:NUCLEAR_ASSEMBLY:MITOHIFI_ASSEMBLY:MITOHIFI_MITOHIFI' {
errorStrategy = { task.exitStatus == 1 ? "ignore" : "retry" }
cpus = { 16 * task.attempt }
memory = { 100.GB * task.attempt }
time = { 48.h * task.attempt }
cpus = { 16 * task.attempt }
memory = { 100.GB * task.attempt }
time = { 48.h * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:PURGING:FASTA_PURGE_RETAINED_HAPLOTYPE:FASTX_MAP_LONG_READS:MINIMAP2_INDEX' {
cpus = { 2 * task.attempt }
cpus = { 2 * task.attempt }
memory = { 1.GB * Math.ceil(4 * fasta.size() / 1e+9) * task.attempt }
}

withName: ".*:NUCLEAR_ASSEMBLY:PURGING:FASTA_PURGE_RETAINED_HAPLOTYPE:FASTX_MAP_LONG_READS:FASTXALIGN_MINIMAP2ALIGN" {
withName: '.*:NUCLEAR_ASSEMBLY:PURGING:FASTA_PURGE_RETAINED_HAPLOTYPE:FASTX_MAP_LONG_READS:FASTXALIGN_MINIMAP2ALIGN' {
cpus = 20
memory = {
def refSize = reference.size()
1.GB * (
refSize < 2e9 ? 30 : (
refSize < 5e9 ? 40 : (
refSize < 10e9 ? 60 :
// 14Gb genome * 15 should result in significantly higher
// allocation than 60 or genome * 3
Math.ceil(
(refSize / 1e9) * 15
)
)
)
) * task.attempt
if (reference.size() < 2e9) {
return 30.GB * task.attempt
}
else if (reference.size() < 5e9) {
return 40.GB * task.attempt
}
else if (reference.size() < 10e9) {
return 60.GB * task.attempt
}
else {
return 15.GB * Math.ceil(reference.size() / 1e9) * task.attempt
}
}
time = { 1.h * (reference.size() < 4e9 ? 12 : 48 ) }
time = { 1.h * (reference.size() < 4e9 ? 12 : 48) }
}

withName: '.*:NUCLEAR_ASSEMBLY:PURGING:FASTA_PURGE_RETAINED_HAPLOTYPE:MINIMAP2_ALIGN_ASSEMBLY' {
cpus = 20
memory = {
def multiplier = reference.size() < 2e9 ? 30 :
(reference.size() < 5e9 ? 50 :
(reference.size() < 10e9 ? 60 :
Math.ceil((reference.size() / 1e9) * 3)))

return 1.GB * multiplier * task.attempt
if (reference.size() < 2e9) {
return 30.GB * task.attempt
}
else if (reference.size() < 5e9) {
return 50.GB * task.attempt
}
else if (reference.size() < 10e9) {
return 60.GB * task.attempt
}
else {
return 3.GB * Math.ceil(reference.size() / 1e9) * task.attempt
}
}
time = { 1.h * (reference.size() < 1e9 ? 10 : reference.size() < 10e9 ? 30 : 48) }
time = { 1.h * (reference.size() < 1e9 ? 10 : reference.size() < 10e9 ? 30 : 48) }
}

withName: '.*:NUCLEAR_ASSEMBLY:PURGING:FASTA_PURGE_RETAINED_HAPLOTYPE:PURGEDUPS_PURGEDUPS' {
cpus = { 16 * task.attempt }
cpus = { 16 * task.attempt }
memory = { 100.GB * task.attempt }
time = { 16.h * task.attempt }
time = { 16.h * task.attempt }
}

withName: ".*:NUCLEAR_ASSEMBLY:SCAFFOLDING:FASTA_BAM_SCAFFOLDING_YAHS:BAMTOBED_SORT" {
withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:FASTA_BAM_SCAFFOLDING_YAHS:BAMTOBED_SORT' {
cpus = 12
memory = {
(bam.size() < 100e9 ? 60.GB : // If <100GB -> 60GB fixed
// If 100-150GB -> 50GB + (BAM/4GB)
// If >150GB -> BAM/4GB
(bam.size() <= 150e9 ?
50.GB + (1.GB * Math.ceil(bam.size() / 4e9)) :
1.GB * Math.ceil(bam.size() / 4e9)
)
) * task.attempt
if (bam.size() < 10e9) {
return 20.GB * task.attempt
}
else if (bam.size() < 50e9) {
return 30.GB * task.attempt
}
else if (bam.size() < 100e9) {
return 40.GB * task.attempt
}
else if (bam.size() < 150e9) {
return 50.GB * task.attempt
}
else {
return 1.GB * Math.ceil(bam.size() / 4e9) * task.attempt
}
}
time = { 30.h * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:CRAM_MAP_ILLUMINA_HIC:BWAMEM2_INDEX' {
memory = { 1.GB * Math.ceil(28 * fasta.size() / 1e+9) * task.attempt }
memory = { 1.GB * Math.ceil(28 * fasta.size() / 1e+9) * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:CRAM_MAP_ILLUMINA_HIC:CRAMALIGN_BWAMEM2ALIGNHIC' {
cpus = 16
memory = {
def multiplier = reference.size() < 2e9 ? 80 :
Math.ceil((reference.size() / 1e+9) * 30)

return 1.Gb * multiplier * task.attempt
cpus = 16
memory = {
if (reference.size() < 2e9) {
return 80.GB * task.attempt
}
else {
return 30.GB * Math.ceil(reference.size() / 1e9) * task.attempt
}
}
time = { 12.h * task.attempt }
time = { 12.h * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:CRAM_MAP_ILLUMINA_HIC:CRAMALIGN_MINIMAP2ALIGNHIC' {
cpus = 16
memory = {
def multiplier = reference.size() < 2e9 ? 30 :
(reference.size() < 5e9 ? 50 :
(reference.size() < 10e9 ? 60 :
Math.ceil((reference.size() / 1e9) * 3)))

return 1.GB * multiplier * task.attempt
if (reference.size() < 2e9) {
return 30.GB * task.attempt
}
else if (reference.size() < 5e9) {
return 50.GB * task.attempt
}
else if (reference.size() < 10e9) {
return 60.GB * task.attempt
}
else {
return 3.GB * Math.ceil(reference.size() / 1e9) * task.attempt
}
}
time = { 12.h * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:CRAM_MAP_ILLUMINA_HIC:MINIMAP2_INDEX' {
cpus = { 2 * task.attempt }
cpus = { 2 * task.attempt }
memory = { 1.GB * Math.ceil(4 * fasta.size() / 1e+9) * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:CRAM_MAP_ILLUMINA_HIC:SAMTOOLS_MARKDUP' {
cpus = 12
memory = { 1.GB * Math.ceil((input.size() / 1e+9) / 4) * task.attempt }
memory = { 1.GB * Math.ceil((input.size() / 1e+9) / 4) * task.attempt }
}

withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:CRAM_MAP_ILLUMINA_HIC:SAMTOOLS_MERGE' {
cpus = 16
memory = { 50.GB * task.attempt }
time = { 30.h * task.attempt }
time = { 30.h * task.attempt }
}

withName: ".*:NUCLEAR_ASSEMBLY:SCAFFOLDING:FASTA_BAM_SCAFFOLDING_YAHS:JUICERTOOLS_PRE" {
withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:FASTA_BAM_SCAFFOLDING_YAHS:JUICERTOOLS_PRE' {
// Error code 1 on OOM
errorStrategy = { task.exitStatus in ((130..145) + 104 + 175 + 1) ? "retry" : "ignore" }
cpus = { 20 * task.attempt }
cpus = { 20 * task.attempt }
memory = { 30.GB * task.attempt }
}

withName: ".*:NUCLEAR_ASSEMBLY:SCAFFOLDING:FASTA_BAM_SCAFFOLDING_YAHS:YAHS_MAKEPAIRSFILE" {
withName: '.*:NUCLEAR_ASSEMBLY:SCAFFOLDING:FASTA_BAM_SCAFFOLDING_YAHS:YAHS_MAKEPAIRSFILE' {
cpus = 12
memory = { 80.Gb * task.attempt }
time = { 30.h * task.attempt }
memory = { 80.GB * task.attempt }
time = { 30.h * task.attempt }
}

withName:'.*:ORGANELLE_ASSEMBLY:MITOHIFI_ASSEMBLY:MITOHIFI_MITOHIFI' {
withName: '.*:ORGANELLE_ASSEMBLY:MITOHIFI_ASSEMBLY:MITOHIFI_MITOHIFI' {
errorStrategy = { task.exitStatus == 1 ? "ignore" : "retry" }
cpus = { 16 * task.attempt }
memory = { 100.GB * task.attempt }
time = { 48.h * task.attempt }
cpus = { 16 * task.attempt }
memory = { 100.GB * task.attempt }
time = { 48.h * task.attempt }
}

withName:'.*:ORGANELLE_ASSEMBLY:OATK_ASSEMBLY:OATK' {
cpus = { 16 * task.attempt }
withName: '.*:ORGANELLE_ASSEMBLY:OATK_ASSEMBLY:OATK' {
cpus = { 16 * task.attempt }
memory = { 100.GB * task.attempt }
time = { 48.h * task.attempt }
time = { 48.h * task.attempt }
}

withName: '.*:PREPARE_INPUT:BUILD_KMER_DATABASES:FASTK_FASTK' {
cpus = { 20 * 1 }
memory = { 50.GB * task.attempt }
cpus = { 20 * 1 }
memory = { 50.GB * task.attempt }
}

withName: '.*:PREPARE_INPUT:BUILD_KMER_DATABASES:MERQURYFK_HAPMAKER' {
cpus = { 20 * 1 }
memory = { 50.GB * task.attempt }
cpus = { 20 * 1 }
memory = { 50.GB * task.attempt }
}

withName: '.*:PREPARE_INPUT:BUILD_KMER_DATABASES:YAK_COUNT' {
cpus = 20
memory = { 100.GB * task.attempt }
memory = { 100.GB * task.attempt }
}

}
22 changes: 14 additions & 8 deletions subworkflows/local/nuclear_assembly/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -106,22 +106,28 @@ workflow NUCLEAR_ASSEMBLY {
val_busco_lineage_directory,
)

ch_merqury_to_join = GENOME_STATISTICS.out.merqury
ch_statistics_stats = GENOME_STATISTICS.out.stats.map { spec, stats ->
return spec.subMap(["id", "stage", "data", "params", "tools"]) + [output: [statistics: [stats: stats]]]
}

ch_merqury = GENOME_STATISTICS.out.merqury
.map { meta, files ->
// If we have <=2 haps, MerquryFK runs only once so we need to fix the key size to 1
def key = groupKey(meta - meta.subMap("_hap"), meta._n_haps > 2 ? meta._n_haps : 1)
return [key, files]
}
.groupTuple(by: 0)
.map { meta, files -> [meta.getGroupTarget(), files.flatten().sort { it -> it.getName() }] }

ch_statistics = GENOME_STATISTICS.out.stats
.join(GENOME_STATISTICS.out.busco, remainder: true)
.join(ch_merqury_to_join, remainder: true)
.map { spec, stats, busco, merqury ->
return spec.subMap(["id", "stage", "data", "params", "tools"]) + [output: [statistics: [stats: stats, busco: busco, merqury: merqury]]]
.map { meta, files ->
def spec = meta.getGroupTarget()
return spec.subMap(["id", "stage", "data", "params", "tools"]) + [output: [statistics: [merqury: files.flatten().sort { it -> it.getName() }]]]
}

ch_busco = GENOME_STATISTICS.out.busco.map { spec, busco ->
return spec.subMap(["id", "stage", "data", "params", "tools"]) + [output: [statistics: [busco: busco]]]
}

ch_statistics = ch_statistics_stats.mix(ch_merqury).mix(ch_busco)

//
// Subworkflow: Find organellar genomes using mitohifi
//
Expand Down
Loading
Loading