Skip to content

Commit

Permalink
Merge pull request #18 from CGATOxford/TS-RefactorTools
Browse files Browse the repository at this point in the history
Ts refactor tools
  • Loading branch information
TomSmithCGAT committed Apr 29, 2016
2 parents 968ee3b + 0a6450a commit 5db6d01
Show file tree
Hide file tree
Showing 15 changed files with 109,152 additions and 129 deletions.
29 changes: 29 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
language: python

python:
- "2.7"
# - "3.4"

script:
- cd $TRAVIS_BUILD_DIR ; pip install cython; python setup.py install

after_script:
- umi_tools --help
- umi_tools extract --help
- umi_tools dedup --help

# to do
#deploy:
# provider: pypi
# user: toms
# password:
# secure: my_secure_password
# on:
# tags: true
# branch: master


notifications:
email:
- thomas.smith2@dpag.ox.ac.uk
- i.sudbery@sheffield.ac.uk
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# extensions
include umi_tools/*.pyx
71 changes: 54 additions & 17 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,35 +1,72 @@
Tools for dealing with Unique Molecular Identifiers
====================================================

This repository contains a number of tools for dealing with Unique Molecular Identifiers (UMIs)/Random Molecular Tags (RMTs). Currently there are two tools::
This repository contains tools for dealing with Unique Molecular Identifiers (UMIs)/Random Molecular Tags (RMTs). Currently there are two tools:

extract_umi.py: Flexible removal of UMI sequences from fastq reads.
UMIs are removed and appended to the read name. Any other barcode, for example a
library barcode, is left on the read.
* extract: Flexible removal of UMI sequences from fastq reads.
UMIs are removed and appended to the read name. Any other barcode, for example a library barcode, is left on the read.

dedup_umi.py: Implements a number of different UMI deduplication schemes.
The recommended methods are `directional_adjecency` and `adjecency`. In general
`directional_adjecency` seems to be less sensitive to starting conditions, but there
are situations where `adjecency` might out perform.
* dedup: Implements a number of different UMI deduplication schemes.
The recommended method is `directional_adjecency`.

See simulation results at the `CGAT blog <https://cgatoxford.wordpress.com/2015/08/14/unique-molecular-identifiers-the-problem-the-solution-and-the-proof/>`_.

`Genome Science 2015 poster <http://f1000research.com/posters/4-728>`_.

Preprint on the way shortly...


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

Both tools are just python scripts. Type
If you're using Conda, you can use:

.. code:: bash
conda install -c https://conda.anaconda.org/toms umi_tools
Or pip:

.. code:: bash
pip install umi_tools
Or if you'd like to work directly from the git repository:

.. code:: bash
git clone git@github.com:CGATOxford/UMI-tools.git
Enter repository and run:

```
python dedup_umi.py --help
```
.. code:: bash
or
python setup.py install
```
python extract_umi.py --help
```
Help
-----

for help. `dedup_umi.py` is dependent on `numpy`, `pandas` and both are dependent, at the moment, on `CGAT <https://www.cgat.org/downloads/public/cgat/documentation/cgat.html#cgat>`_.
To get help on umi_tools run

.. code:: bash
`umi_tools --help`
To get help on umi_tools extract run

.. code:: bash
`umi_tools extract --help`
To get help on umi_tools dedup run

.. code:: bash
`umi_tools dedup --help`
Dependencies
------------
umi_tools is dependent on `numpy`, `pandas`, `cython`, `pysam` and `future`
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
setuptools>=1.1
cython>=0.19
numpy>=1.7
pandas>=0.12.0
pysam>=0.8.4
future
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.rst
111 changes: 111 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import sys
import os
import glob

try:
import Cython
except ImportError:
raise ImportError(
"UMI-tools requires cython to "
"be installed before running setup.py (pip install cython)")

try:
import pysam
except ImportError:
raise ImportError(
"UMI-tools requires pysam to "
"be installed before running setup.py (pip install pysam)")

########################################################################
########################################################################
# Import setuptools
# Use existing setuptools, otherwise try ez_setup.

try:
import setuptools
except ImportError:
raise ImportError(
"UMI-tools requires setuptools"
"be installed before running setup.py (pip install setuptools)")

from setuptools import setup, find_packages, Extension

from distutils.version import LooseVersion
if LooseVersion(setuptools.__version__) < LooseVersion('1.1'):
print ("Version detected:", LooseVersion(setuptools.__version__))
raise ImportError(
"UMI-tools requires setuptools 1.1 higher")

from Cython.Build import cythonize
########################################################################
########################################################################
# collect umi_tools version
sys.path.insert(0, "umi_tools")
import version

version = version.__version__

###############################################################
###############################################################
# Define dependencies
# Perform a umi_tools Installation

major, minor1, minor2, s, tmp = sys.version_info

if (major == 2 and minor1 < 7) or major < 2:
raise SystemExit("""UMI-tools requires Python 2.7 or later.""")

umi_tools_packages = ["umi_tools"]
umi_tools_package_dirs = {'umi_tools': 'umi_tools'}

install_requires = []

for requirement in (
l.strip() for l in open('requirements.txt') if not l.startswith("#")):
install_requires.append(requirement)


##########################################################
##########################################################
# Classifiers
classifiers = """
Development Status :: 3 - Alpha
Intended Audience :: Science/Research
Intended Audience :: Developers
License :: OSI Approved
Programming Language :: Python
Topic :: Software Development
Topic :: Scientific/Engineering
Operating System :: POSIX
Operating System :: Unix
Operating System :: MacOS
"""

setup(
# package information
name='umi_tools',
version=version,
description='umi-tools: Tools for UMI analyses',
author='Ian Sudbery',
author_email='i.sudbery@sheffield.ac.uk',
license="MIT",
platforms=["any"],
keywords="computational genomics",
long_description='umi-tools: Tools for UMI analyses',
classifiers=list(filter(None, classifiers.split("\n"))),
url="https://github.com/CGATOxford/UMI-tools",
download_url="https://github.com/CGATOxford/UMI-tools/tarball/%s" % version,
# package contents
packages=umi_tools_packages,
package_dir=umi_tools_package_dirs,
include_package_data=True,
# dependencies
install_requires=install_requires,
# extension modules
ext_modules=cythonize("umi_tools/_dedup_umi.pyx"),
entry_points={
'console_scripts': ['umi_tools = umi_tools.umi_tools:main']
},
# other options
zip_safe=False,
)
Loading

0 comments on commit 5db6d01

Please sign in to comment.