Kraken2ではデータベース構築の段階で--download-library bacteria
と指定することで、RefSeqのウイルスの配列のみを取得することができる。
$ kraken2-build --download-library viral --db viral-db
rsync_from_ncbi.pl: unexpected FTP path (new server?) for https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/839/185/GCF_000839185.1_ViralProj14174
上記コマンドを実施すると、データベースのftpパスが間違っていると言われたのでunexpected FTP path (new server?)を参考に、rsync_from_ncbi.pl
のコマンドを以下のように書き換えた。
- githubからインストールした場合
kraken2/rsync_from_ncbi.pl
- conda でインストールした場合
miniconda/miniconda3/envs/kraken2/libexec/rsync_from_ncbi.pl
(変更前) if (! ($full_path =~ s#^ftp://${qm_server}${qm_server_path}/##)) {
(変更後) if (! ($full_path =~ s#^https://${qm_server}${qm_server_path}/##)) {
変更後にコマンドを再度実行したところ、異なるエラーが発生。
どうやらNCBIサーバーに存在しないファイルを指定したことに起因するエラーっぽい。
$ kraken2-build --download-library viral --db viral-db
Step 1/2: Performing rsync file transfer of requested files
rsync: link_stat "/all/GCF/018/595/315/GCF_018595315.1_ASM1859531v1/GCF_018595315.1_ASM1859531v1_genomic.fna.gz" (in genomes) failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1668) [generator=3.1.2]
rsync_from_ncbi.pl: rsync error, exiting: 5888
ATVincent commented on 30 Jun 2021 のコードをrsync_from_ncbi.pl
として上書きして保存し、再度実行してみる。
※ さきほど修正したftpパスのコマンドも再度修正する。
問題なくダウンロード完了。
Rsync dry run complete, removing any non-existent files from manifest.
Step 1/2: Performing rsync file transfer of requested files
Rsync file transfer complete.
Step 2/2: Assigning taxonomic IDs to sequences
Processed 11753 projects (14651 sequences, 469.21 Mbp)... done.
All files processed, cleaning up extra sequence files... done, library complete.
Masking low-complexity regions of downloaded library... done.