diff --git a/modules/nf-core/sratools/prefetch/environment.yml b/modules/nf-core/sratools/prefetch/environment.yml index cfc7d9a8363..0abad336cbc 100644 --- a/modules/nf-core/sratools/prefetch/environment.yml +++ b/modules/nf-core/sratools/prefetch/environment.yml @@ -4,4 +4,5 @@ channels: - bioconda - defaults dependencies: - - bioconda::sra-tools=3.0.8 + - bioconda::sra-tools=3.1.0 + - conda-forge::curl=8.5.0 diff --git a/modules/nf-core/sratools/prefetch/main.nf b/modules/nf-core/sratools/prefetch/main.nf index 3c30739ab39..170f1753fba 100644 --- a/modules/nf-core/sratools/prefetch/main.nf +++ b/modules/nf-core/sratools/prefetch/main.nf @@ -4,8 +4,8 @@ process SRATOOLS_PREFETCH { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/sra-tools:3.0.8--h9f5acd7_0' : - 'biocontainers/sra-tools:3.0.8--h9f5acd7_0' }" + 'https://depot.galaxyproject.org/singularity/sra-tools:3.1.0--h9f5acd7_0' : + 'biocontainers/sra-tools:3.1.0--h9f5acd7_0' }" input: tuple val(meta), val(id) diff --git a/modules/nf-core/sratools/prefetch/templates/retry_with_backoff.sh b/modules/nf-core/sratools/prefetch/templates/retry_with_backoff.sh index a72a4bfb611..bfee60707a9 100755 --- a/modules/nf-core/sratools/prefetch/templates/retry_with_backoff.sh +++ b/modules/nf-core/sratools/prefetch/templates/retry_with_backoff.sh @@ -47,9 +47,19 @@ retry_with_backoff !{args2} \ !{args} \ !{id} -[ -f !{id}.sralite ] && vdb-validate !{id}.sralite || vdb-validate !{id} +# check file integrity using vdb-validate or (when archive contains no checksums) md5sum +vdb-validate !{id} > vdb-validate_result.txt 2>&1 || exit 1 +if grep -q "checksums missing" vdb-validate_result.txt; then + VALID_MD5SUMS=$(curl --silent --fail --location --retry 3 --retry-delay 60 'https://locate.ncbi.nlm.nih.gov/sdl/2/retrieve?filetype=run&acc=!{id}') + LOCAL_MD5SUMS=$(md5sum !{id}/* | cut -f1 -d' ') + if ! grep -q -F -f <(echo "$LOCAL_MD5SUMS") <(echo "$VALID_MD5SUMS"); then + echo "MD5 sum check failed" 1>&2 + exit 1 + fi +fi cat <<-END_VERSIONS > versions.yml "!{task.process}": sratools: $(prefetch --version 2>&1 | grep -Eo '[0-9.]+') + curl: $(curl --version | head -n 1 | sed 's/^curl //; s/ .*$//') END_VERSIONS diff --git a/modules/nf-core/sratools/prefetch/tests/main.nf.test.snap b/modules/nf-core/sratools/prefetch/tests/main.nf.test.snap index 946fc869ca1..67795ebbcd7 100644 --- a/modules/nf-core/sratools/prefetch/tests/main.nf.test.snap +++ b/modules/nf-core/sratools/prefetch/tests/main.nf.test.snap @@ -14,7 +14,7 @@ ] ], "1": [ - "versions.yml:md5,c967dea4135cb75490e1e801c4639efc" + "versions.yml:md5,83d1b23f5ff5b2ad1b96d17d7d7594ee" ], "sra": [ [ @@ -28,7 +28,7 @@ ] ], "versions": [ - "versions.yml:md5,c967dea4135cb75490e1e801c4639efc" + "versions.yml:md5,83d1b23f5ff5b2ad1b96d17d7d7594ee" ] } ], @@ -53,7 +53,7 @@ ] ], "1": [ - "versions.yml:md5,c967dea4135cb75490e1e801c4639efc" + "versions.yml:md5,83d1b23f5ff5b2ad1b96d17d7d7594ee" ], "sra": [ [ @@ -67,7 +67,7 @@ ] ], "versions": [ - "versions.yml:md5,c967dea4135cb75490e1e801c4639efc" + "versions.yml:md5,83d1b23f5ff5b2ad1b96d17d7d7594ee" ] } ], @@ -77,4 +77,4 @@ }, "timestamp": "2024-02-28T11:48:37.428307" } -} \ No newline at end of file +} diff --git a/subworkflows/nf-core/fastq_download_prefetch_fasterqdump_sratools/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_download_prefetch_fasterqdump_sratools/tests/main.nf.test.snap index 9972556a8f8..1a34e0b8af1 100644 --- a/subworkflows/nf-core/fastq_download_prefetch_fasterqdump_sratools/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fastq_download_prefetch_fasterqdump_sratools/tests/main.nf.test.snap @@ -40,7 +40,7 @@ "content": [ [ "versions.yml:md5,1a2218ff913fc33408bffccb081b5048", - "versions.yml:md5,98d78bba9f3da39a0b7db6e9c7dcc224", + "versions.yml:md5,53d6e983afde3a28add2ffc6b7eba4f3", "versions.yml:md5,9c558ff624585a6eee82a19c8c0136db" ] ], @@ -94,4 +94,4 @@ }, "timestamp": "2024-02-28T12:02:56.161354" } -} \ No newline at end of file +}