Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
wgetENAHTS
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GIPhy
wgetENAHTS
Commits
95474069
Commit
95474069
authored
3 years ago
by
Alexis CRISCUOLO
Browse files
Options
Downloads
Patches
Plain Diff
4.1
parent
73524d7a
No related branches found
Branches containing commit
Tags
3.0
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wgetENAHTS.sh
+33
-55
33 additions, 55 deletions
wgetENAHTS.sh
with
33 additions
and
55 deletions
wgetENAHTS.sh
+
33
−
55
View file @
95474069
...
...
@@ -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\0
33[1m wgetENAHTS v
$VERSION
$COPYRIGHT
\0
33[0m"
;
echo
-e
"
\n\0
33[1m wgetENAHTS v
$VERSION
$COPYRIGHT
\0
33[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\t
assessing 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\t
assessing 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\t
selected protocol: ftp (
$time_ftp
<
$time_https
)"
;
else
PROTOCOL
=
"https
://
"
;
echo
-e
"
$(
chrono
)
\t\t
selected protocol: https (
$time_https
<
$time_ftp
)"
;
then
PROTOCOL
=
"ftp"
;
echo
-e
"
$(
chrono
)
\t\t
selected protocol: ftp (
$time_ftp
<
$time_https
)"
;
else
PROTOCOL
=
"https"
;
echo
-e
"
$(
chrono
)
\t\t
selected 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 ####
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment