diff --git a/CHANGELOG.md b/CHANGELOG.md index 00bfc46c..280fa731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [[PR #466](https://github.com/nf-core/proteinfold/pulls/464)] - Update module conf and publishdir patterns for ESMFold, pass through container args - [[PR #469](https://github.com/nf-core/proteinfold/pulls/454)] - HTML reports now in /reports output directory - [[PR #468](https://github.com/nf-core/proteinfold/pulls/468)] - Update publishdir patterns for Alphafold3 module +- [[PR #471](https://github.com/nf-core/proteinfold/pulls/471)] - Update publishdir patterns for Rosettafold2na module ### Parameters diff --git a/conf/modules_rosettafold2na.config b/conf/modules_rosettafold2na.config index c045e29c..f42b280d 100644 --- a/conf/modules_rosettafold2na.config +++ b/conf/modules_rosettafold2na.config @@ -22,18 +22,35 @@ process { withName: 'RUN_ROSETTAFOLD2NA' { accelerator = params.use_gpu? 1 : 0 publishDir = [ - path: { "${params.outdir}/rosettafold2na/" }, - mode: 'copy', - saveAs: { filename -> - if (filename.endsWith('_pae.tsv')) { - "paes/$filename" - } else if (filename.equals('versions.yml')) { - null - } else { - filename - } - }, - pattern: '*.*' + [ + path: { "${params.outdir}/rosettafold2na/${meta.id}" }, + mode: 'copy', + pattern: '*_plddt.tsv' + ], + [ + path: { "${params.outdir}/rosettafold2na/${meta.id}" }, + mode: 'copy', + saveAs: { filename -> "paes/$filename" }, + pattern: '*_pae.tsv' + ], + [ + path: { "${params.outdir}/rosettafold2na/${meta.id}" }, + mode: 'copy', + pattern: '*_rosettafold2na_msa.tsv' + ], + [ + enabled: params.save_intermediates, + path: { "${params.outdir}/rosettafold2na/${meta.id}/raw" }, + mode: 'copy', + pattern: 'raw/**', + saveAs: { filename -> filename.toString().replaceFirst(/^raw\//, '') } + ], + [ + path: { "${params.outdir}/rosettafold2na/top_ranked_structures" }, + mode: 'copy', + saveAs: { "${meta.id}.pdb" }, + pattern: '*_rosettafold2na.pdb' + ] ] } diff --git a/modules/local/run_rosettafold2na/main.nf b/modules/local/run_rosettafold2na/main.nf index 53554d15..b288db64 100644 --- a/modules/local/run_rosettafold2na/main.nf +++ b/modules/local/run_rosettafold2na/main.nf @@ -17,11 +17,13 @@ process RUN_ROSETTAFOLD2NA { path ('network/weights/*') output: - tuple val(meta), path("${meta.id}_rf2na.pdb"), emit: pdb - tuple val(meta), path("${meta.id}_plddt_mqc.tsv"), emit: multiqc - tuple val(meta), path("${meta.id}_rosettafold2na_msa.tsv"), emit: msa - tuple val(meta), path("${meta.id}_0_pae.tsv"), emit: pae - path "versions.yml", emit: versions + path ("raw/**") , emit: raw + tuple val(meta), path("${meta.id}_rosettafold2na.pdb") , emit: top_ranked_pdb + tuple val(meta), path("raw/*.pdb") , emit: pdb + tuple val(meta), path("${meta.id}_plddt.tsv") , emit: multiqc + tuple val(meta), path("${meta.id}_rosettafold2na_msa.tsv") , emit: msa + tuple val(meta), path("${meta.id}_0_pae.tsv") , emit: pae + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -67,7 +69,12 @@ process RUN_ROSETTAFOLD2NA { ./run_RF2NA.sh ${meta.id}_rf2na_output "\${chain_args[@]}" - cp ${meta.id}_rf2na_output/models/model_00.pdb ./${meta.id}_rf2na.pdb + ## Create raw directory for intermediate files + mkdir -p raw + + ## Copy top ranked model to root and raw + cp ${meta.id}_rf2na_output/models/model_00.pdb ./${meta.id}_rosettafold2na.pdb + cp ${meta.id}_rf2na_output/models/*.pdb raw/ # Extract PAE matrix from NPZ and save as TSV for reporting /conda/envs/RF2NA/bin/python3 - <<'PY' "${meta.id}_rf2na_output/models/model_00.npz" "${meta.id}_0_pae.tsv" @@ -81,36 +88,32 @@ PY extract_metrics.py --name ${meta.id} \ --structs "${meta.id}_rf2na_output/models/model_00.pdb" ${'$'}A3M_ARGS - mv "${meta.id}_plddt.tsv" "${meta.id}_plddt_mqc.tsv" - if [ -f "${meta.id}_msa.tsv" ]; then - mv "${meta.id}_msa.tsv" "${meta.id}_rosettafold2na_msa.tsv" - fi + mv "${meta.id}_msa.tsv" "${meta.id}_rosettafold2na_msa.tsv" - printf '"%s":\n python: %s\n' \ - "${task.process}" \ - "\$(/conda/envs/RF2NA/bin/python3 --version | sed 's/Python //g')" > versions.yml + ## Move rf2na output directory to raw for save_intermediates + mv ${meta.id}_rf2na_output/* raw/ - cat <<-END_VERSIONS > versions.yml - "${task.process}": - rosettafold2na: $VERSION - END_VERSIONS +cat <<-END_VERSIONS > versions.yml +"${task.process}": + python: \$(python3 --version | sed 's/Python //g') + rosettafold2na: "${VERSION}" +END_VERSIONS """ stub: def VERSION = 'v0.2' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. """ - touch "${meta.id}_rf2na.pdb" - touch "${meta.id}_plddt_mqc.tsv" + mkdir -p raw + touch "${meta.id}_rosettafold2na.pdb" + touch raw/model_00.pdb + touch "${meta.id}_plddt.tsv" touch "${meta.id}_0_pae.tsv" touch "${meta.id}_rosettafold2na_msa.tsv" - printf '"%s":\n python: %s\n' \ - "${task.process}" \ - "\$(/conda/envs/RF2NA/bin/python3 --version | sed 's/Python //g')" > versions.yml - cat <<-END_VERSIONS > versions.yml "${task.process}": - rosettafold2na: $VERSION + python: \$(python3 --version | sed 's/Python //g') + rosettafold2na: "${VERSION}" END_VERSIONS """ } diff --git a/tests/esmfold.nf.test.snap b/tests/esmfold.nf.test.snap index 9c5906d8..8a8ff00f 100644 --- a/tests/esmfold.nf.test.snap +++ b/tests/esmfold.nf.test.snap @@ -16,14 +16,13 @@ }, [ "esmfold", - "esmfold/default", - "esmfold/default/T1024_esmfold.pdb", - "esmfold/default/T1024_plddt.tsv", - "esmfold/default/T1026_esmfold.pdb", - "esmfold/default/T1026_plddt.tsv", - "esmfold/default/top_ranked_structures", - "esmfold/default/top_ranked_structures/T1024.pdb", - "esmfold/default/top_ranked_structures/T1026.pdb", + "esmfold/T1024", + "esmfold/T1024/T1024_plddt.tsv", + "esmfold/T1026", + "esmfold/T1026/T1026_plddt.tsv", + "esmfold/top_ranked_structures", + "esmfold/top_ranked_structures/T1024.pdb", + "esmfold/top_ranked_structures/T1026.pdb", "multiqc", "multiqc/multiqc_data", "multiqc/multiqc_plots", @@ -34,9 +33,7 @@ "reports/test_alphafold2_report.html" ], [ - "T1024_esmfold.pdb:md5,d41d8cd98f00b204e9800998ecf8427e", "T1024_plddt.tsv:md5,d41d8cd98f00b204e9800998ecf8427e", - "T1026_esmfold.pdb:md5,d41d8cd98f00b204e9800998ecf8427e", "T1026_plddt.tsv:md5,d41d8cd98f00b204e9800998ecf8427e", "T1024.pdb:md5,d41d8cd98f00b204e9800998ecf8427e", "T1026.pdb:md5,d41d8cd98f00b204e9800998ecf8427e", @@ -45,8 +42,8 @@ ], "meta": { "nf-test": "0.9.3", - "nextflow": "25.10.4" + "nextflow": "25.10.3" }, - "timestamp": "2026-02-12T11:20:57.334392" + "timestamp": "2026-02-12T18:09:13.544553" } } \ No newline at end of file