每次在SRA上面下數(shù)據(jù)都要打命令,太煩了凹髓,于是自己寫了個小shell腳本村斟,能夠快速地下載并解壓SRA數(shù)據(jù),方便使用抱完。
主程序如下
#!/bin/sh
#調(diào)用prefetch下載SRA數(shù)據(jù)庫的測序文件贼陶,并用pfastq-dump轉(zhuǎn)化為fastq文件。
#以上依賴的兩個軟件:SRA Toolkit 和 pfastq-dump需要預先配置好巧娱。
#需要在當前目錄的download_list.txt文件中把SRA編號碉怔,每個一行事先準備好,具體格式參考example.txt
#建議使用NCBI的SRA RUN SELECTOR直接導出禁添。
read -p "請輸入下載列表文件名:" downloadlist
read -p "請選擇單端(SE)撮胧,雙端(PE)測序:" class
read -p "請輸入要使用的線程數(shù):" thread
if [ $class = "SE" ]; then
cat $downloadlist | while read line
do
echo $line
prefetch $line -o ./${line}.sra
pfastq-dump --gzip --threads $thread --outdir ./ ./${line}.sra
done
elif [ $class = "PE" ]; then
cat $downloadlist | while read line
do
echo $line
prefetch $line -o ./${line}.sra
pfastq-dump --gzip --split-3 --threads $thread --outdir ./ ./${line}.sra
done
else echo "錯誤的輸入!"
fi
downloadlist示例
SRR8131605
SRR8131606
SRR8131607
SRR8131608
SRR8131609
SRR8131610
SRR8131611
SRR8131612
SRR8131613
SRR8131614
SRR8131615
SRR8131616
實際上只用pfastq-dump就可以直接把SRA一邊下載一邊解壓成fastq文件老翘,但是實測經(jīng)常會報錯趴樱,還是這樣做穩(wěn)一點,速度也很快的酪捡。