Skip to content

Commit

Permalink
Support both wget and curl
Browse files Browse the repository at this point in the history
  • Loading branch information
akikuno authored Aug 1, 2024
1 parent 6fb88a0 commit e3818d8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions gse2srr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@

GSE="$1"

wget -qO - https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc="$GSE" |
if [ -z "$GSE" ]; then
echo "Error: Please provide a GSE accession id"
exit 1
fi

if type curl >/dev/null 2>&1; then
CMD_CURL='curl -s'
elif type wget >/dev/null 2>&1; then
CMD_CURL='wget -qO -'
else
error_exit 1 'No HTTP-GET/POST command found.'
fi

$CMD_CURL https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc="$GSE" |
grep "/soft/" |
cut -d '"' -f 2 |
sed "s|$|${GSE}_family.soft.gz|" |
xargs wget -qO - |
xargs $CMD_CURL |
gzip -dc |
grep SRX |
awk '{print "wget -qO -", $NF, " | tr \">\" \"\\n\" | grep \"^SRR\" | cut -d \"<\" -f 1 &"} END {print "wait"}' |
Expand Down

0 comments on commit e3818d8

Please sign in to comment.