Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save actual assembler thread count when all available are used #104

Merged
merged 1 commit into from
May 29, 2024
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: 6 additions & 2 deletions bin/save_tools_info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ add_version () {
jq -n --arg version "$1" '.version = $version'
}

add_version_and_nproc_value () {
jq -n --arg version "$1" --arg nproc_value "$2" '.version = $version | .nproc_value = $nproc_value'
}

jq -n \
--argjson python "$(add_version "$PYTHON_VERSION")" \
--argjson fastp "$(add_version "$FASTP_VERSION")" \
--argjson unicycler "$(add_version "$UNICYCLER_VERSION")" \
--argjson shovill "$(add_version "$SHOVILL_VERSION")" \
--argjson unicycler "$(add_version_and_nproc_value "$UNICYCLER_VERSION" "$UNICYCLER_NPROC_VALUE")" \
--argjson shovill "$(add_version_and_nproc_value "$SHOVILL_VERSION" "$SHOVILL_NPROC_VALUE")" \
--argjson quast "$(add_version "$QUAST_VERSION")" \
--argjson bwa "$(add_version "$BWA_VERSION")" \
--argjson samtools "$(add_version "$SAMTOOLS_VERSION")" \
Expand Down
23 changes: 18 additions & 5 deletions modules/info.nf
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ process TOOLS {
input:
val python_version
val fastp_version
val unicycler_version
val shovill_version
tuple val(unicycler_version), val(unicycler_nproc_value)
tuple val(shovill_version), val(shovill_nproc_value)
val quast_version
val bwa_version
val samtools_version
Expand All @@ -96,7 +96,9 @@ process TOOLS {
PYTHON_VERSION="$python_version"
FASTP_VERSION="$fastp_version"
UNICYCLER_VERSION="$unicycler_version"
UNICYCLER_NPROC_VALUE="$unicycler_nproc_value"
SHOVILL_VERSION="$shovill_version"
SHOVILL_NPROC_VALUE="$shovill_nproc_value"
QUAST_VERSION="$quast_version"
BWA_VERSION="$bwa_version"
SAMTOOLS_VERSION="$samtools_version"
Expand Down Expand Up @@ -153,12 +155,19 @@ process PARSE {
val dbText
val toolText
val imageText
val nprocValue

exec:
def jsonSlurper = new JsonSlurper()

def json = jsonSlurper.parse(new File("${json_file}"))

if (params.assembler == 'unicycler') {
nprocValue = json.unicycler.nproc_value
} else if (params.assembler == 'shovill') {
nprocValue = json.shovill.nproc_value
}

def textRow = { leftSpace, rightSpace, leftContent, rightContent ->
String.format("║ %-${leftSpace}s │ %-${rightSpace}s ║", leftContent, rightContent)
}
Expand Down Expand Up @@ -305,6 +314,7 @@ process PRINT {
val dbText
val toolText
val imageText
val nprocValue

exec:
log.info(
Expand Down Expand Up @@ -332,6 +342,7 @@ process SAVE {
val dbText
val toolText
val imageText
val nprocValue

output:
path "info.txt", emit: info
Expand Down Expand Up @@ -368,7 +379,7 @@ process SAVE {
|${assemblerTextRow('Option', 'Value')}
|╠═══════════════════════════╪═════════════════════════════════════════════════════════════════════╣
|${assemblerTextRow('Assembler', params.assembler.capitalize())}
|${assemblerTextRow('Assembler Thread', params.assembler_thread == 0 ? "0 (All Available)" : params.assembler_thread)}
|${assemblerTextRow('Assembler Thread', params.assembler_thread == 0 ? "${nprocValue} (All Available)" : params.assembler_thread)}
|${assemblerTextRow('Minimum contig length', params.min_contig_length)}
|╚═══════════════════════════╧═════════════════════════════════════════════════════════════════════╝
|""".stripMargin()
Expand Down Expand Up @@ -464,11 +475,12 @@ process UNICYCLER_VERSION {
label 'farm_low'

output:
env VERSION
tuple env(VERSION), env(THREAD)

shell:
$/
VERSION=$(unicycler --version | sed -r "s/.*\sv(.+)/\1/")
THREAD=$(nproc)
/$
}

Expand All @@ -477,11 +489,12 @@ process SHOVILL_VERSION {
label 'farm_low'

output:
env VERSION
tuple env(VERSION), env(THREAD)

shell:
$/
VERSION=$(shovill -v | sed -r "s/.*\s(.+)/\1/")
THREAD=$(nproc)
/$
}

Expand Down