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


Release history Release notifications

Download files

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

Files for kcounter, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size kcounter-0.1.0-cp36-cp36m-macosx_10_7_x86_64.whl (140.3 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size kcounter-0.1.0-cp36-cp36m-manylinux1_x86_64.whl (710.5 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size kcounter-0.1.0-cp36-none-win_amd64.whl (101.5 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size kcounter-0.1.0-cp37-cp37m-macosx_10_7_x86_64.whl (140.2 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size kcounter-0.1.0-cp37-cp37m-manylinux1_x86_64.whl (710.4 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size kcounter-0.1.0-cp37-none-win_amd64.whl (101.2 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size kcounter-0.1.0-cp38-cp38-macosx_10_7_x86_64.whl (140.2 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size kcounter-0.1.0-cp38-cp38-manylinux1_x86_64.whl (710.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size kcounter-0.1.0-cp38-none-win_amd64.whl (101.2 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size kcounter-0.1.0.tar.gz (17.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page