diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a61e5e0a..3c386d31d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ Special thanks to the following for their contributions to the release: - [PR #1624](https://github.com/nf-core/rnaseq/pull/1624) - Document RSeQC inner_distance limitation for genomes with large chromosomes (>500 Mb), such as plant genomes - [PR #1625](https://github.com/nf-core/rnaseq/pull/1625) - Add documentation warning about Qualimap read counting bug ([#1273](https://github.com/nf-core/rnaseq/issues/1273)) - [PR #1628](https://github.com/nf-core/rnaseq/pull/1628) - Template update for nf-core/tools v3.5.1 +- [PR #1631](https://github.com/nf-core/rnaseq/pull/1631) - Fix bbsplit index staging by using symlinks instead of full copy ## [[3.21.0](https://github.com/nf-core/rnaseq/releases/tag/3.21.0)] - 2025-09-18 diff --git a/modules.json b/modules.json index 9a7228cfa..3c4ea02bf 100644 --- a/modules.json +++ b/modules.json @@ -7,7 +7,7 @@ "nf-core": { "bbmap/bbsplit": { "branch": "master", - "git_sha": "fa1477128e0ff24675c8f56d6c334fcc323025c4", + "git_sha": "6da7216c83d9d885bdeb7aef1bcb9b51a90f370b", "installed_by": ["fastq_qc_trim_filter_setstrandedness", "modules"] }, "bedtools/genomecov": { diff --git a/modules/nf-core/bbmap/bbsplit/main.nf b/modules/nf-core/bbmap/bbsplit/main.nf index 2deebbec7..c755bb718 100644 --- a/modules/nf-core/bbmap/bbsplit/main.nf +++ b/modules/nf-core/bbmap/bbsplit/main.nf @@ -68,15 +68,16 @@ process BBMAP_BBSPLIT { } """ - # If using a pre-built index, copy it to avoid modifying input files in place, - # then fix timestamps. When we stage in the index files the time stamps get - # disturbed, which bbsplit doesn't like. Fix the time stamps in its summaries. - # This needs to be done via Java to match what bbmap does. + # If using a pre-built index, create writable structure: symlink all files except + # summary.txt (which we copy to modify). When we stage in the index files the time + # stamps get disturbed, which bbsplit doesn't like. Fix the time stamps in summaries. if [ "$use_index" == "true" ]; then - cp -rL input_index index_writable - - for summary_file in \$(find index_writable/ref/genome -name summary.txt); do - # Extract the path from summary.txt and update it to point to index_writable + find input_index/ref -type f | while read -r f; do + target="index_writable/\${f#input_index/}" + mkdir -p "\$(dirname "\$target")" + [[ \$(basename "\$f") == "summary.txt" ]] && cp "\$f" "\$target" || ln -s "\$(realpath "\$f")" "\$target" + done + find index_writable/ref/genome -name summary.txt | while read -r summary_file; do src=\$(grep '^source' "\$summary_file" | cut -f2- -d\$'\\t' | sed 's|.*/ref/|index_writable/ref/|') mod=\$(echo "System.out.println(java.nio.file.Files.getLastModifiedTime(java.nio.file.Paths.get(\\"\$src\\")).toMillis());" | jshell -J-Djdk.lang.Process.launchMechanism=vfork -) sed -e 's|bbsplit_index/ref|index_writable/ref|' -e "s|^last modified.*|last modified\\t\$mod|" "\$summary_file" > \${summary_file}.tmp && mv \${summary_file}.tmp \${summary_file} @@ -95,14 +96,11 @@ process BBMAP_BBSPLIT { $args 2>| >(tee ${prefix}.log >&2) # Summary files will have an absolute path that will make the index - # impossible to use in other processes- we can fix that + # impossible to use in other processes - fix paths and rename atomically if [ -d bbsplit_build/ref/genome ]; then - for summary_file in \$(find bbsplit_build/ref/genome -name summary.txt); do - src=\$(grep '^source' "\$summary_file" | cut -f2- -d\$'\\t' | sed 's|.*/bbsplit_build|bbsplit_index|') - sed "s|^source.*|source\\t\$src|" "\$summary_file" > \${summary_file}.tmp && mv \${summary_file}.tmp \${summary_file} + find bbsplit_build/ref/genome -name summary.txt | while read -r summary_file; do + sed "s|^source.*|source\\t\$(grep '^source' "\$summary_file" | cut -f2- -d\$'\\t' | sed 's|.*/bbsplit_build|bbsplit_index|')|" "\$summary_file" > \${summary_file}.tmp && mv \${summary_file}.tmp \${summary_file} done - - # Atomically rename the completed index mv bbsplit_build bbsplit_index fi