diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2cab74ba..65af5d3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,7 +9,7 @@ jobs: max-parallel: 4 matrix: os: [ubuntu-latest, macos-latest] - python-version: ["3.8", "3.10"] + python-version: ["3.8", "3.10", "3.12"] steps: - uses: actions/checkout@v4 @@ -31,9 +31,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -e . + pip install -e '.[tests]' - name: Test with pytest run: | - pip install PyYAML pytest pytest-cov pytest-benchmark mock pytest --cov=jcvi tests diff --git a/.gitignore b/.gitignore index 4855cfe6..41823e69 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,15 @@ -# Created by http://www.gitignore.io +# Mac stuff +.DS_Store + +# Development +dev/ + +# Versioning +src/jcvi/_version.py + +# Ignore Cython generated C files +src/jcvi/assembly/chic.c +src/jcvi/formats/cblast.c # Dev testing dev @@ -7,6 +18,7 @@ dev # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] +*$py.class # C extensions *.so @@ -17,12 +29,15 @@ env/ build/ develop-eggs/ dist/ +downloads/ eggs/ +.eggs/ lib/ lib64/ parts/ sdist/ var/ +wheels/ *.egg-info/ .installed.cfg *.egg @@ -35,9 +50,12 @@ pip-delete-this-directory.txt htmlcov/ .tox/ .coverage +.coverage.* .cache nosetests.xml coverage.xml +*.cover +.hypothesis/ # Translations *.mo @@ -51,3 +69,4 @@ docs/_build/ # gffutils temp DB file *.db +src/jcvi/version.py diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 708975ee..00000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -recursive-exclude .github * -recursive-exclude docker * -recursive-exclude tests * -exclude .* \ No newline at end of file diff --git a/README.md b/README.md index e5e9c9ec..e6767f86 100644 --- a/README.md +++ b/README.md @@ -104,49 +104,77 @@ full-fledged applications. ## Dependencies -Following are a list of third-party python packages that are used by -some routines in the library. These dependencies are _not_ mandatory -since they are only used by a few modules. +JCVI requires Python3 between v3.8 and v3.12. -- [Biopython](http://www.biopython.org) -- [numpy](http://numpy.scipy.org) -- [matplotlib](http://matplotlib.org/) +A few modules may ask for locations of external programs, +if the executable cannot be found in your `PATH`. -There are other Python modules here and there in various scripts. The -best way is to install them via `pip install` when you see -`ImportError`. +The external programs that are often used are: + +- [Kent tools](http://hgdownload.cse.ucsc.edu/admin/jksrc.zip) +- [BEDTOOLS](http://code.google.com/p/bedtools/) +- [EMBOSS](http://emboss.sourceforge.net/) ## Installation -The easiest way is to install it via PyPI: +**Installing JCVI in a Conda environment:** -```console -pip install jcvi +You can create a Conda environment with Python 3.12 and basic dependencies for JCVI using the YAML files in this repo. + +If you are new to Conda, we recommend the [Miniforge](https://conda-forge.org/download/) distribution. + + +```bash +conda env create -f environment.yml + +conda activate jcvi ``` -To install the development version: +Note: If you are using a Mac with an ARM64 (Apple Silicon) processor, some dependencies are not currently available from Bioconda for this architecture. -```console +You can instead create a virtual OSX64 (intel) env like this: + +```bash +conda env create -f env_osx64.yml + +conda activate jcvi-osx64 +``` + +After activating the Conda environment install JCVI using one of the following options. + + +**Installation options:** + +1) Use pip to install the latest development version directly from this repo. + +```bash pip install git+git://github.com/tanghaibao/jcvi.git ``` -Alternatively, if you want to install manually: +2) Install latest release from PyPi. -```console -cd ~/code # or any directory of your choice -git clone git://github.com/tanghaibao/jcvi.git -pip install -e . +```bash +pip install jcvi ``` -In addition, a few module might ask for locations of external programs, -if the extended cannot be found in your `PATH`. The external programs -that are often used are: +3) Alternatively, if you want to install in development mode. -- [Kent tools](http://hgdownload.cse.ucsc.edu/admin/jksrc.zip) -- [BEDTOOLS](http://code.google.com/p/bedtools/) -- [EMBOSS](http://emboss.sourceforge.net/) +```bash +git clone git://github.com/tanghaibao/jcvi.git && cd jcvi +pip install -e '.[tests]' +``` + +**Test Installation:** + +If installed successfully, you can check the version with: + +```bash +jcvi --version +``` + +Use `python -m` to call any of the modules installed with JCVI. -Most of the scripts in this package contains multiple actions. To use +Most of the modules in this package contains multiple actions. To use the `fasta` example: ```console diff --git a/build.py b/build.py new file mode 100644 index 00000000..ea014d38 --- /dev/null +++ b/build.py @@ -0,0 +1,9 @@ +import subprocess +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + + +class CustomBuildHook(BuildHookInterface): + def initialize(self, version, build_data): + # Run setup.py build_ext before main build + subprocess.check_call(["python", "setup.py", "build_ext", "--inplace"]) + return super().initialize(version, build_data) diff --git a/env_osx64.yml b/env_osx64.yml new file mode 100644 index 00000000..74bf21e8 --- /dev/null +++ b/env_osx64.yml @@ -0,0 +1,14 @@ +name: jcvi-osx64 +channels: + - conda-forge/osx-64 + - bioconda/osx-64 +dependencies: + - python 3.12 + - bedtools + - imagemagick + - libmagic # System-level magic library + - wand # Python bindings for ImageMagick + - pip + - pip: + - hatch + - pytest diff --git a/environment.yml b/environment.yml new file mode 100644 index 00000000..f47d16c7 --- /dev/null +++ b/environment.yml @@ -0,0 +1,14 @@ +name: jcvi +channels: + - conda-forge + - bioconda +dependencies: + - python 3.12 + - bedtools + - imagemagick + - libmagic # System-level magic library + - wand # Python bindings for ImageMagick + - pip + - pip: + - pytest + - hatch diff --git a/jcvi/__init__.py b/jcvi/__init__.py deleted file mode 100644 index 89bf10ae..00000000 --- a/jcvi/__init__.py +++ /dev/null @@ -1,28 +0,0 @@ -from datetime import datetime -from importlib.metadata import version, PackageNotFoundError - - -__author__ = ( - "Haibao Tang", - "Vivek Krishnakumar", - "Xingtan Zhang", - "Won Cheol Yim", -) -__copyright__ = f"Copyright (c) 2010-{datetime.now().year}, Haibao Tang" -__email__ = "tanghaibao@gmail.com" -__license__ = "BSD" -__status__ = "Development" - - -try: - VERSION = version(__name__) -except PackageNotFoundError: # pragma: no cover - try: - from .version import version as VERSION # noqa - except ImportError as exc: # pragma: no cover - raise ImportError( - "Failed to find (autogenerated) version.py. " - "This might be because you are installing from GitHub's tarballs, " - "use the PyPI ones." - ) from exc -__version__ = VERSION diff --git a/pyproject.toml b/pyproject.toml index 3adcf6e8..a87b262b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,110 @@ +# Specifies the build system requirements and backend [build-system] requires = [ - "Cython", - "numpy", - "setuptools", - "setuptools_scm[toml]", - "setuptools_scm_git_archive", - "wheel", -] -build-backend = "setuptools.build_meta" - -[tool.setuptools_scm] -write_to = "jcvi/version.py" -git_describe_command = "git describe --dirty --tags --long --match v* --first-parent" -version_scheme = "no-guess-dev" \ No newline at end of file + "hatchling", # Build backend + "hatch-vcs", # Version control system plugin for dynamic versioning + "setuptools", # Setuptools for compiling C extensions + "cython", # Cython for compiling C extensions + "numpy", # NumPy for numerical operations and C extension includes +] +build-backend = "hatchling.build" + +[tool.hatch.build.hooks.custom] +path = "build.py" + +# Project metadata and configuration +[project] +name = "jcvi" +description = "Python utility libraries on genome assembly, annotation and comparative genomics" +readme = "README.md" +requires-python = ">=3.8" +license = {text = "BSD"} +authors = [ + {name = "Haibao Tang", email = "tanghaibao@gmail.com"}, + {name = "Vivek Krishnakumar"}, + {name = "Jingping Li"} +] + +classifiers = [ + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering :: Bio-Informatics" +] + +dependencies = [ + "biopython", + "boto3", + "brewer2mpl", + "CrossMap", + "cython", + "deap", + "ete3", + "ftpretty", + "genomepy", + "gffutils", + "goatools", + "graphviz", + "jinja2", + "matplotlib", + "more-itertools", + "natsort", + "networkx", + "numpy<2", + "ortools", + "pybedtools", + "pyefd", + "pypdf", + "pytesseract", + "rich", + "scikit-image", + "scipy", + "seaborn", + "Wand", + "webcolors" +] + +dynamic = ["version"] + +[project.optional-dependencies] +tests = [ + "mock", + "pytest-benchmark", + "pytest-cov", + "pytest", + "PyYAML", +] + +[project.urls] +homepage = "http://github.com/tanghaibao/jcvi" + +# Command-line script entry point +[project.scripts] +jcvi = "jcvi.cli:main" + +[tool.hatch.metadata] +allow-direct-references = true + +[tool.hatch.build] +packages = ["src/jcvi"] + +[tool.hatch.version] +source = "vcs" + +[tool.hatch.build.hooks.vcs] +version-file = "src/jcvi/_version.py" + +[tool.hatch.version.vcs] +tag-pattern = "v*" +fallback-version = "0.0.0" + +[tool.hatch.build.targets.sdist] +include = [ + "src/**/*.py", + "src/**/*.pyx", + "README.md", +] + +[tool.hatch.build.targets.wheel] +packages = ["src/jcvi"] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 547730ae..00000000 --- a/setup.cfg +++ /dev/null @@ -1,64 +0,0 @@ -[metadata] -name = jcvi -author = Haibao Tang, Vivek Krishnakumar, Jingping Li -author_email = tanghaibao@gmail.com -license = BSD -description = Python utility libraries on genome assembly, annotation and comparative genomics -url = http://github.com/tanghaibao/jcvi -long_description = file: README.md -long_description_content_type = text/markdown -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Science/Research - License :: OSI Approved :: BSD License - Programming Language :: Python - Programming Language :: Python :: 3 - Topic :: Scientific/Engineering :: Bio-Informatics - -[options] -packages = - jcvi - jcvi.formats - jcvi.variation - jcvi.compara - jcvi.assembly - jcvi.projects - jcvi.algorithms - jcvi.annotation - jcvi.utils - jcvi.graphics - jcvi.apps - jcvi.utils.data -zip_safe = False -setup_requires = setuptools>=18.0; cython -install_requires = - CrossMap - Wand - biopython - boto3 - brewer2mpl - deap - ete3 - ftpretty - gffutils - goatools - genomepy - graphviz - jinja2 - matplotlib - more-itertools - natsort - networkx - numpy<2 - ortools - pybedtools - pyefd - pypdf - pytesseract - rich - scikit-image - scipy - seaborn - webcolors -include_package_data = True -tests_require = PyYAML; pytest; pytest-cov; pytest-benchmark; mock diff --git a/setup.py b/setup.py index 09fe097b..5fe88135 100644 --- a/setup.py +++ b/setup.py @@ -1,26 +1,26 @@ #!/usr/bin/env python -"""Package setup""" +"""Package setup for Cython extensions only""" from Cython.Build import build_ext from setuptools import setup, Extension - import numpy as np ext_modules = [ Extension( "jcvi.assembly.chic", - ["jcvi/assembly/chic.pyx"], + ["src/jcvi/assembly/chic.pyx"], include_dirs=[np.get_include()], extra_compile_args=["-O3"], ), Extension( - "jcvi.formats.cblast", ["jcvi/formats/cblast.pyx"], extra_compile_args=["-O3"] + "jcvi.formats.cblast", + ["src/jcvi/formats/cblast.pyx"], + extra_compile_args=["-O3"], ), ] -if __name__ == "__main__": - setup( - cmdclass={"build_ext": build_ext}, - ext_modules=ext_modules, - ) +setup( + ext_modules=ext_modules, + cmdclass={"build_ext": build_ext}, +) diff --git a/src/jcvi/__init__.py b/src/jcvi/__init__.py new file mode 100644 index 00000000..e03ec50e --- /dev/null +++ b/src/jcvi/__init__.py @@ -0,0 +1,21 @@ +from datetime import datetime + +__author__ = ( + "Haibao Tang", + "Vivek Krishnakumar", + "Xingtan Zhang", + "Won Cheol Yim", +) +__copyright__ = f"Copyright (c) 2010-{datetime.now().year}, Haibao Tang" +__email__ = "tanghaibao@gmail.com" +__license__ = "BSD" +__status__ = "Development" + +try: + from ._version import __version__ # noqa +except ImportError as exc: # pragma: no cover + raise ImportError( + "Failed to find (autogenerated) _version.py. " + "This might be because you are installing from GitHub's tarballs, " + "use the PyPI ones." + ) from exc diff --git a/jcvi/algorithms/__init__.py b/src/jcvi/algorithms/__init__.py similarity index 100% rename from jcvi/algorithms/__init__.py rename to src/jcvi/algorithms/__init__.py diff --git a/jcvi/algorithms/__main__.py b/src/jcvi/algorithms/__main__.py similarity index 100% rename from jcvi/algorithms/__main__.py rename to src/jcvi/algorithms/__main__.py diff --git a/jcvi/algorithms/ec.py b/src/jcvi/algorithms/ec.py similarity index 100% rename from jcvi/algorithms/ec.py rename to src/jcvi/algorithms/ec.py diff --git a/jcvi/algorithms/formula.py b/src/jcvi/algorithms/formula.py similarity index 100% rename from jcvi/algorithms/formula.py rename to src/jcvi/algorithms/formula.py diff --git a/jcvi/algorithms/graph.py b/src/jcvi/algorithms/graph.py similarity index 100% rename from jcvi/algorithms/graph.py rename to src/jcvi/algorithms/graph.py diff --git a/jcvi/algorithms/lis.py b/src/jcvi/algorithms/lis.py similarity index 100% rename from jcvi/algorithms/lis.py rename to src/jcvi/algorithms/lis.py diff --git a/jcvi/algorithms/lpsolve.py b/src/jcvi/algorithms/lpsolve.py similarity index 100% rename from jcvi/algorithms/lpsolve.py rename to src/jcvi/algorithms/lpsolve.py diff --git a/jcvi/algorithms/matrix.py b/src/jcvi/algorithms/matrix.py similarity index 100% rename from jcvi/algorithms/matrix.py rename to src/jcvi/algorithms/matrix.py diff --git a/jcvi/algorithms/maxsum.py b/src/jcvi/algorithms/maxsum.py similarity index 100% rename from jcvi/algorithms/maxsum.py rename to src/jcvi/algorithms/maxsum.py diff --git a/jcvi/algorithms/supermap.py b/src/jcvi/algorithms/supermap.py similarity index 100% rename from jcvi/algorithms/supermap.py rename to src/jcvi/algorithms/supermap.py diff --git a/jcvi/algorithms/tsp.py b/src/jcvi/algorithms/tsp.py similarity index 100% rename from jcvi/algorithms/tsp.py rename to src/jcvi/algorithms/tsp.py diff --git a/jcvi/annotation/__init__.py b/src/jcvi/annotation/__init__.py similarity index 100% rename from jcvi/annotation/__init__.py rename to src/jcvi/annotation/__init__.py diff --git a/jcvi/annotation/__main__.py b/src/jcvi/annotation/__main__.py similarity index 100% rename from jcvi/annotation/__main__.py rename to src/jcvi/annotation/__main__.py diff --git a/jcvi/annotation/ahrd.py b/src/jcvi/annotation/ahrd.py similarity index 100% rename from jcvi/annotation/ahrd.py rename to src/jcvi/annotation/ahrd.py diff --git a/jcvi/annotation/automaton.py b/src/jcvi/annotation/automaton.py similarity index 100% rename from jcvi/annotation/automaton.py rename to src/jcvi/annotation/automaton.py diff --git a/jcvi/annotation/depth.py b/src/jcvi/annotation/depth.py similarity index 100% rename from jcvi/annotation/depth.py rename to src/jcvi/annotation/depth.py diff --git a/jcvi/annotation/evm.py b/src/jcvi/annotation/evm.py similarity index 100% rename from jcvi/annotation/evm.py rename to src/jcvi/annotation/evm.py diff --git a/jcvi/annotation/maker.py b/src/jcvi/annotation/maker.py similarity index 100% rename from jcvi/annotation/maker.py rename to src/jcvi/annotation/maker.py diff --git a/jcvi/annotation/pasa.py b/src/jcvi/annotation/pasa.py similarity index 100% rename from jcvi/annotation/pasa.py rename to src/jcvi/annotation/pasa.py diff --git a/jcvi/annotation/qc.py b/src/jcvi/annotation/qc.py similarity index 100% rename from jcvi/annotation/qc.py rename to src/jcvi/annotation/qc.py diff --git a/jcvi/annotation/reformat.py b/src/jcvi/annotation/reformat.py similarity index 100% rename from jcvi/annotation/reformat.py rename to src/jcvi/annotation/reformat.py diff --git a/jcvi/annotation/stats.py b/src/jcvi/annotation/stats.py similarity index 100% rename from jcvi/annotation/stats.py rename to src/jcvi/annotation/stats.py diff --git a/jcvi/annotation/train.py b/src/jcvi/annotation/train.py similarity index 100% rename from jcvi/annotation/train.py rename to src/jcvi/annotation/train.py diff --git a/jcvi/annotation/trinity.py b/src/jcvi/annotation/trinity.py similarity index 100% rename from jcvi/annotation/trinity.py rename to src/jcvi/annotation/trinity.py diff --git a/jcvi/apps/__init__.py b/src/jcvi/apps/__init__.py similarity index 100% rename from jcvi/apps/__init__.py rename to src/jcvi/apps/__init__.py diff --git a/jcvi/apps/__main__.py b/src/jcvi/apps/__main__.py similarity index 100% rename from jcvi/apps/__main__.py rename to src/jcvi/apps/__main__.py diff --git a/jcvi/apps/align.py b/src/jcvi/apps/align.py similarity index 100% rename from jcvi/apps/align.py rename to src/jcvi/apps/align.py diff --git a/jcvi/apps/base.py b/src/jcvi/apps/base.py similarity index 99% rename from jcvi/apps/base.py rename to src/jcvi/apps/base.py index cdee0853..2dcbe53b 100644 --- a/jcvi/apps/base.py +++ b/src/jcvi/apps/base.py @@ -29,6 +29,9 @@ from typing import Any, Collection, List, Optional, Tuple, Union from urllib.parse import urlencode +# from optparse import OptionParser as OptionP, OptionGroup, SUPPRESS_HELP + + from natsort import natsorted from rich.console import Console from rich.logging import RichHandler @@ -1232,7 +1235,7 @@ def setup_magick_home(): if op.isdir(magick_home): os.environ["MAGICK_HOME"] = magick_home else: - logger.error("MAGICK_HOME not set") + logger.warning("MAGICK_HOME not set") def popen(cmd, debug=True, shell="/bin/bash"): diff --git a/jcvi/apps/biomart.py b/src/jcvi/apps/biomart.py similarity index 99% rename from jcvi/apps/biomart.py rename to src/jcvi/apps/biomart.py index d5f9dcac..39ff2cb0 100644 --- a/jcvi/apps/biomart.py +++ b/src/jcvi/apps/biomart.py @@ -133,7 +133,7 @@ def __init__( port="80", name="ensembl", virtual_schema="default", - **attrib + **attrib, ): self.__dict__ = attrib.copy() diff --git a/jcvi/apps/blastplus.py b/src/jcvi/apps/blastplus.py similarity index 100% rename from jcvi/apps/blastplus.py rename to src/jcvi/apps/blastplus.py diff --git a/jcvi/apps/bowtie.py b/src/jcvi/apps/bowtie.py similarity index 100% rename from jcvi/apps/bowtie.py rename to src/jcvi/apps/bowtie.py diff --git a/jcvi/apps/bwa.py b/src/jcvi/apps/bwa.py similarity index 100% rename from jcvi/apps/bwa.py rename to src/jcvi/apps/bwa.py diff --git a/jcvi/apps/cdhit.py b/src/jcvi/apps/cdhit.py similarity index 100% rename from jcvi/apps/cdhit.py rename to src/jcvi/apps/cdhit.py diff --git a/jcvi/apps/emboss.py b/src/jcvi/apps/emboss.py similarity index 100% rename from jcvi/apps/emboss.py rename to src/jcvi/apps/emboss.py diff --git a/jcvi/apps/fetch.py b/src/jcvi/apps/fetch.py similarity index 100% rename from jcvi/apps/fetch.py rename to src/jcvi/apps/fetch.py diff --git a/jcvi/apps/gbsubmit.py b/src/jcvi/apps/gbsubmit.py similarity index 100% rename from jcvi/apps/gbsubmit.py rename to src/jcvi/apps/gbsubmit.py diff --git a/jcvi/apps/gmap.py b/src/jcvi/apps/gmap.py similarity index 100% rename from jcvi/apps/gmap.py rename to src/jcvi/apps/gmap.py diff --git a/jcvi/apps/grid.py b/src/jcvi/apps/grid.py similarity index 100% rename from jcvi/apps/grid.py rename to src/jcvi/apps/grid.py diff --git a/jcvi/apps/lastz.py b/src/jcvi/apps/lastz.py similarity index 100% rename from jcvi/apps/lastz.py rename to src/jcvi/apps/lastz.py diff --git a/jcvi/apps/mask.py b/src/jcvi/apps/mask.py similarity index 100% rename from jcvi/apps/mask.py rename to src/jcvi/apps/mask.py diff --git a/jcvi/apps/phylo.py b/src/jcvi/apps/phylo.py similarity index 99% rename from jcvi/apps/phylo.py rename to src/jcvi/apps/phylo.py index e93485e7..15fd2564 100644 --- a/jcvi/apps/phylo.py +++ b/src/jcvi/apps/phylo.py @@ -106,7 +106,7 @@ def __init__( outtreefile, command=FPHYLIP_BIN("ffitch"), intreefile=None, - **kwargs + **kwargs, ): self.datafile = datafile @@ -144,7 +144,7 @@ def __init__( a_ext, command=TREEFIX_BIN("treefix"), r=False, - **kwargs + **kwargs, ): self.input = input @@ -175,7 +175,7 @@ def run_treefix( a_ext=".fasta", o_ext=".dnd", n_ext=".treefix.dnd", - **kwargs + **kwargs, ): """ get the ML tree closest to the species tree @@ -187,7 +187,7 @@ def run_treefix( a_ext=a_ext, o=o_ext, n=n_ext, - **kwargs + **kwargs, ) outtreefile = input.rsplit(o_ext, 1)[0] + n_ext print("TreeFix:", cl, file=sys.stderr) @@ -435,7 +435,7 @@ def build_ml_raxml(alignment, outfile, work_dir=".", **kwargs): num_replicates=100, name="aln", working_dir=raxml_work, - **kwargs + **kwargs, ) logger.debug("Building ML tree using RAxML: %s" % raxml_cl) @@ -1048,7 +1048,7 @@ def _draw_trees( reroot=False, supportcolor="r", SH=SH, - **kwargs + **kwargs, ) root.set_xlim(0, 1) diff --git a/jcvi/apps/r.py b/src/jcvi/apps/r.py similarity index 100% rename from jcvi/apps/r.py rename to src/jcvi/apps/r.py diff --git a/jcvi/apps/restriction.py b/src/jcvi/apps/restriction.py similarity index 100% rename from jcvi/apps/restriction.py rename to src/jcvi/apps/restriction.py diff --git a/jcvi/apps/softlink.py b/src/jcvi/apps/softlink.py similarity index 100% rename from jcvi/apps/softlink.py rename to src/jcvi/apps/softlink.py diff --git a/jcvi/apps/uclust.py b/src/jcvi/apps/uclust.py similarity index 100% rename from jcvi/apps/uclust.py rename to src/jcvi/apps/uclust.py diff --git a/jcvi/apps/uniprot.py b/src/jcvi/apps/uniprot.py similarity index 100% rename from jcvi/apps/uniprot.py rename to src/jcvi/apps/uniprot.py diff --git a/jcvi/apps/vecscreen.py b/src/jcvi/apps/vecscreen.py similarity index 100% rename from jcvi/apps/vecscreen.py rename to src/jcvi/apps/vecscreen.py diff --git a/jcvi/apps/wga2ribbon.py b/src/jcvi/apps/wga2ribbon.py similarity index 100% rename from jcvi/apps/wga2ribbon.py rename to src/jcvi/apps/wga2ribbon.py diff --git a/jcvi/assembly/__init__.py b/src/jcvi/assembly/__init__.py similarity index 100% rename from jcvi/assembly/__init__.py rename to src/jcvi/assembly/__init__.py diff --git a/jcvi/assembly/__main__.py b/src/jcvi/assembly/__main__.py similarity index 100% rename from jcvi/assembly/__main__.py rename to src/jcvi/assembly/__main__.py diff --git a/jcvi/assembly/allmaps.py b/src/jcvi/assembly/allmaps.py similarity index 100% rename from jcvi/assembly/allmaps.py rename to src/jcvi/assembly/allmaps.py diff --git a/jcvi/assembly/allpaths.py b/src/jcvi/assembly/allpaths.py similarity index 100% rename from jcvi/assembly/allpaths.py rename to src/jcvi/assembly/allpaths.py diff --git a/jcvi/assembly/automaton.py b/src/jcvi/assembly/automaton.py similarity index 100% rename from jcvi/assembly/automaton.py rename to src/jcvi/assembly/automaton.py diff --git a/jcvi/assembly/base.py b/src/jcvi/assembly/base.py similarity index 100% rename from jcvi/assembly/base.py rename to src/jcvi/assembly/base.py diff --git a/jcvi/assembly/chic.pyx b/src/jcvi/assembly/chic.pyx similarity index 100% rename from jcvi/assembly/chic.pyx rename to src/jcvi/assembly/chic.pyx diff --git a/jcvi/assembly/coverage.py b/src/jcvi/assembly/coverage.py similarity index 100% rename from jcvi/assembly/coverage.py rename to src/jcvi/assembly/coverage.py diff --git a/jcvi/assembly/gaps.py b/src/jcvi/assembly/gaps.py similarity index 100% rename from jcvi/assembly/gaps.py rename to src/jcvi/assembly/gaps.py diff --git a/jcvi/assembly/geneticmap.py b/src/jcvi/assembly/geneticmap.py similarity index 100% rename from jcvi/assembly/geneticmap.py rename to src/jcvi/assembly/geneticmap.py diff --git a/jcvi/assembly/goldenpath.py b/src/jcvi/assembly/goldenpath.py similarity index 100% rename from jcvi/assembly/goldenpath.py rename to src/jcvi/assembly/goldenpath.py diff --git a/jcvi/assembly/hic.py b/src/jcvi/assembly/hic.py similarity index 100% rename from jcvi/assembly/hic.py rename to src/jcvi/assembly/hic.py diff --git a/jcvi/assembly/kmer.py b/src/jcvi/assembly/kmer.py similarity index 100% rename from jcvi/assembly/kmer.py rename to src/jcvi/assembly/kmer.py diff --git a/jcvi/assembly/opticalmap.py b/src/jcvi/assembly/opticalmap.py similarity index 100% rename from jcvi/assembly/opticalmap.py rename to src/jcvi/assembly/opticalmap.py diff --git a/jcvi/assembly/patch.py b/src/jcvi/assembly/patch.py similarity index 100% rename from jcvi/assembly/patch.py rename to src/jcvi/assembly/patch.py diff --git a/jcvi/assembly/postprocess.py b/src/jcvi/assembly/postprocess.py similarity index 100% rename from jcvi/assembly/postprocess.py rename to src/jcvi/assembly/postprocess.py diff --git a/jcvi/assembly/preprocess.py b/src/jcvi/assembly/preprocess.py similarity index 100% rename from jcvi/assembly/preprocess.py rename to src/jcvi/assembly/preprocess.py diff --git a/jcvi/assembly/sim.py b/src/jcvi/assembly/sim.py similarity index 100% rename from jcvi/assembly/sim.py rename to src/jcvi/assembly/sim.py diff --git a/jcvi/assembly/soap.py b/src/jcvi/assembly/soap.py similarity index 100% rename from jcvi/assembly/soap.py rename to src/jcvi/assembly/soap.py diff --git a/jcvi/assembly/syntenypath.py b/src/jcvi/assembly/syntenypath.py similarity index 100% rename from jcvi/assembly/syntenypath.py rename to src/jcvi/assembly/syntenypath.py diff --git a/src/jcvi/cli.py b/src/jcvi/cli.py new file mode 100644 index 00000000..b55e091a --- /dev/null +++ b/src/jcvi/cli.py @@ -0,0 +1,12 @@ +# cli.py +import argparse +from . import __version__ + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--version', action='version', + version=f'%(prog)s {__version__}') + args = parser.parse_args() + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/jcvi/compara/__init__.py b/src/jcvi/compara/__init__.py similarity index 100% rename from jcvi/compara/__init__.py rename to src/jcvi/compara/__init__.py diff --git a/jcvi/compara/__main__.py b/src/jcvi/compara/__main__.py similarity index 100% rename from jcvi/compara/__main__.py rename to src/jcvi/compara/__main__.py diff --git a/jcvi/compara/base.py b/src/jcvi/compara/base.py similarity index 100% rename from jcvi/compara/base.py rename to src/jcvi/compara/base.py diff --git a/jcvi/compara/blastfilter.py b/src/jcvi/compara/blastfilter.py similarity index 100% rename from jcvi/compara/blastfilter.py rename to src/jcvi/compara/blastfilter.py diff --git a/jcvi/compara/catalog.py b/src/jcvi/compara/catalog.py similarity index 100% rename from jcvi/compara/catalog.py rename to src/jcvi/compara/catalog.py diff --git a/jcvi/compara/fractionation.py b/src/jcvi/compara/fractionation.py similarity index 100% rename from jcvi/compara/fractionation.py rename to src/jcvi/compara/fractionation.py diff --git a/jcvi/compara/ks.py b/src/jcvi/compara/ks.py similarity index 100% rename from jcvi/compara/ks.py rename to src/jcvi/compara/ks.py diff --git a/jcvi/compara/pad.py b/src/jcvi/compara/pad.py similarity index 100% rename from jcvi/compara/pad.py rename to src/jcvi/compara/pad.py diff --git a/jcvi/compara/pedigree.py b/src/jcvi/compara/pedigree.py similarity index 100% rename from jcvi/compara/pedigree.py rename to src/jcvi/compara/pedigree.py diff --git a/jcvi/compara/phylogeny.py b/src/jcvi/compara/phylogeny.py similarity index 100% rename from jcvi/compara/phylogeny.py rename to src/jcvi/compara/phylogeny.py diff --git a/jcvi/compara/quota.py b/src/jcvi/compara/quota.py similarity index 100% rename from jcvi/compara/quota.py rename to src/jcvi/compara/quota.py diff --git a/jcvi/compara/reconstruct.py b/src/jcvi/compara/reconstruct.py similarity index 100% rename from jcvi/compara/reconstruct.py rename to src/jcvi/compara/reconstruct.py diff --git a/jcvi/compara/synfind.py b/src/jcvi/compara/synfind.py similarity index 100% rename from jcvi/compara/synfind.py rename to src/jcvi/compara/synfind.py diff --git a/jcvi/compara/synteny.py b/src/jcvi/compara/synteny.py similarity index 99% rename from jcvi/compara/synteny.py rename to src/jcvi/compara/synteny.py index 190b5b36..2e51711c 100755 --- a/jcvi/compara/synteny.py +++ b/src/jcvi/compara/synteny.py @@ -41,7 +41,7 @@ def __init__(self, filename, defaultcolor="#fb8072", header=False): data = [] highlight = [] for row in fp: - if row[0] == '#': + if row[0] == "#": continue hl = "*" in row # r* highlights the block in red color diff --git a/jcvi/formats/__init__.py b/src/jcvi/formats/__init__.py similarity index 100% rename from jcvi/formats/__init__.py rename to src/jcvi/formats/__init__.py diff --git a/jcvi/formats/__main__.py b/src/jcvi/formats/__main__.py similarity index 100% rename from jcvi/formats/__main__.py rename to src/jcvi/formats/__main__.py diff --git a/jcvi/formats/agp.py b/src/jcvi/formats/agp.py similarity index 100% rename from jcvi/formats/agp.py rename to src/jcvi/formats/agp.py diff --git a/jcvi/formats/base.py b/src/jcvi/formats/base.py similarity index 100% rename from jcvi/formats/base.py rename to src/jcvi/formats/base.py diff --git a/jcvi/formats/bed.py b/src/jcvi/formats/bed.py similarity index 100% rename from jcvi/formats/bed.py rename to src/jcvi/formats/bed.py diff --git a/jcvi/formats/blast.py b/src/jcvi/formats/blast.py similarity index 99% rename from jcvi/formats/blast.py rename to src/jcvi/formats/blast.py index 75de55f6..ab632eec 100644 --- a/jcvi/formats/blast.py +++ b/src/jcvi/formats/blast.py @@ -23,10 +23,11 @@ try: from .cblast import BlastLine -except: +except ImportError as e: + logger.error(f"Failed to import cblast: {e}") from .pyblast import BlastLine - logger.error("Fall back to Python implementation of BlastLine") + logger.warning("Fall back to Python implementation of BlastLine") class BlastSlow(LineFile): diff --git a/jcvi/formats/cblast.pyx b/src/jcvi/formats/cblast.pyx similarity index 100% rename from jcvi/formats/cblast.pyx rename to src/jcvi/formats/cblast.pyx diff --git a/jcvi/formats/cdt.py b/src/jcvi/formats/cdt.py similarity index 100% rename from jcvi/formats/cdt.py rename to src/jcvi/formats/cdt.py diff --git a/jcvi/formats/chain.py b/src/jcvi/formats/chain.py similarity index 100% rename from jcvi/formats/chain.py rename to src/jcvi/formats/chain.py diff --git a/jcvi/formats/contig.py b/src/jcvi/formats/contig.py similarity index 100% rename from jcvi/formats/contig.py rename to src/jcvi/formats/contig.py diff --git a/jcvi/formats/coords.py b/src/jcvi/formats/coords.py similarity index 100% rename from jcvi/formats/coords.py rename to src/jcvi/formats/coords.py diff --git a/jcvi/formats/excel.py b/src/jcvi/formats/excel.py similarity index 100% rename from jcvi/formats/excel.py rename to src/jcvi/formats/excel.py diff --git a/jcvi/formats/fasta.py b/src/jcvi/formats/fasta.py similarity index 100% rename from jcvi/formats/fasta.py rename to src/jcvi/formats/fasta.py diff --git a/jcvi/formats/fastq.py b/src/jcvi/formats/fastq.py similarity index 100% rename from jcvi/formats/fastq.py rename to src/jcvi/formats/fastq.py diff --git a/jcvi/formats/genbank.py b/src/jcvi/formats/genbank.py similarity index 100% rename from jcvi/formats/genbank.py rename to src/jcvi/formats/genbank.py diff --git a/jcvi/formats/gff.py b/src/jcvi/formats/gff.py similarity index 100% rename from jcvi/formats/gff.py rename to src/jcvi/formats/gff.py diff --git a/jcvi/formats/html.py b/src/jcvi/formats/html.py similarity index 100% rename from jcvi/formats/html.py rename to src/jcvi/formats/html.py diff --git a/jcvi/formats/maf.py b/src/jcvi/formats/maf.py similarity index 100% rename from jcvi/formats/maf.py rename to src/jcvi/formats/maf.py diff --git a/jcvi/formats/obo.py b/src/jcvi/formats/obo.py similarity index 100% rename from jcvi/formats/obo.py rename to src/jcvi/formats/obo.py diff --git a/jcvi/formats/paf.py b/src/jcvi/formats/paf.py similarity index 100% rename from jcvi/formats/paf.py rename to src/jcvi/formats/paf.py diff --git a/jcvi/formats/pdf.py b/src/jcvi/formats/pdf.py similarity index 100% rename from jcvi/formats/pdf.py rename to src/jcvi/formats/pdf.py diff --git a/jcvi/formats/psl.py b/src/jcvi/formats/psl.py similarity index 100% rename from jcvi/formats/psl.py rename to src/jcvi/formats/psl.py diff --git a/jcvi/formats/pyblast.py b/src/jcvi/formats/pyblast.py similarity index 100% rename from jcvi/formats/pyblast.py rename to src/jcvi/formats/pyblast.py diff --git a/jcvi/formats/sam.py b/src/jcvi/formats/sam.py similarity index 100% rename from jcvi/formats/sam.py rename to src/jcvi/formats/sam.py diff --git a/jcvi/formats/sizes.py b/src/jcvi/formats/sizes.py similarity index 100% rename from jcvi/formats/sizes.py rename to src/jcvi/formats/sizes.py diff --git a/jcvi/formats/vcf.py b/src/jcvi/formats/vcf.py similarity index 100% rename from jcvi/formats/vcf.py rename to src/jcvi/formats/vcf.py diff --git a/jcvi/graphics/__init__.py b/src/jcvi/graphics/__init__.py similarity index 100% rename from jcvi/graphics/__init__.py rename to src/jcvi/graphics/__init__.py diff --git a/jcvi/graphics/__main__.py b/src/jcvi/graphics/__main__.py similarity index 100% rename from jcvi/graphics/__main__.py rename to src/jcvi/graphics/__main__.py diff --git a/jcvi/graphics/align.py b/src/jcvi/graphics/align.py similarity index 100% rename from jcvi/graphics/align.py rename to src/jcvi/graphics/align.py diff --git a/jcvi/graphics/assembly.py b/src/jcvi/graphics/assembly.py similarity index 100% rename from jcvi/graphics/assembly.py rename to src/jcvi/graphics/assembly.py diff --git a/jcvi/graphics/base.py b/src/jcvi/graphics/base.py similarity index 98% rename from jcvi/graphics/base.py rename to src/jcvi/graphics/base.py index c52a6d70..62113be5 100644 --- a/jcvi/graphics/base.py +++ b/src/jcvi/graphics/base.py @@ -1,9 +1,7 @@ #!/usr/bin/env python # -*- coding: UTF-8 -*- -from os import remove import copy -import logging import os.path as op import re import sys @@ -348,11 +346,15 @@ def savefig(figname, dpi=150, iopts=None, cleanup=True, transparent=False): except: format = "pdf" try: - logging.debug(f"Matplotlib backend is: {mpl.get_backend()}") - logging.debug(f"Attempting save as: {figname}") + logger.debug(f"Matplotlib backend is: {mpl.get_backend()}") + logger.debug(f"Attempting save as: {figname}") plt.savefig(figname, dpi=dpi, format=format, transparent=transparent) except Exception as e: - logger.error("savefig failed with message:\n%s", e) + message = "savefig failed with message:" + message += "\n{0}".format(str(e)) + logger.error(message) + logger.debug(f"Matplotlib backend is: {mpl.get_backend()}") + logger.debug(f"Attempted save as: {format}") logger.info("Try running again with --notex option to disable latex.") if op.exists(figname): if op.getsize(figname) < 1000: diff --git a/jcvi/graphics/blastplot.py b/src/jcvi/graphics/blastplot.py similarity index 100% rename from jcvi/graphics/blastplot.py rename to src/jcvi/graphics/blastplot.py diff --git a/jcvi/graphics/chromosome.py b/src/jcvi/graphics/chromosome.py similarity index 100% rename from jcvi/graphics/chromosome.py rename to src/jcvi/graphics/chromosome.py diff --git a/jcvi/graphics/coverage.py b/src/jcvi/graphics/coverage.py similarity index 100% rename from jcvi/graphics/coverage.py rename to src/jcvi/graphics/coverage.py diff --git a/jcvi/graphics/dotplot.py b/src/jcvi/graphics/dotplot.py similarity index 100% rename from jcvi/graphics/dotplot.py rename to src/jcvi/graphics/dotplot.py diff --git a/jcvi/graphics/glyph.py b/src/jcvi/graphics/glyph.py similarity index 99% rename from jcvi/graphics/glyph.py rename to src/jcvi/graphics/glyph.py index d6de01a1..43a21b95 100644 --- a/jcvi/graphics/glyph.py +++ b/src/jcvi/graphics/glyph.py @@ -76,7 +76,7 @@ def __init__(self, ax, x1, x2, t, lw=0, fill=False, fc="lavender", **kwargs): t, ha="center", bbox=dict(boxstyle="round", fill=fill, fc=fc, lw=lw), - **kwargs + **kwargs, ) @@ -167,7 +167,7 @@ def __init__( size=12, zorder=4, fontweight="bold", - **kwargs + **kwargs, ): width, height = get_asymmetry(ax, radius) circle = Ellipse((x, y), width, height, fc=fc, ec=fc, zorder=zorder, **kwargs) @@ -182,7 +182,7 @@ def __init__( size=size, zorder=zorder + 1, fontweight=fontweight, - **kwargs + **kwargs, ) @@ -273,7 +273,7 @@ def __init__( ec="gainsboro", lw=0, style="box", - **kwargs + **kwargs, ): """Draw a region that represent an interval feature, e.g. gene or repeat @@ -302,7 +302,7 @@ def __init__( fc=fc, ec=ec, lw=lw, - **kwargs + **kwargs, ) else: patch = Rectangle(p1, width, height, fc=fc, ec=ec, lw=lw, **kwargs) @@ -320,7 +320,7 @@ def __init__( fc="w", lw=0, alpha=0.1, - **kwargs + **kwargs, ) ) @@ -357,7 +357,7 @@ def __init__( tip=0.0025, color="k", shadow=False, - **kwargs + **kwargs, ): super().__init__(ax) # Figure out the polygon vertices first diff --git a/jcvi/graphics/grabseeds.py b/src/jcvi/graphics/grabseeds.py similarity index 99% rename from jcvi/graphics/grabseeds.py rename to src/jcvi/graphics/grabseeds.py index 14bcbe09..756a2d78 100644 --- a/jcvi/graphics/grabseeds.py +++ b/src/jcvi/graphics/grabseeds.py @@ -18,6 +18,7 @@ from ..apps.base import setup_magick_home +# Attempt to set MACICK_HOME ENV variable if imagemagick installed with homebrew on Mac setup_magick_home() from PIL.Image import open as iopen diff --git a/jcvi/graphics/heatmap.py b/src/jcvi/graphics/heatmap.py similarity index 100% rename from jcvi/graphics/heatmap.py rename to src/jcvi/graphics/heatmap.py diff --git a/jcvi/graphics/histogram.py b/src/jcvi/graphics/histogram.py similarity index 100% rename from jcvi/graphics/histogram.py rename to src/jcvi/graphics/histogram.py diff --git a/jcvi/graphics/karyotype.py b/src/jcvi/graphics/karyotype.py similarity index 100% rename from jcvi/graphics/karyotype.py rename to src/jcvi/graphics/karyotype.py diff --git a/jcvi/graphics/landscape.py b/src/jcvi/graphics/landscape.py similarity index 100% rename from jcvi/graphics/landscape.py rename to src/jcvi/graphics/landscape.py diff --git a/jcvi/graphics/mummerplot.py b/src/jcvi/graphics/mummerplot.py similarity index 100% rename from jcvi/graphics/mummerplot.py rename to src/jcvi/graphics/mummerplot.py diff --git a/jcvi/graphics/ribbon.py b/src/jcvi/graphics/ribbon.py similarity index 99% rename from jcvi/graphics/ribbon.py rename to src/jcvi/graphics/ribbon.py index b21a78e8..42330cb2 100644 --- a/jcvi/graphics/ribbon.py +++ b/src/jcvi/graphics/ribbon.py @@ -21,11 +21,12 @@ import numpy as np import sys -#from jcvi.formats.base import DictFile +# from jcvi.formats.base import DictFile from jcvi.apps.base import OptionParser, logger from jcvi.compara.synteny import BlockFile from jcvi.formats.bed import Bed -from jcvi.graphics.base import (AbstractLayout, +from jcvi.graphics.base import ( + AbstractLayout, markup, mpl, Path, @@ -33,7 +34,7 @@ plt, savefig, ) -from jcvi.graphics.glyph import Glyph, RoundLabel #, GeneGlyph +from jcvi.graphics.glyph import Glyph, RoundLabel # , GeneGlyph from jcvi.utils.cbook import human_size @@ -223,6 +224,7 @@ def __init__( def cv(t): return xstart + abs(t - startbp) / scale + hidden = layout.hidden # Plot Chromosome Bar @@ -368,7 +370,7 @@ def cv(t): loc_label, color="lightslategrey", size=10, - **kwargs + **kwargs, ) else: ax.text(lx, ly, chr_label, color=layout.color, **kwargs) @@ -817,7 +819,7 @@ def main(): # Check for data files if len(args) != 3: - logger.error('Requires 3 data file args.') + logger.error("Requires 3 data file args.") sys.exit(not p.print_help()) # Unpack data file paths diff --git a/jcvi/graphics/synteny.py b/src/jcvi/graphics/synteny.py similarity index 100% rename from jcvi/graphics/synteny.py rename to src/jcvi/graphics/synteny.py diff --git a/jcvi/graphics/table.py b/src/jcvi/graphics/table.py similarity index 100% rename from jcvi/graphics/table.py rename to src/jcvi/graphics/table.py diff --git a/jcvi/graphics/tree.py b/src/jcvi/graphics/tree.py similarity index 100% rename from jcvi/graphics/tree.py rename to src/jcvi/graphics/tree.py diff --git a/jcvi/graphics/wheel.py b/src/jcvi/graphics/wheel.py similarity index 100% rename from jcvi/graphics/wheel.py rename to src/jcvi/graphics/wheel.py diff --git a/jcvi/projects/__init__.py b/src/jcvi/projects/__init__.py similarity index 100% rename from jcvi/projects/__init__.py rename to src/jcvi/projects/__init__.py diff --git a/jcvi/projects/__main__.py b/src/jcvi/projects/__main__.py similarity index 100% rename from jcvi/projects/__main__.py rename to src/jcvi/projects/__main__.py diff --git a/jcvi/projects/age.py b/src/jcvi/projects/age.py similarity index 100% rename from jcvi/projects/age.py rename to src/jcvi/projects/age.py diff --git a/jcvi/projects/allmaps.py b/src/jcvi/projects/allmaps.py similarity index 99% rename from jcvi/projects/allmaps.py rename to src/jcvi/projects/allmaps.py index edf714c3..a67d8067 100644 --- a/jcvi/projects/allmaps.py +++ b/src/jcvi/projects/allmaps.py @@ -256,7 +256,7 @@ def estimategaps(args): sum(markers) / 2, ypos + pad, "Distance: 1.29cM $\Leftrightarrow$ 211,824bp (6.1 cM/Mb)", - **fontprop + **fontprop, ) ypos = y - pad diff --git a/jcvi/projects/bites.py b/src/jcvi/projects/bites.py similarity index 100% rename from jcvi/projects/bites.py rename to src/jcvi/projects/bites.py diff --git a/jcvi/projects/ies.py b/src/jcvi/projects/ies.py similarity index 100% rename from jcvi/projects/ies.py rename to src/jcvi/projects/ies.py diff --git a/jcvi/projects/jcvi.py b/src/jcvi/projects/jcvi.py similarity index 100% rename from jcvi/projects/jcvi.py rename to src/jcvi/projects/jcvi.py diff --git a/jcvi/projects/misc.py b/src/jcvi/projects/misc.py similarity index 100% rename from jcvi/projects/misc.py rename to src/jcvi/projects/misc.py diff --git a/jcvi/projects/napus.py b/src/jcvi/projects/napus.py similarity index 100% rename from jcvi/projects/napus.py rename to src/jcvi/projects/napus.py diff --git a/jcvi/projects/pineapple.py b/src/jcvi/projects/pineapple.py similarity index 100% rename from jcvi/projects/pineapple.py rename to src/jcvi/projects/pineapple.py diff --git a/jcvi/projects/str.py b/src/jcvi/projects/str.py similarity index 100% rename from jcvi/projects/str.py rename to src/jcvi/projects/str.py diff --git a/jcvi/projects/sugarcane.py b/src/jcvi/projects/sugarcane.py similarity index 100% rename from jcvi/projects/sugarcane.py rename to src/jcvi/projects/sugarcane.py diff --git a/jcvi/projects/synfind.py b/src/jcvi/projects/synfind.py similarity index 100% rename from jcvi/projects/synfind.py rename to src/jcvi/projects/synfind.py diff --git a/jcvi/projects/tgbs.py b/src/jcvi/projects/tgbs.py similarity index 100% rename from jcvi/projects/tgbs.py rename to src/jcvi/projects/tgbs.py diff --git a/jcvi/projects/vanilla.py b/src/jcvi/projects/vanilla.py similarity index 100% rename from jcvi/projects/vanilla.py rename to src/jcvi/projects/vanilla.py diff --git a/jcvi/utils/__init__.py b/src/jcvi/utils/__init__.py similarity index 100% rename from jcvi/utils/__init__.py rename to src/jcvi/utils/__init__.py diff --git a/jcvi/utils/__main__.py b/src/jcvi/utils/__main__.py similarity index 100% rename from jcvi/utils/__main__.py rename to src/jcvi/utils/__main__.py diff --git a/jcvi/utils/aws.py b/src/jcvi/utils/aws.py similarity index 100% rename from jcvi/utils/aws.py rename to src/jcvi/utils/aws.py diff --git a/jcvi/utils/cbook.py b/src/jcvi/utils/cbook.py similarity index 100% rename from jcvi/utils/cbook.py rename to src/jcvi/utils/cbook.py diff --git a/jcvi/utils/console.py b/src/jcvi/utils/console.py similarity index 100% rename from jcvi/utils/console.py rename to src/jcvi/utils/console.py diff --git a/jcvi/utils/data/Airswing.ttf b/src/jcvi/utils/data/Airswing.ttf similarity index 100% rename from jcvi/utils/data/Airswing.ttf rename to src/jcvi/utils/data/Airswing.ttf diff --git a/jcvi/utils/data/Collegia.ttf b/src/jcvi/utils/data/Collegia.ttf similarity index 100% rename from jcvi/utils/data/Collegia.ttf rename to src/jcvi/utils/data/Collegia.ttf diff --git a/jcvi/utils/data/HookedUp.ttf b/src/jcvi/utils/data/HookedUp.ttf similarity index 100% rename from jcvi/utils/data/HookedUp.ttf rename to src/jcvi/utils/data/HookedUp.ttf diff --git a/jcvi/utils/data/Humor-Sans.ttf b/src/jcvi/utils/data/Humor-Sans.ttf similarity index 100% rename from jcvi/utils/data/Humor-Sans.ttf rename to src/jcvi/utils/data/Humor-Sans.ttf diff --git a/jcvi/utils/data/TREDs.meta.csv b/src/jcvi/utils/data/TREDs.meta.csv similarity index 100% rename from jcvi/utils/data/TREDs.meta.csv rename to src/jcvi/utils/data/TREDs.meta.csv diff --git a/jcvi/utils/data/__init__.py b/src/jcvi/utils/data/__init__.py similarity index 100% rename from jcvi/utils/data/__init__.py rename to src/jcvi/utils/data/__init__.py diff --git a/jcvi/utils/data/adapters.fasta b/src/jcvi/utils/data/adapters.fasta similarity index 100% rename from jcvi/utils/data/adapters.fasta rename to src/jcvi/utils/data/adapters.fasta diff --git a/jcvi/utils/data/blosum80.mat b/src/jcvi/utils/data/blosum80.mat similarity index 100% rename from jcvi/utils/data/blosum80.mat rename to src/jcvi/utils/data/blosum80.mat diff --git a/jcvi/utils/data/chrY.hg38.unique_ccn.gc b/src/jcvi/utils/data/chrY.hg38.unique_ccn.gc similarity index 100% rename from jcvi/utils/data/chrY.hg38.unique_ccn.gc rename to src/jcvi/utils/data/chrY.hg38.unique_ccn.gc diff --git a/jcvi/utils/data/colorchecker.txt b/src/jcvi/utils/data/colorchecker.txt similarity index 100% rename from jcvi/utils/data/colorchecker.txt rename to src/jcvi/utils/data/colorchecker.txt diff --git a/jcvi/utils/data/hg38.band.txt b/src/jcvi/utils/data/hg38.band.txt similarity index 100% rename from jcvi/utils/data/hg38.band.txt rename to src/jcvi/utils/data/hg38.band.txt diff --git a/jcvi/utils/data/hg38.chrom.sizes b/src/jcvi/utils/data/hg38.chrom.sizes similarity index 100% rename from jcvi/utils/data/hg38.chrom.sizes rename to src/jcvi/utils/data/hg38.chrom.sizes diff --git a/jcvi/utils/data/instance.json b/src/jcvi/utils/data/instance.json similarity index 100% rename from jcvi/utils/data/instance.json rename to src/jcvi/utils/data/instance.json diff --git a/jcvi/utils/db.py b/src/jcvi/utils/db.py similarity index 100% rename from jcvi/utils/db.py rename to src/jcvi/utils/db.py diff --git a/jcvi/utils/ez_setup.py b/src/jcvi/utils/ez_setup.py similarity index 97% rename from jcvi/utils/ez_setup.py rename to src/jcvi/utils/ez_setup.py index 65d53c8a..3dfd4d51 100644 --- a/jcvi/utils/ez_setup.py +++ b/src/jcvi/utils/ez_setup.py @@ -101,7 +101,9 @@ def has_wget(): try: try: subprocess.check_call(cmd, stdout=devnull, stderr=devnull) - except FileNotFoundError: + except (FileNotFoundError, NotADirectoryError): + return False + except subprocess.CalledProcessError: return False finally: devnull.close() diff --git a/jcvi/utils/grouper.py b/src/jcvi/utils/grouper.py similarity index 100% rename from jcvi/utils/grouper.py rename to src/jcvi/utils/grouper.py diff --git a/jcvi/utils/orderedcollections.py b/src/jcvi/utils/orderedcollections.py similarity index 100% rename from jcvi/utils/orderedcollections.py rename to src/jcvi/utils/orderedcollections.py diff --git a/jcvi/utils/range.py b/src/jcvi/utils/range.py similarity index 100% rename from jcvi/utils/range.py rename to src/jcvi/utils/range.py diff --git a/jcvi/utils/table.py b/src/jcvi/utils/table.py similarity index 100% rename from jcvi/utils/table.py rename to src/jcvi/utils/table.py diff --git a/jcvi/utils/taxonomy.py b/src/jcvi/utils/taxonomy.py similarity index 100% rename from jcvi/utils/taxonomy.py rename to src/jcvi/utils/taxonomy.py diff --git a/jcvi/utils/validator.py b/src/jcvi/utils/validator.py similarity index 100% rename from jcvi/utils/validator.py rename to src/jcvi/utils/validator.py diff --git a/jcvi/utils/webcolors.py b/src/jcvi/utils/webcolors.py similarity index 100% rename from jcvi/utils/webcolors.py rename to src/jcvi/utils/webcolors.py diff --git a/jcvi/variation/__init__.py b/src/jcvi/variation/__init__.py similarity index 100% rename from jcvi/variation/__init__.py rename to src/jcvi/variation/__init__.py diff --git a/jcvi/variation/__main__.py b/src/jcvi/variation/__main__.py similarity index 100% rename from jcvi/variation/__main__.py rename to src/jcvi/variation/__main__.py diff --git a/jcvi/variation/cnv.py b/src/jcvi/variation/cnv.py similarity index 100% rename from jcvi/variation/cnv.py rename to src/jcvi/variation/cnv.py diff --git a/jcvi/variation/deconvolute.py b/src/jcvi/variation/deconvolute.py similarity index 100% rename from jcvi/variation/deconvolute.py rename to src/jcvi/variation/deconvolute.py diff --git a/jcvi/variation/delly.py b/src/jcvi/variation/delly.py similarity index 100% rename from jcvi/variation/delly.py rename to src/jcvi/variation/delly.py diff --git a/jcvi/variation/impute.py b/src/jcvi/variation/impute.py similarity index 100% rename from jcvi/variation/impute.py rename to src/jcvi/variation/impute.py diff --git a/jcvi/variation/phase.py b/src/jcvi/variation/phase.py similarity index 100% rename from jcvi/variation/phase.py rename to src/jcvi/variation/phase.py diff --git a/jcvi/variation/snp.py b/src/jcvi/variation/snp.py similarity index 100% rename from jcvi/variation/snp.py rename to src/jcvi/variation/snp.py diff --git a/jcvi/variation/str.py b/src/jcvi/variation/str.py similarity index 100% rename from jcvi/variation/str.py rename to src/jcvi/variation/str.py