Metadata-Version: 2.0
Name: ncbi-genome-download
Version: 0.2.5
Summary: Download genome files from the NCBI FTP server.
Home-page: https://github.com/kblin/ncbi-genome-download/
Author: Kai Blin
Author-email: kblin@biosustain.dtu.dk
License: Apache Software License
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Dist: pyOpenSSL; python_version < '2.7.9' or python_full_version in '2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8'
Requires-Dist: enum34; python_version < '3.4.0' or python_full_version in '2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.7.10 2.7.11 2.7.12 2.7.13 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6'
Requires-Dist: requests >= 2.4.3

NCBI Genome Downloading Scripts
===============================

| |Build Status|
| |Code Health|
| |PyPI release|

| Some script to download bacterial and fungal genomes from NCBI after
  they
| restructured their FTP a while ago.

| Idea shamelessly stolen from `Mick Watson's Kraken downloader
  scripts <http://www.opiniomics.org/building-a-kraken-database-with-new-ftp-structure-and-no-gi-numbers/>`__
| that can also be found in `Mick's GitHub
  repo <https://github.com/mw55309/Kraken_db_install_scripts>`__.
  However, Mick's
| scripts are [STRIKEOUT:written in Perl] specific to actually building
  a Kraken database
| (as advertised).

So this is a set of scripts that focuses on the actual genome
downloading.

Installation
------------

::

    pip install ncbi-genome-download

Alternatively, clone this repository from GitHub, then run (in a python
virtual environment)

::

    pip install .

If this fails on older versions of Python, try updating your ``pip``
tool first:

::

    pip install --upgrade pip

and then rerun the ``ncbi-genome-download`` install.

| ``ncbi-genome-download`` is only developed and tested on Python
  releases still under active
| support by the Python project. At the moment, this means versions 2.7,
  3.3, 3.4, 3.5 and 3.6.
| Specifically, no attempt at testing under Python versions older than
  2.7 or 3.3 is being made.

| If your system is stuck on an older version of Python, consider using
  a tool like
| `Homebrew <http://brew.sh>`__ or `Linuxbrew <http://linuxbrew.sh>`__
  to obtain a more up-to-date
| version.

Usage
-----

To download all bacterial RefSeq genomes in GenBank format from NCBI,
run the following:

::

    ncbi-genome-download bacteria

If you're on a reasonably fast connection, you might want to try running
multiple downloads in parallel:

::

    ncbi-genome-download bacteria --parallel 4

To download all fungal GenBank genomes from NCBI in GenBank format, run:

::

    ncbi-genome-download --section genbank fungi

To download all viral RefSeq genomes in FASTA format, run:

::

    ncbi-genome-download --format fasta viral

To download only completed bacterial RefSeq genomes in GenBank format,
run:

::

    ncbi-genome-download --assembly-level complete bacteria

To download only bacterial reference genomes from RefSeq in GenBank
format, run:

::

    ncbi-genome-download --refseq-category reference bacteria

To download bacterial RefSeq genomes of the genus *Streptomyces*, run:

::

    ncbi-genome-download --genus Streptomyces bacteria

**Note**: This is a simple string match on the organism name provided by
NCBI only.

You can also use this with a slight trick to download genomes of a
certain species as well:

::

    ncbi-genome-download --genus "Streptomyces coelicolor" bacteria

| **Note**: The quotes are important. Again, this is a simple string
  match on the organism
| name provided by the NCBI.

To download bacterial RefSeq genomes based on their NCBI species
taxonomy ID, run:

::

    ncbi-genome-download --species-taxid 562 bacteria

**Note**: The above command will download all RefSeq genomes belonging
to *Escherichia coli*.

To download a specific bacterial RefSeq genomes based on its NCBI
taxonomy ID, run:

::

    ncbi-genome-download --taxid 511145 bacteria

**Note**: The above command will download the RefSeq genome belonging to
*Escherichia coli str. K-12 substr. MG1655*.

| It is possible to also create a human-readable directory structure in
  parallel to mirroring
| the layout used by NCBI:

::

    ncbi-genome-download --human-readable bacteria

| This will use links to point to the appropriate files in the NCBI
  directory structure,
| so it saves file space. Note that links are not supported on some
  Windows file systems and some
| older versions of Windows.

| It is also possible to re-run a previous download with the
  ``--human-readable`` option.
| In this case, ``ncbi-genome-download`` will not download any new
  genome files, and just create
| human-readable directory structure. Note that if any files have been
  changed on the NCBI side,
| a file download will be triggered.

To get an overview of all options, run

::

    ncbi-genome-download --help

As a method
~~~~~~~~~~~

| You can also use it as a method call. Pass the pythonised keyword
  arguments (``_`` instead of ``-``)
| as described above or in the ``--help``:

::

    import ncbi_genome_download as ngd
    ngd.download()

**Note**: To specify a taxonomic group, like *bacteria*, use the
``group`` keyword.

License
-------

| All code is available under the Apache License version 2, see the
| ```LICENSE`` <LICENSE>`__ file for details.

.. |Build Status| image:: https://github.drone.secondarymetabolites.org/api/badges/kblin/ncbi-genome-download/status.svg
   :target: https://github.drone.secondarymetabolites.org/kblin/ncbi-genome-download
.. |Code Health| image:: https://landscape.io/github/kblin/ncbi-genome-download/master/landscape.svg?style=flat
   :target: https://landscape.io/github/kblin/ncbi-genome-download/master
.. |PyPI release| image:: https://img.shields.io/pypi/v/ncbi-genome-download.svg
   :target: https://pypi.python.org/pypi/ncbi-genome-download/


