Skip to main content

No project description provided

Project description

kcounter

PyPI GitHub Workflow Status

A simple package for counting DNA k-mers in Python. Written in Rust.

Instalation

There are two ways to install kcounter:

  • Using pip:
pip install kcounter
  • Using conda:
conda install -c bioconda kcounter

Usage

Currently, kcounter provides a single function, count_kmers, that returns a dictionary containing the k-mers of the chosen size.

>>> import kcounter
>>> kcounter.count_kmers('AAACTTTTTT', 3)
{'AAA': 1.0, 'ACT': 1.0, 'AAC': 1.0, 'CTT': 1.0, 'TTT': 4.0}
>>> kcounter.count_kmers('AAACTTTTTT', 4)
{'AACT': 1.0, 'CTTT': 1.0, 'ACTT': 1.0, 'AAAC': 1.0, 'TTTT': 3.0}

The relative_frequencies parameter can be used to obtain relative k-mer frequencies:

>>> kcounter.count_kmers('AAACTTTTTT', 3, relative_frequencies=True)
{'AAC': 0.125, 'TTT': 0.5, 'CTT': 0.125, 'ACT': 0.125, 'AAA': 0.125}

The canonical_kmers parameters aggregates the counts of reverse-complement k-mers (eg.: AGC/GCT):

>>> kcounter.count_kmers('AAACTTTTTT', 3, canonical_kmers=True)
{'ACT': 1.0, 'AAA': 5.0, 'AAC': 1.0, 'AAG': 1.0}

Plans for future versions:

  • Performance improvements.
  • Add an parameter that makes the function return a sparse k-mer counts.
  • Implement a function that returns a numpy array.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kcounter-0.1.0.tar.gz (17.4 kB view hashes)

Uploaded Source

Built Distributions

kcounter-0.1.0-cp38-none-win_amd64.whl (101.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

kcounter-0.1.0-cp38-cp38-manylinux1_x86_64.whl (710.3 kB view hashes)

Uploaded CPython 3.8

kcounter-0.1.0-cp38-cp38-macosx_10_7_x86_64.whl (140.2 kB view hashes)

Uploaded CPython 3.8 macOS 10.7+ x86-64

kcounter-0.1.0-cp37-none-win_amd64.whl (101.2 kB view hashes)

Uploaded CPython 3.7 Windows x86-64

kcounter-0.1.0-cp37-cp37m-manylinux1_x86_64.whl (710.4 kB view hashes)

Uploaded CPython 3.7m

kcounter-0.1.0-cp37-cp37m-macosx_10_7_x86_64.whl (140.2 kB view hashes)

Uploaded CPython 3.7m macOS 10.7+ x86-64

kcounter-0.1.0-cp36-none-win_amd64.whl (101.5 kB view hashes)

Uploaded CPython 3.6 Windows x86-64

kcounter-0.1.0-cp36-cp36m-manylinux1_x86_64.whl (710.5 kB view hashes)

Uploaded CPython 3.6m

kcounter-0.1.0-cp36-cp36m-macosx_10_7_x86_64.whl (140.3 kB view hashes)

Uploaded CPython 3.6m macOS 10.7+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page