Skip to content

Commit

Permalink
Add README, improve setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
prihoda committed May 3, 2020
1 parent c988043 commit a6af1e1
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 172 deletions.
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2020 David Prihoda

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
# usearchmap
# USUM: Plotting sequence similarity using USEARCH & UMAP

USUM uses [USEARCH](https://drive5.com/usearch/) and [UMAP](https://github.com/lmcinnes/umap) to plot DNA 🧬and protein 🧶 sequence similarity embeddings.

![PyPI - Downloads](https://img.shields.io/pypi/dm/deepbgc.svg?color=green&label=PyPI%20downloads)
[![PyPI license](https://img.shields.io/pypi/l/deepbgc.svg)](https://pypi.python.org/pypi/deepbgc/)
[![PyPI version](https://badge.fury.io/py/deepbgc.svg)](https://badge.fury.io/py/deepbgc)

## Installation

Install `UCLUST` manually: https://drive5.com/usearch/download.html (consider supporting the author by buying the 64bit license)

Install `usum` using PIP:

```bash
pip install usum
```

## Usage

### Minimal example

```bash
usum sequences.fa --maxdist 0.2 --termdist 0.3 --output umap
```

### Multiple input files with labels

```bash
usum first.fa second.fa --labels First Second --maxdist 0.2 --termdist 0.3 --output umap
```

This will produce a PNG plot:

![UMAP static example](docs/example1.png?raw=true "UMAP static example")

An interactive [Bokeh](https://bokeh.org) HTML plot is also created:

![UMAP Bokeh example](docs/example2.png?raw=true "UMAP Bokeh example")

### Programmatic use

```python
from usum import usum

# Show help
help(usum)

# Run USUM
usum(inputs=['input.fa'], output='usum', maxdist=0.2, termdist=0.3)
```

## How it works

- A sparse distance matrix is calculated using USEARCH [calc_distmx](https://drive5.com/usearch/manual/cmd_calc_distmx.html) command.
- The distance matrix is embedded as `precomputed` metric using [UMAP](https://github.com/lmcinnes/umap)
- The embedding is plotted using [umap.plot](https://umap-learn.readthedocs.io/en/latest/plotting.html).
Binary file added docs/example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 24 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
from setuptools import setup
import os

about = {}
# Read version number from deepbgc.__version__.py (see PEP 396)
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'usum', '__version__.py'), encoding='utf-8') as f:
exec(f.read(), about)

# Read contents of readme file into string
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(
name='usearchmap',
packages=['usearchmap'],
name='usum',
packages=['usum'],
version=about['__version__'],
description='USUM: Plotting sequence similarity using USEARCH & UMAP',
long_description=long_description,
long_description_content_type='text/markdown',
author='David Příhoda',
author_email='[email protected]',
license='MIT',
python_requires=">=3.6",
keywords='dna, protein, sequence, similarity, umap, usearch, uclust, plot',
url='https://github.com/prihoda/usum',
install_requires=[
'biopython',
'umap-learn[plot]'
],
entry_points={
'console_scripts': ['usearchmap = usearchmap.main:main']
'console_scripts': ['usum = usum.main:main']
}
)

Empty file removed usearchmap/__init__.py
Empty file.
168 changes: 0 additions & 168 deletions usearchmap/main.py

This file was deleted.

2 changes: 2 additions & 0 deletions usum/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .__version__ import __version__
from .main import usum
1 change: 1 addition & 0 deletions usum/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '0.1.1'
Loading

0 comments on commit a6af1e1

Please sign in to comment.