Skip to main content

CuCounter: A Python kmer frequency counter object based on a massively parallel CUDA hash table

Installation

CuCounter requires NumPy and CuPy. It also currently only supports Nvidia GPUs with CUDA.

Cucounter can be installed using pip:

pip install kage-cucounter

.. or via manual installation:

  • clone the CuCounter repository
  • use pip to install all necessary dependencies as well as CuCounter from inside the cloned repository
git clone https://github.com/jorgenwh/cucounter.git
cd cucounter
pip install -r requirements.txt
pip install .

Usage

All of CuCounter's methods (including its constructor) will accept either NumPy or CuPy arrays. CuPy arrays are preferred as it circumvents having to copy memory back and fourth between the host and device. NumPy is used in the example below, but the same code would work if NumPy had been replaced with CuPy.

from cucounter import Counter
import numpy as np

# Create a static set of 100 million unique 64-bit encoded kmers as keys for the counter
unique_kmers = np.arange(100000000, dtype=np.uint64)

# Create counter object
counter = Counter(keys=unique_kmers)

# Create a chunk of 200 million kmers to count
kmers = np.random.randint(low=0, high=0xFFFFFFFFFFFFFFFF, size=(200000000,), dtype=np.uint64)

# Count the observed kmer frequencies. Kmers not present in the original key set are ignored
counter.count(kmers)

# Fetch the observed frequencies for the original key set
counts = counter[unique_kmers] 

counts.dtype # np.uint32
counts.shape # (100000000,)

CuCounter also supports counting the reverse complements of kmers aswell as the original kmer.

counter.count(kmers, count_revcomps=True)

Metadata

Release files for kage-cucounter 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kage-cucounter 1.0.1
File Size Uploaded Provenance Actions
kage-cucounter-1.0.1.tar.gz 9.7 kB Without provenance Details for kage-cucounter-1.0.1.tar.gz

Release files / kage-cucounter-1.0.1.tar.gz

Download URL kage-cucounter-1.0.1.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dfb717d07fe4bf66f0abd2252243d97cf9022177d6beb1cc862e90dc77342a1e
BLAKE2b-256 checksum
How to use checksums
03a7358922745d731df354f31cd32bbb6c18c980efe5590e0bedd5a84ca35fff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.8.3 requests/2.28.1 setuptools/63.2.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.10.8

Security for kage-cucounter 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page