Skip to content

Commit 2f7d1ff

Browse files
authored
Update iseq
1 parent 76dd69f commit 2f7d1ff

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

bin/iseq

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# Author: BioOmics (https://github.com/BioOmics)
3-
# Last modified: 2025-03-11
3+
# Last modified: 2025-03-14
44
# =======================================
55
function CheckSoftware(){
66
local software1=$1
@@ -98,7 +98,7 @@ while [[ $# -gt 0 ]]; do
9898
-a|--aspera) aspera=1 ; shift 1 ;;
9999
-o|--output) checkParameter $1 $2; if [[ $? -eq 0 ]]; then output=$2;shift 2; fi ;;
100100
-h|--help) usage; exit 0 ;;
101-
-v|--version) echo "Version 1.6.0"; exit 0 ;;
101+
-v|--version) echo "Version 1.7.0"; exit 0 ;;
102102
*) echo -e "\033[1;31mError\033[0m: Invalid option: $1"; echo -e "\033[1;32mHow to solve?\033[0m Please remove $1 option"; exit 1 ;;
103103
esac
104104
done
@@ -423,19 +423,32 @@ function downloadSRA() {
423423
if [[ $layout == "single" ]]; then
424424
echo -e "\033[93mNote\033[0m: $SRR is single-end data, but has multiple links"
425425
fi
426-
local link1=$(echo $FASTQLink | tr ";" "\n" | grep "_1.fastq.gz")
427-
local link2=$(echo $FASTQLink | tr ";" "\n" | grep "_2.fastq.gz")
428-
if [[ $aspera -eq 1 ]]; then
429-
echo -e "File size: $(wget --spider "ftp://$link1" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: Aspera"
430-
executeAspera "$link1" "ENA"
431-
echo -e "File size: $(wget --spider "ftp://$link2" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: Aspera"
432-
executeAspera "$link2" "ENA"
426+
427+
if [[ $linkNum -eq 2 ]]; then
428+
local link1=$(echo $FASTQLink | tr ";" "\n" | grep "_1.fastq.gz")
429+
local link2=$(echo $FASTQLink | tr ";" "\n" | grep "_2.fastq.gz")
430+
if [[ $aspera -eq 1 ]]; then
431+
echo -e "File size: $(wget --spider "ftp://$link1" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: Aspera"
432+
executeAspera "$link1" "ENA"
433+
echo -e "File size: $(wget --spider "ftp://$link2" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: Aspera"
434+
executeAspera "$link2" "ENA"
435+
else
436+
echo -e "File size: $(wget --spider "ftp://$link1" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: ftp"
437+
executeDownload "ftp://$link1" $(basename $link1)
438+
echo -e "File size: $(wget --spider "ftp://$link2" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: ftp"
439+
executeDownload "ftp://$link2" $(basename $link2)
440+
fi
433441
else
434-
echo -e "File size: $(wget --spider "ftp://$link1" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: ftp"
435-
executeDownload "ftp://$link1" $(basename $link1)
436-
echo -e "File size: $(wget --spider "ftp://$link2" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: ftp"
437-
executeDownload "ftp://$link2" $(basename $link2)
438-
fi
442+
echo -e "\033[93mNote\033[0m: $SRR is paired-end data, but has only one link" # such as SRR23680070
443+
local link=$(echo $FASTQLink | tr ";" "\n" | grep ".fastq.gz")
444+
if [[ $aspera -eq 1 ]]; then
445+
echo -e "File size: $(wget --spider "ftp://$link" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: Aspera"
446+
executeAspera "$link" "ENA"
447+
else
448+
echo -e "File size: $(wget --spider "ftp://$link" 2>&1 | grep SIZE | awk '{printf "%.2fG", ($5/1024/1024/1024)}')\tDatabase: ENA\tMode: ftp"
449+
executeDownload "ftp://$link" $(basename $link)
450+
fi
451+
fi
439452
fi
440453
else
441454
if [[ $database =~ ^[sS][rR][aA]$ || -z $SRALink ]]; then

0 commit comments

Comments
 (0)