ncbi-genome-download
Scripts to download genomes from the NCBI FTP servers
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 22 committers (13.6%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (5.6%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
Scripts to download genomes from the NCBI FTP servers
Basic Info
- Host: GitHub
- Owner: kblin
- License: apache-2.0
- Language: Python
- Default Branch: master
- Size: 359 KB
Statistics
- Stars: 1,026
- Watchers: 33
- Forks: 179
- Open Issues: 45
- Releases: 15
Topics
Metadata Files
README-CN.md
NCBI基因组下载脚本
Translate by jamesyang, the translation may not be timely. If you can't find it in the Chinese version, you can refer to the original document.
由jamesyang翻译,翻译可能不及时,如果在中文文档里找不到需要的东西,你可以参考原文档。
从NCBI下载重组FTP后的细菌和真菌基因组的一些脚本
从 Mick Watson的Kraken下载程序脚本 中获得的想法,这些脚本也可以在Mick的GitHub仓库中找到。然而,Mick是~~用Perl语言编写的~~ 专门用于实际构建 Kraken 数据库(如广告所示)。
因此,这是一组侧重于实际基因组下载的脚本。
安装
bash
pip install ncbi-genome-download
或者,从GitHub克隆此存储库,然后运行(在python虚拟环境中)
bash
pip install .
如果在旧版本的Python上失败,请先尝试更新您的pip工具:
bash
pip install --upgrade pip
然后重新运行ncbi-genome-download安装。
或者,ncbi-genome-download也被打包在conda。请参阅 Anaconda/miniconda 网站以安装发行版(强烈推荐)https://conda.io/miniconda.html 安装后可以执行以下操作:
bash
conda install -c bioconda ncbi-genome-download
ncbi-genome-download仅在Python团队仍活跃支持下的Python版本上开发和测试。目前,这些代表版本有3.5,3.6,3.7和3.8。具体来说,没有尝试在3.5之前的Python版本下进行测试。
如果您的系统停留在旧版本的 Python 上,请考虑使用 Homebrew 等工具获取更新版本。
ncbi-genome-download0.2.12是支持Python2的最后一个版本。
使用
要从NCBI RefSeq下载GenBank格式的所有的细菌基因组,请运行以下命令:
bash
ncbi-genome-download bacteria
也可以下载多个组:
bash
ncbi-genome-download bacteria,viral
注意:查看所有可用组,请参阅 ncbi-genome-download --help,或只是使用all来检查所有组。命名更具体的组将减少下载大小和查找要下载的序列所需的时间。
如果您的连接速度相当快,您可能需要尝试并行运行多个下载:
bash
ncbi-genome-download bacteria --parallel 4
要从NCBI GenBank下载GenBank格式的所有的真菌基因组,请运行:
bash
ncbi-genome-download --section genbank fungi
要从RefSeq下载所有FASTA格式的病毒基因组,请运行:
bash
ncbi-genome-download --formats fasta viral
可以通过提供格式列表或仅下载所有格式来下载多种格式:
bash
ncbi-genome-download --formats fasta,assembly-report viral
ncbi-genome-download --formats all viral
仅从RefSeq下载GenBank格式的细菌全基因组,请运行:
bash
ncbi-genome-download --assembly-levels complete bacteria
通过提供列表,可以一次下载多个程序集级别:
bash
ncbi-genome-download --assembly-levels complete,chromosome bacteria
仅从RefSeq下载GenBank格式的细菌参考基因组,请运行:
bash
ncbi-genome-download --refseq-categories reference bacteria
要从RefSeq下载Streptomyces(链霉菌)属的细菌基因组,请运行:
bash
ncbi-genome-download --genera Streptomyces bacteria
注意:这是仅由NCBI提供的有机体名称上的简单字符串匹配。
您也可以用一点小技巧来下载特定物种的基因组
bash
ncbi-genome-download --genera "Streptomyces coelicolor" bacteria
注意:引号很重要。同样,这是NCBI提供的有机体名称上的简单字符串匹配。
也可以有多个属:
bash
ncbi-genome-download --genera "Streptomyces coelicolor,Escherichia coli" bacteria
您还可以将属名放入一个文件中,每行一个有机体,例如:
text
Streptomyces
Amycolatopsis
然后,将该文件的路径(例如my_genera.txt)传递给 --genera 选项,如下所示:
bash
ncbi-genome-download --genera my_genera.txt bacteria
注意:上述命令将从RefSeq下载所有Streptomyces(链球菌)和Amycolatopsis(拟无枝菌酸菌)的基因组。
您可以使用--fuzzy-genus选项模糊匹配字符串。如果您需要匹配NCBI生物体名称中间的值,这很方便,如下所示:
bash
ncbi-genome-download --genera coelicolor --fuzzy-genus bacteria
注意:上述命令将从 RefSeq 下载所有含有“coelicolor”的细菌基因组。
要基于NCBI物种分类ID从RefSeq下载细菌基因组,请运行:
bash
ncbi-genome-download --species-taxids 562 bacteria
注意:上述命令将下载属于Escherichia coli(大肠杆菌)的所有RefSeq基因组。
要基于NCBI分类标识ID从RefSeq下载特定细菌基因组,请运行:
bash
ncbi-genome-download --taxids 511145 bacteria
注意:上述命令将从 RefSeq 下载属于Escherichia coli str. K-12 substr. MG1655的基因组 。
也可以下载多种分类ID或通过在逗号分隔列表中提供数字来下载多种分类ID物种:
bash
ncbi-genome-download --taxids 9606,9685 --assembly-levels chromosome vertebrate_mammalian
注意:上述命令将下载猫和人类的参考基因组。
此外,您可以将多个物种分类ID或物种分类ID放入一个文件中,每行一个,并将该文件名分别传递给--species-taxids或--taxids参数。
假设您有一个my_taxids.txt文件包含以下内容:
text
9606
9685
你可以下载猫和人的参考基因组,如下所示:
bash
ncbi-genome-download --taxids my_taxids.txt --assembly-levels chromosome vertebrate_mammalian
也可以创建可读的目录结构,并行镜像 NCBI 使用的布局:
bash
ncbi-genome-download --human-readable bacteria
这将使用链接指向NCBI目录结构中的相应文件,因此可以节省文件空间。请注意,链接不支持某些Windows文件系统和旧版Windows。
也可以使用该--human-readable选项重新运行先前的下载。在这种情况下,ncbi-genome-download不会下载任何新的基因组文件,只需创建可读的目录结构。请注意,如果在NCBI端更改了任何文件,将触发文件下载。
根据您的筛选器,有个--dry-run选项可显示下载哪些加入:
bash
ncbi-genome-download --dry-run bacteria
如果要筛选程序集摘要文件的“与类型材料的关系”列,可以使用该--type-material选项。可能的值是“any”,“all”,“type”,“reference”,“synonym”,“proxytype”和/或“neotype”。“any”将包括与定义的类型材料值无关的装配体,“all”将仅下载具有定义值的装配体。可以给出多个值,用逗号分隔:
bash
ncbi-genome-download --type-material type,reference
默认情况下,ncbi-genome-download缓存相应分类组的程序集摘要文件一天。您可以用--no-cache --help选项跳过使用缓存文件。如果要删除任何缓存文件,输出也会显示缓存目录。
要获得所有选项的概述,请运行
bash
ncbi-genome-download --help
作为一种方法
您也可以将其用作方法调用。传递上述被转述的关键字参数(_而不是-)或用--help:
python
import ncbi_genome_download as ngd
ngd.download()
注意:要指定分类组,如bacteria,请使用group关键字。
贡献的脚本: gimme_taxa.py
此脚本允许您找出要传递给 ngd 的 物种分类ID,并将编写一个简单的每行一项文件以传递给它。它使用 ete3 工具包,因此,如果尚未满足,请参阅其站点来安装依赖项。
您可以使用特定的 物种分类ID 或科学名称查询数据库。脚本的主要功能是返回指定父 taxa 的所有子 taxa。该脚本具有用于在输出中写入的信息的各种选项。
基本调用可能如下所示:
``` bash
Fetch all descendent taxa for Escherichia (taxid 561):
python gimme_taxa.py -o ~/mytaxafile.txt 561
Alternatively, just provide the taxon name
python gimmetaxa.py -o alldescendent_taxids.txt Escherichia
You can provide multiple taxids and/or names
python gimmetaxa.py -o alldescendent_taxids.txt 561,Methanobrevibacter ```
首次使用时,默认情况下将在主目录中创建一个小的sqlite数据库(使用--database标志更改位置)。您可以使用该--update标志更新此数据库。请注意,如果数据库不在您的主目录中,则必须使用该--database数据库进行指定,否则将在主目录中创建新数据库。
要查看所有帮助:
bash
python gimme_taxa.py
python gimme_taxa.py -h
python gimme_taxa.py --help
许可证
所有代码在Apache许可证版本2下都可用,有关详细信息,请参阅该 LICENSE文件。
Owner
- Name: Kai Blin
- Login: kblin
- Kind: user
- Repositories: 44
- Profile: https://github.com/kblin
Microbiology PhD, co-author of @antismash , Open Source geek.
Citation (CITATION.cff)
cff-version: 1.2.0
title: ncbi-genome-download
message: >-
If you found ncbi-genome-download useful, please cite it
as specified below.
type: software
authors:
- family-names: Blin
given-names: Kai
orcid: 'https://orcid.org/0000-0003-3764-6051'
identifiers:
- type: doi
value: 10.5281/zenodo.8192432
description: Zenodo Archive
repository-code: 'https://github.com/kblin/ncbi-genome-download'
url: 'https://github.com/kblin/ncbi-genome-download'
abstract: >
Some script to download bacterial and fungal genomes from
NCBI after they restructured their FTP a while ago.
license: Apache-2.0
version: 0.3.3
date-released: '2023-07-28'
GitHub Events
Total
- Issues event: 5
- Watch event: 69
- Issue comment event: 7
- Push event: 2
- Fork event: 7
Last Year
- Issues event: 5
- Watch event: 69
- Issue comment event: 7
- Push event: 2
- Fork event: 7
Committers
Last synced: 11 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Kai Blin | k****n@b****k | 206 |
| Marc Bourqui | m****i@a****h | 27 |
| Ruben Vorderman | r****n@l****l | 25 |
| Adelme Bazin | a****n@g****r | 5 |
| Marco Galardini | g****3@g****m | 5 |
| Peter Cock | p****k@g****m | 4 |
| Joe Healey | j****y@g****m | 4 |
| Tessa Pierce | n****e@g****m | 3 |
| James Yang | y****9@g****m | 3 |
| Nicholas Youngblut | n****t@t****e | 3 |
| Gerrit Ansmann | b****a@e****m | 2 |
| Ryan Wick | r****k@g****m | 2 |
| Tianhua Liao | l****h@g****m | 2 |
| Paul Saary | s****y@e****k | 2 |
| Chris Gulvik | c****k | 1 |
| Istvan Albert | i****t@g****m | 1 |
| Moray Smith | 6****l | 1 |
| jamesyang | 3****t | 1 |
| Jason Davis-Cooke | j****e@i****m | 1 |
| David Morgan | d****n@M****l | 1 |
| Andreas Sjödin | a****d@w****e | 1 |
| An Phung | a****e@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 103
- Total pull requests: 21
- Average time to close issues: 10 months
- Average time to close pull requests: about 2 months
- Total issue authors: 83
- Total pull request authors: 16
- Average comments per issue: 3.12
- Average comments per pull request: 1.43
- Merged pull requests: 14
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 4
- Pull requests: 0
- Average time to close issues: 14 days
- Average time to close pull requests: N/A
- Issue authors: 4
- Pull request authors: 0
- Average comments per issue: 0.75
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- kblin (4)
- phiweger (3)
- tseemann (3)
- openpaul (2)
- sanyalab (2)
- Tylersuard (2)
- Liao-PRIC (2)
- 444thLiao (2)
- johanneswerner (2)
- KinSimon96 (2)
- RichardCorbett (2)
- nahid18 (2)
- Nilad (2)
- semihorhanbio (2)
- dutchscientist (2)
Pull Request Authors
- llxlr (3)
- openpaul (3)
- axbazin (2)
- kblin (2)
- andrewsanchez (1)
- ialbert (1)
- Wrzlprmft (1)
- anphung (1)
- twelvesummer (1)
- rhpvorderman (1)
- jrjhealey (1)
- chasemc (1)
- 444thLiao (1)
- SwiftSeal (1)
- peterjc (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 1,936 last-month
- Total docker downloads: 7,352
- Total dependent packages: 3
- Total dependent repositories: 8
- Total versions: 25
- Total maintainers: 2
pypi.org: ncbi-genome-download
Download genome files from the NCBI FTP server.
- Homepage: https://github.com/kblin/ncbi-genome-download/
- Documentation: https://ncbi-genome-download.readthedocs.io/
- License: Apache Software License
-
Latest release: 0.3.3
published over 2 years ago
Rankings
Dependencies
- appdirs *
- requests *
- tqdm *
- coverage *
- pytest *
- pytest-cov *
- pytest-mock *
- requests-mock *
- actions/checkout v2 composite
- actions/setup-python v1 composite
- actions/checkout v2 composite
- actions/setup-python v1 composite