Skip to content
Snippets Groups Projects
Commit 95474069 authored by Alexis  CRISCUOLO's avatar Alexis CRISCUOLO :black_circle:
Browse files

4.1

parent 73524d7a
No related branches found
Tags 3.0
No related merge requests found
......@@ -4,7 +4,7 @@
# #
# wgetENAHTS: downloading HTS files from ENA #
# #
COPYRIGHT="Copyright (C) 2021 Institut Pasteur" #
COPYRIGHT="Copyright (C) 2021-2022 Institut Pasteur" #
# #
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU #
# General Public License as published by the Free Software Foundation, either version 3 of the License, or #
......@@ -33,7 +33,10 @@
# = VERSIONS = #
# ============ #
# #
VERSION=4.0.211129acjg #
VERSION=4.1.220307acjg #
# + fixed bugs with option -p #
# #
# VERSION=4.0.211129acjg #
# + for better download, adding automatic selection step between ftp and https protocols #
# + faster repository checking #
# + downloading accessions sorted according to the decreasing total file size #
......@@ -102,7 +105,7 @@ chrono() {
# prints the doc #
# #
mandoc() {
echo -e "\n\033[1m wgetENAHTS v$VERSION $COPYRIGHT\033[0m";
echo -e "\n\033[1m wgetENAHTS v$VERSION $COPYRIGHT\033[0m";
cat <<EOF
USAGE: wgetENAHTS.sh [[-o <dir>] [-f <infile>] [-t <nthreads>]
......@@ -275,21 +278,37 @@ echo ;
URL="ftp.sra.ebi.ac.uk/vol1/fastq";
if [ "$PROTOCOL" == "auto" ]
then
echo -n -e "$(chrono)\t\tassessing transfer protocol " ;
PROTOCOL="ftp://"; time_ftp=$SECONDS;
for i in {1..5} ; do echo -n "." ; timeout 2 $WGET_TEST "$PROTOCOL$URL/DRR00$i/" &>/dev/null ; rm -f wget-log ; done
time_ftp=$(( $SECONDS - $time_ftp ));
PROTOCOL="https://"; time_https=$SECONDS;
for i in {1..5} ; do echo -n "." ; timeout 2 $WGET_TEST "$PROTOCOL$URL/DRR00$i/" &>/dev/null ; rm -f wget-log ; done
time_https=$(( $SECONDS - $time_https ));
echo " [ok]" ;
echo -n -e "$(chrono)\t\tassessing transfer protocol ." ;
PROTOCOL="ftp";
if $WGET_TEST "$PROTOCOL""://""$URL/DRR001/"
then
time_ftp=$SECONDS;
for i in {2..5} ; do echo -n "." ; timeout 2 $WGET_TEST "$PROTOCOL""://""$URL/DRR00$i/" &>/dev/null ; rm -f wget-log ; done
time_ftp=$(( $SECONDS - $time_ftp ));
else
rm -f wget-log ;
echo -n "...." ;
time_ftp=10;
fi
PROTOCOL="https";
if $WGET_TEST "$PROTOCOL""://""$URL/DRR001/"
then
time_https=$SECONDS;
for i in {2..5} ; do echo -n "." ; timeout 2 $WGET_TEST "$PROTOCOL""://""$URL/DRR00$i/" &>/dev/null ; rm -f wget-log ; done
time_https=$(( $SECONDS - $time_https ));
else
rm -f wget-log ;
echo -n "...." ;
time_https=10;
fi
echo ". [ok]" ;
if [ $time_ftp -lt $time_https ]
then PROTOCOL="ftp://"; echo -e "$(chrono)\t\tselected protocol: ftp ($time_ftp<$time_https)" ;
else PROTOCOL="https://"; echo -e "$(chrono)\t\tselected protocol: https ($time_https<$time_ftp)" ;
then PROTOCOL="ftp"; echo -e "$(chrono)\t\tselected protocol: ftp ($time_ftp<$time_https)" ;
else PROTOCOL="https"; echo -e "$(chrono)\t\tselected protocol: https ($time_https<$time_ftp)" ;
fi
echo ;
fi
FTPENA="$PROTOCOL$URL" ;
FTPENA="$PROTOCOL""://""$URL" ;
##############################################################################################################
......@@ -380,47 +399,6 @@ echo ;
ACCNSORT="$(for ACCN in $ACCNLIST ; do [ -s $OUTDIR/$ACCN.weh ] && echo -e "$(sed 's/ /\t/g' $OUTDIR/$ACCN.weh | cut -f2 | paste -sd+ | bc -l)\t$ACCN" ; done | sort -gr | cut -f2 | tr '\n' ' ')";
##############################################################################################################
#### ####
#### MEASURING DOWNLOAD SPEED ####
#### ####
##############################################################################################################
# if [ "$MAXRATE" == "NA" ]
# then
# echo -e -n "$(chrono)\t\testimating download speed " ;
# for ACCN in $ACCNSORT
# do
# echo -n "." ;
# if [ ! -s $OUTDIR/$ACCN.weh ]; then continue ; fi
# nc=${#ACCN};
# if [ $nc -eq 9 ]; then URL="$FTPENA/${ACCN:0:6}/$ACCN/";
# elif [ $nc -eq 10 ]; then URL="$FTPENA/${ACCN:0:6}/00${ACCN:9:1}/$ACCN/";
# else URL="$FTPENA/${ACCN:0:6}/0${ACCN:9:2}/$ACCN/";
# fi
# echo -n "." ;
# for FQGZ in $(sed "s/.*$ACCN/$ACCN/g" $OUTDIR/$ACCN.weh)
# do
# echo -n "." ;
# timeout 30 $WGET_DWNL $URL$FQGZ &>/dev/null ;
# bytes=$(du -b $OUTDIR/$FQGZ | tail -1 | cut -f1);
# RATE=$(( $bytes / 30 ));
# rm -f wget-log ;
# break ;
# done
# break ;
# done
# echo " [ok]" ;
# if [ $N -lt $NTHREADS ]; then RATE=$(( $RATE / $N )); else RATE=$(( $RATE / $NTHREADS )); fi
# if [ $RATE -gt 10000 ]
# then
# WGET_DWNL="$WGET_DWNL --limit-rate=$RATE"
# echo -e "$(chrono)\t\tdownload speed per file: $RATE bytes/seconds" ;
# fi
# echo ;
# fi
##############################################################################################################
#### ####
#### DOWNLOADING FASTQ FILES ####
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment