Giter Club home page Giter Club logo

mashing-pumpkins's Introduction

logo

mashing-pumpkins

Flexible-yet-pretty-fast minhashing-related library for Python >= 3.5.

Python package codecov Pypi release

The package is rather well documented with:

  • Sphinx documentation in doc/ (start with doc/index.rst)
  • Docstrings for most of the functions, classes, and methods
  • A showcase notebook in doc/notebooks (although this needs to be refreshed)
  • A demo command-line tool to build sketches in sourmash's JSON format (python -m mashingpumpkins.demo.cmdline --help) (although this is historical and need to be refreshed or deleted)

Why Minhash sketches ?

Bottom-sketches (Minhash sketches) are samples of the elements present in a set. They have been extensively used for text document matching or retrieval, which can extend to the context of genomics where strings are DNA or RNA sequences. There the set of k-mers present in a genome (called "k-shingles" in MinHash-related litterature), or in the reads from a sequencing assay, and they have been shown to be useful to measure similarity between genomes.

Why this implementation ?

The purpose of this implementation is to provide a library design that is combining flexibility and expressivity with performance (speed and memory usage).

Design

The design is allowing us to implement with a relatively short code base:

  • the use different hash functions (MurmurHash3, XXHash), and with user-specified seeds
  • Minhash and Maxhash sketches
  • "Count sketches"
  • Demonstrate quickly the comparative efficiency of alternative hashing strategies for double-stranded genomes (see - marbl/Mash#45 (comment))

Performance

The implementation also happens to be pretty fast, making it a reasonable option as a building block for minhash-related research and prototypes.

perf

perf

At the time of writing it is able to build a minhash sketch (k=31, size=1000) for a FASTQ file with ~21M reads (700MB when gzip-compressed) on a laptop[*] in under 1'30".

$ python -m mashingpumpkins.demo.cmdline --parser=fastqandfurious --ncpu=3 DRR065801.fastq.gz
Processing DRR065801.fastq.gz as a FASTQ file...
    20853697 records in 1m20s (9.43 MB/s)

(*: ASUS ultrabook, dual-core with hyperthreading, running Linux)

Installation

Python 3.5, 3.6, 3.7 and a C/C++ compiler (C99-aware) are pretty much everything that is needed. At the time of writing the CI on Travis is testing with gcc and clang on Linux and OSX.

With pip, installing either latest release or the "master" branch can be done with:

# latest release
pip install mashing-pumpkins

# master on github
pip install git+https://https://github.com/lgautier/mashing-pumpkins.git

The installation can be tested with:

python -m pytest --pyargs mashingpumpkins

# or:

python -m pytest --cov=mashingpumpkins ---cov-report term

mashing-pumpkins's People

Contributors

lgautier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mashing-pumpkins's Issues

Error pickling XXHash hashing function

>>> import mashingpumpkins._xxhash
>>> x = pickle.dumps(mashingpumpkins._xxhash.hasharray)
PicklingError: Can't pickle <built-in function hasharray>: import of module '_xxhash3' failed

Ensure it builds on OS X

I currently do not have dev environment on OS X for mashing-pumpkins.

Reports on whether it is building, or not building, would be greatly appreciated.

Add Dockerfile w/ command line

  • Assess whether the container for dnasnout-client can be a good base
  • Implement the derived container (if the above is working)
  • Writing instructions to use as an in-container command line
  • Put benchmark code in a gist

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.