Repository revision
27:9a776b080193

Repository 'sra_tools'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/sra_tools

Faster Download and Extract Reads in FASTQ tool metadata
Miscellaneous
format from NCBI SRA
fasterq_dump
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/3.0.0+galaxy0
3.0.0+galaxy0
fasterq-dump --version | tr -d $'\n'
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/3.0.3+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/3.0.0+galaxy0 (this tool)
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.11.0+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.11.0+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.9+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.8+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.7+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.7+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.7+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.7+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.7+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.4+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.4+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/sra_tools/fasterq_dump/2.10.4
fasterq_dump
Requirements (dependencies defined in the <requirements> tag set)
name version type
sra-tools 3.0.0 package
pigz 2.6 package
samtools 1.16.1 package
Additional information about this tool
set -o | grep -q pipefail && set -o pipefail;
    
        mkdir -p ~/.ncbi &&
        cp '$user_settings_mkfg' ~/.ncbi/user-settings.mkfg &&
        vdb-config -s "/repository/user/main/public/root=\$PWD" &&
        vdb-config -s "/repository/user/ad/public/root=\$PWD" &&
        vdb-config -s "/repository/user/default-path=\$PWD" &&
        vdb-config -s "/repository/user/main/public/root=\$PWD" &&
        vdb-config -s /http/timeout/read=10000 &&
    
    
        export SRA_PREFETCH_RETRIES=3 &&
        export SRA_PREFETCH_ATTEMPT=1 &&
    
    
        #if $input.input_select == "sra_file":
            acc='${input.sra_file.name}' &&
            ln -s '${input.sra_file}' "\$acc" &&
        #else    
            #if $input.input_select == "file_list":
                #if $input.file_list.is_of_type('sra_manifest.tabular'):
                    #set $column = $input.file_list.unsanitized.metadata.column_names.index('Run') + 1
                    cut -f $column '$input.file_list'| tail -n +2 > accessions &&
                #else
                    
        grep '^[[:space:]]*[E|S|D]RR[0-9]\{1,\}[[:space:]]*$'
     '$input.file_list' > accessions &&
                #end if
            #elif $input.input_select == "accession_number":
                echo '${input.accession}' | sed -r 's/(\,|\;|__cn__)/\n/g' > accessions &&
            #end if
            for acc in \$(cat ./accessions);
            do (
                echo "Downloading accession: \$acc..." &&
        #end if  
    
    while [ \$SRA_PREFETCH_ATTEMPT -le \$SRA_PREFETCH_RETRIES ] ; do
        fasterq-dump "\$acc" -e \${GALAXY_SLOTS:-1}
        --seq-defline '@\$sn/\$ri'
        --qual-defline '+'
        $adv.split
        #if str( $adv.minlen ) != "":
            --min-read-len "$adv.minlen"
        #end if
        $adv.skip_technical 2>&1 | tee -a '$log';
        if [ \$? == 0 ] && [ \$(ls *.fastq | wc -l) -ge 1 ]; then
            break ;
        else
            echo "Prefetch attempt \$SRA_PREFETCH_ATTEMPT of \$SRA_PREFETCH_RETRIES exited with code \$?" ;
            SRA_PREFETCH_ATTEMPT=`expr \$SRA_PREFETCH_ATTEMPT + 1` ;
            sleep 1 ;
        fi ;
    done &&
    mkdir -p output &&
    mkdir -p outputOther &&
    count="\$(ls *.fastq | wc -l)" &&
    echo "There are \$count fastq files" &&
    data=(\$(ls *.fastq)) &&
    if [ "\$count" -eq 1 ]; then
        pigz -cqp \${GALAXY_SLOTS:-1} "\${data[0]}" > output/"\${acc}"__single.fastqsanger.gz &&
        rm "\${data[0]}";
    elif [ "$adv.split" = "--split-3" ]; then
        if [ -e "\${acc}".fastq ]; then
            pigz -cqp \${GALAXY_SLOTS:-1} "\${acc}".fastq > outputOther/"\${acc}"__single.fastqsanger.gz;
        fi &&
        pigz -cqp \${GALAXY_SLOTS:-1} "\${acc}"_1.fastq > output/"\${acc}"_forward.fastqsanger.gz &&
        pigz -cqp \${GALAXY_SLOTS:-1} "\${acc}"_2.fastq > output/"\${acc}"_reverse.fastqsanger.gz &&
        rm "\${acc}"*.fastq;
    elif [ "\$count" -eq 2 ]; then
        #if $adv.skip_technical:
            pigz -cqp \${GALAXY_SLOTS:-1} "\${data[0]}" > output/"\${acc}"_forward.fastqsanger.gz &&
            pigz -cqp \${GALAXY_SLOTS:-1} "\${data[1]}" > output/"\${acc}"_reverse.fastqsanger.gz &&
        #else
            pigz -cqp \${GALAXY_SLOTS:-1} "\${data[0]}" > outputOther/"\${data[0]}"sanger.gz &&
            pigz -cqp \${GALAXY_SLOTS:-1} "\${data[1]}" > outputOther/"\${data[1]}"sanger.gz &&
        #end if
        rm "\${data[0]}" &&
        rm "\${data[1]}";
    else
        for file in \${data[*]}; do
            pigz -cqp \${GALAXY_SLOTS:-1} "\$file" > outputOther/"\$file"sanger.gz &&
            rm "\$file";
        done;
    fi;
    
    #if $input.input_select != "sra_file":
        ); done;
    #end if
    echo "Done with all accessions."
    
    
None
False
Functional tests
name inputs outputs required files
Test-1 input|accession: ERR086330
input|input_select: accession_number
Test-2 input|accession: SRR002702
input|input_select: accession_number
adv|split: --split-files
adv|skip_technical: False
Test-3 input|accession: ERR086330, SRR11953971
input|input_select: accession_number
Test-4 input|sra_file: SRR522874.sra
input|input_select: sra_file
adv|split: --split-files
adv|skip_technical: True
SRR522874.sra
Test-5 input|sra_file: SRR522874.sra
input|input_select: sra_file
adv|split: --split-files
adv|skip_technical: False
SRR522874.sra
Test-6 input|file_list: list_sra
input|input_select: file_list
adv|minlen: 21
list_sra
Test-7 input|file_list: sra_manifest.tabular
input|input_select: file_list
sra_manifest.tabular