# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['tbpore']

package_data = \
{'': ['*']}

install_requires = \
['click>=8.0.3,<9.0.0',
 'cyvcf2>=0.30,<0.31',
 'loguru>=0.5.3,<0.6.0',
 'networkx>=2.8,<3.0',
 'pandas>=1.4.2,<2.0.0',
 'pysam>=0.19.0,<0.20.0',
 'pyyaml>=6.0']

entry_points = \
{'console_scripts': ['tbpore = tbpore.tbpore:main']}

setup_kwargs = {
    'name': 'tbpore',
    'version': '0.1.0',
    'description': 'Mycobacterium tuberculosis genomic analysis from Nanopore sequencing data',
    'long_description': "# TBpore\n\n*Mycobacterium tuberculosis* genomic analysis from Nanopore sequencing data\n\n[![Python CI](https://github.com/mbhall88/tbpore/actions/workflows/ci.yaml/badge.svg)](https://github.com/mbhall88/tbpore/actions/workflows/ci.yaml)\n[![codecov](https://codecov.io/gh/mbhall88/tbpore/branch/main/graph/badge.svg)](https://codecov.io/gh/mbhall88/tbpore)\n[![PyPI](https://img.shields.io/pypi/v/tbpore)](https://pypi.org/project/tbpore/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tbpore)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n**⚠️WORK IN PROGRESS⚠️**\n\n[TOC]: #\n\n# Table of Contents\n- [Synopsis](#synopsis)\n- [Installation](#installation)\n- [Configuring the decontamination database index](#configuring-the-decontamination-database-index)\n- [Performance](#performance)\n- [Usage](#usage)\n\n# Synopsis\n\n`tbpore` is a tool with two main goals.\nFirst is to process Nanopore Mycobacterium tuberculosis sequencing data to describe variants with respect to the\ncanonical TB strain H37Rv and predict antibiotic resistance (command `tbpore process`).\nVariant description is done by decontaminating reads, calling variants with\n[bcftools](https://github.com/samtools/bcftools) and filtering variants.\nAntibiotic resistance is predicted with [mykrobe](https://github.com/Mykrobe-tools/mykrobe).\nSecond, `tbpore` can be used to cluster TB samples based on their genotyping and a given distance threshold (command\n`tbpore cluster`).\n\n# Installation\n\n<!---\n## conda\n\n`conda install tbpore`\n-->\n\n## local\n\n### Dependencies\n* `git`\n* `conda`\n\n### Walkthrough\n\nThe following steps will create a [conda](https://docs.conda.io/en/latest/) environment named `tbpore` which will\ncontain all dependencies and `tbpore` itself.\n\n```\ngit clone https://github.com/mbhall88/tbpore  # get tbpore source code\ncd tbpore\nconda env create -f environment.yaml && conda activate tbpore  # install dependencies\njust install  # install tbpore\njust check  # check installation is fine\ntbpore -h  # print usage\n```\n\nWhenever you want to rerun `tbpore` and you are not already in the `conda` `tbpore` environment, you can activate it by\nrunning `conda activate tbpore` and then `tbpore` will be available.\n\n# Configuring the decontamination database index\n\nWhen you run your first `tbpore process`, you will get this error:\n```\nERROR    | Decontamination DB index tbpore/data/decontamination_db/tbpore.remove_contam.fa.gz.map-ont.mmi does not\nexist, please follow the instructions at https://github.com/mbhall88/tbpore#configuring-the-decontamination-database-index\nto download and configure it before running tbpore\n```\nThis means you need to download the [minimap2](https://github.com/lh3/minimap2) decontamination database index before\nproceeding. We did not include this index in this repo as it is too heavy. Right now this index is private and can be\ndownloaded by logging with your credentials into the EBI private FTP server `ftp-private.ebi.ac.uk` and downloading the\nindex at `tbpore/0.1.0/decontamination_db/tbpore.remove_contam.fa.gz.map-ont.mmi.gz`. Once the download is complete,\nyou can:\n\n1. Ensure that the compressed index was transferred correctly by checking its `md5sum`:\n```\n$ md5sum tbpore.remove_contam.fa.gz.map-ont.mmi.gz\n82d050e0f1cba052f0c94f16fcb32f7b  tbpore.remove_contam.fa.gz.map-ont.mmi.gz\n```\n\n2. Decompress the index:\n```\ngunzip tbpore.remove_contam.fa.gz.map-ont.mmi.gz\n```\n\n3. Check the md5sum of the decompressed index:\n```\n$ md5sum tbpore.remove_contam.fa.gz.map-ont.mmi\n810c5c09eaf9421128e4e52cdf2fa32a  tbpore.remove_contam.fa.gz.map-ont.mmi\n```\n\n4. Move the decompressed index to `<tbpore_dir>/data/decontamination_db/tbpore.remove_contam.fa.gz.map-ont.mmi`\n\nOnce these four steps above are done, you should be able to run `tbpore` on an example isolate by going into the\n`tbpore` dir and running:\n```\njust test-run\n```\n\n# Performance\n\n## `tbpore process`\n\nBenchmarked on 151 TB ONT samples with 1 thread:\n* Runtime: `2103`s avg, `4048`s max (s = seconds);\n* RAM: `12.4`GB avg, `13.1`GB max (GB = Gigabytes);\n\n## `tbpore cluster`\n\nClustering 151 TB ONT samples:\n* Runtime: `286`s;\n* RAM: `<1`GB;\n\n# Usage\n\n## General usage\n\n```\nUsage: tbpore [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  -h, --help     Show this message and exit.\n  -V, --version  Show the version and exit.\n  -v, --verbose  Turns on debug-level logger. Option is mutually exclusive\n                 with quiet.\n  -q, --quiet    Turns off all logging except errors. Option is mutually\n                 exclusive with verbose.\n\nCommands:\n  cluster  Cluster consensus sequences\n  process  Single-sample TB genomic analysis from Nanopore sequencing data\n```\n\n## process subcommand\n\n```\nUsage: tbpore process [OPTIONS] [INPUTS]...\n\n  Single-sample TB genomic analysis from Nanopore sequencing data\n\n  INPUTS: Fastq file(s) and/or a directory containing fastq files. All files\n  will be joined into a single fastq file, so ensure they're all part of the\n  same sample/isolate.\n\nOptions:\n  -o, --outdir DIRECTORY          Directory to place output files  [default:\n                                  tbpore_out]\n  -r, --recursive                 Recursively search INPUTS for fastq files\n  --tmp DIRECTORY                 Specify where to write all (tbpore)\n                                  temporary files. [default: <outdir>/.tbpore]\n  -S, --name TEXT                 Name of the sample. By default, will use the\n                                  first INPUT file with any extensions\n                                  stripped\n  -t, --threads INTEGER           Number of threads to use in multithreaded\n                                  tools  [default: 1]\n  -A, --report_all_mykrobe_calls  Report all mykrobe calls (turn on flag -A,\n                                  --report_all_calls when calling mykrobe)\n  -d, --cleanup / -D, --no-cleanup\n                                  Remove all temporary files on *successful*\n                                  completion  [default: no-cleanup]\n  --help                          Show this message and exit.\n```\n\n## cluster subcommand\n\n```\nUsage: tbpore cluster [OPTIONS] [INPUTS]...\n\n  Cluster consensus sequences\n\n  Preferably input consensus sequences previously generated with tbpore\n  process.\n\n  INPUTS: Two or more consensus fasta sequences. Use glob patterns to input\n  several easily (e.g. output/sample_*/*.consensus.fa).\n\nOptions:\n  -T, --threshold INTEGER         Clustering threshold  [default: 6]\n  -o, --outdir DIRECTORY          Directory to place output files  [default:\n                                  cluster_out]\n  --tmp DIRECTORY                 Specify where to write all (tbpore)\n                                  temporary files. [default: <outdir>/.tbpore]\n  -t, --threads INTEGER           Number of threads to use in multithreaded\n                                  tools  [default: 1]\n  -d, --cleanup / -D, --no-cleanup\n                                  Remove all temporary files on *successful*\n                                  completion  [default: no-cleanup]\n  --help                          Show this message and exit.\n```",
    'author': 'Michael Hall',
    'author_email': 'michael@mbh.sh',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/mbhall88/tbpore',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
