Skip to content

prefetch issue with sra-tools 3.0.8 causing md5sum issues #30

Description

@sgsutcliffe

Description of the bug

Bug Description

Certain SRAs cause sra-toolkit prefetch to compare the md5sum of the downloaded .sra file to a .sraalign file which gives a false negative for the match, causing the pipeline to fail.

To recreate the bug

You can use the samplesheet:

sample,insdc_accession
SAMPLE1,SRR37205362
SAMPLE2,SRR37205362

You can see the issue by:

The API request was pulling a different SRA type of file and comparing the md5sum:
$ curl 'https://locate.ncbi.nlm.nih.gov/sdl/2/retrieve?filetype=run&acc=SRR37205362' | python3 -m json.tool

{
"version": "2",
"result": [
{
"bundle": "SRR37205362",
"status": 200,
"msg": "ok",
"files": [
{
"object": "srapub|SRR37205362.sraalign",
"accession": "SRR37205362",
"type": "sra",
"name": "SRR37205362.sraalign",
"size": 146773221,
"md5": "6cadf50190a2d50be9030ade298ad4fa",
"modificationDate": "2026-02-11T17:08:50Z",
"noqual": true,
"locations": [
{
"service": "sra-ncbi",
"region": "public",
"link": "https://sra-download.be-md.ncbi.nlm.nih.gov/vast/sra01/SRZ/037205/SRR37205362/SRR37205362.realign"
}
]
}
]
}
]
}
$ md5sum SRR37205362/*
ffc0b8bbd20fde977c4a44c81771d3be SRR37205362/SRR37205362.sra

As the output shows the SRA download was fine otherwise.

The issue is caused during modules/nf-core/sratools/prefetch/templates/retry_with_backoff.sh
Specifically the block:

# 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

Potential Fix

I believe that simply upgrading the sra-toolkit containter will fix it as
sra-tools 3.0.8 reported checksums missing for columns that 3.2.1 validates fine — triggering the MD5 fallback unnecessarily

Command used and terminal output

Relevant files

No response

System information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions