Skip to main content

Efficient manipulation of genomic sequences

Project description

PyPI-Server Unit tests

biostrings

Efficient manipulation of genomic sequences in Python, inspired by the design of Bioconductor's Biostrings package.

The core design relies on a "pool and ranges" memory model:

  • DNAStringSet stores all sequences in a single contiguous block of memory (the pool).
  • Individual sequences are defined by start and width coordinates (the ranges).
  • Slicing a DNAStringSet returns a view (a new set of ranges pointing to the same pool), making subsetting operations virtually instantaneous and memory-free, regardless of the data size.

Install

To get started, install the package from PyPI

pip install biostrings

Quick Start

Working with Single Sequences

The DNAString class represents a single DNA sequence. It enforces the IUPAC DNA alphabet and supports efficient byte-level operations.

from biostrings import DNAString

# Create a DNA string
dna = DnaString("TTGAAAA-CTC-N")
print(dna)
# Output: TTGAAAA-CTC-N

# Basic operations
print(len(dna))            # 13
print(dna[0:3])            # DnaString(length=3, sequence='TTG')

# Reverse Complement
# Handles IUPAC ambiguity codes correctly (e.g., N -> N, M -> K)
rc = dna.reverse_complement()
print(rc)
# Output: N-GAG-TTTTCAA

Working with Sets of Sequences

The DNAStringSet is the primary container for handling collections of sequences (e.g., reads from a FASTA file).

from biostrings import DNAStringSet

# Efficiently create a set from a list of strings
seqs = [
    "ACGT",
    "GATTACA",
    "TTGAAAA-CTC-N",
    "ACGTACGT"
]
dss = DNAStringSet(seqs, names=["s1", "s2", "s3", "s4"])

print(dss)
# Output:
# <DNAStringSet of length 4>
#   [ 1]   4 ACGT                 s1
#   [ 2]   7 GATTACA              s2
#   [ 3]  13 TTGAAAA-CTC-N        s3
#   [ 4]   8 ACGTACGT             s4

Note

This project has been set up using BiocSetup and PyScaffold.

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

biostrings-0.0.2.tar.gz (28.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

biostrings-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

biostrings-0.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (101.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

biostrings-0.0.2-cp313-cp313-macosx_11_0_arm64.whl (63.2 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

biostrings-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

biostrings-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (101.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

biostrings-0.0.2-cp312-cp312-macosx_11_0_arm64.whl (63.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

biostrings-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

biostrings-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (100.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

biostrings-0.0.2-cp311-cp311-macosx_11_0_arm64.whl (63.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

biostrings-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

biostrings-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (99.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

biostrings-0.0.2-cp310-cp310-macosx_11_0_arm64.whl (61.9 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

biostrings-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

biostrings-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (99.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

biostrings-0.0.2-cp39-cp39-macosx_11_0_arm64.whl (62.0 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file biostrings-0.0.2.tar.gz.

File metadata

  • Download URL: biostrings-0.0.2.tar.gz
  • Upload date:
  • Size: 28.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for biostrings-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fc81d17d164bf50a356c1a8cd072fa0c79dd0fde3a510e08765ff1fa9e7b8573
MD5 f2d090eb22a5f2db4a61d40722ac3544
BLAKE2b-256 4468eabe5780e119f0ee0314680a440c8c52d1c6a4f2ab01630ea1acf7494b4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2.tar.gz:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 fe7e61a5aa05a9bcde0ca49a64e9b17f0af39e121f5918b6defaed3fb05c438e
MD5 451180fce367ca629e1c1b932942cc31
BLAKE2b-256 4c0c81d5336401f3462cab208d06a546f43f155860a546d1fb65794d52e96029

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1fe3dae0968cec54a453d7b1ec5b15c8b79e38b0e3757b4e960d6596543a6bdc
MD5 44eb04dc06ecc4a8ac5b89850c7c7e2d
BLAKE2b-256 2f4db07f13e08996c817342f8606f4bdfb87900eca62613c737c609f994ff584

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9b8bc506babaabbbe7bbca979ebdce89684651bd5d0bbf6795c5e5fbb3ed237e
MD5 f9bca9b2863c505cc58dd204e23c2d6a
BLAKE2b-256 1ff3a4890df00e8f893c75394f34978516e2e1e4835438cb67709030df70cde1

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 18a484c9f7fe82715472046c063515bd0360224f26478066bb42d4e92f1976bc
MD5 6b929e3916462d450bafc0298f480eb4
BLAKE2b-256 2b82cd66ccb53d253784fd0a52e90980ad7031dfb0d14ca9807639cf2ad075f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 94aa7f3a6afef1dbdf41d856df4b7a4f7816f603e9e3d58d62cf84749d4175d9
MD5 3cccd46c2be30022462833616b644694
BLAKE2b-256 7e40baa9a064fe9d4f25dede4e7265d3cc59b360c94849cbf3bd5a01c76cc510

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dbe4137274581f1ca0fb87b41521e8b7e17f6a833d5e927aa149938aacecbbe4
MD5 a59c918002892aec46b57dbd725542d5
BLAKE2b-256 d270ad1a50885ccf1eb042065aae2d9e327143e8461e77bc91be0d0df9dcd31e

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 43e4806097a53027997e6e00d369fe37b8fc3e15c34a20734d7015ebab53335b
MD5 a005be3ccd2c10e15de9eaf72bf5aa84
BLAKE2b-256 dfe0c93f903b5015ce52119e4f976f8f2bc245bce52a81a3e7f9b02e31ec1e1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0dd5defbbe0926e6092d4192fe3912ace1e160f2d2d1c98f0fcb1e1ba85205a8
MD5 0d0714732562edd07daca5da01c07571
BLAKE2b-256 44f481b0a5f010837bc2597e0998c092987d85f02aeb978df72a634a920278ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0b298b8d7b4fd66094b0c6ee10661e168a9b918c2ee6bf3e790f7de4e085f6da
MD5 6d04baafbc27faacecbb83f666153e37
BLAKE2b-256 dc12d2a953916a45a9b23564690de39799b641accb1d72b88299036cd625cd58

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4e5d82dac4a0aabe353452972ea5a00ac5eb35ad2bf01a27c6b70a1854602d01
MD5 f911738f31367f0faf8c944ee93db48c
BLAKE2b-256 237991a006fd1c08d22cfc9bae691cd783373880ebf1d1bfbc33202009f338aa

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4e5594d48fbb70abe6a73fdb321a695c3c8475d167781eb1aafed107e60be382
MD5 66a547a73b7e0ace775537f6aefa3f29
BLAKE2b-256 5dfedbf37524576edc2b0979d1f55f1f15d7b8161eb7036b16552898ceb85a58

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b8350ca38b746b54d59ab572cf7bec9a176a582fe40a4d8efb8244a1f0725816
MD5 1b64b8dfaef077a6a0811b65a1fc8f8c
BLAKE2b-256 af01d71b90478e4f16df65e82cb47f0aebcd4003ed5e385576f1e2d40cbaa7e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 e17c33771acdf527784e81c294d0ddda9ee02f84c29050aefdac4312730ffcfc
MD5 8627e338a7ee321ca20cdd8037baa19f
BLAKE2b-256 26c131ba563a73f225407ffb8341a8e3e20dd3cddd5120829bd2717bd3a158d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp39-cp39-musllinux_1_2_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8328b4eba30dce0c872301e1927fc37670340822dc1c03430c7c55b4ee59f927
MD5 3c70a58cf87cbe4b1e0b15ba599087a3
BLAKE2b-256 a412f7adb6c1500d7cd2d406000996319f693fc2d9258484291ee2d4d7addce9

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file biostrings-0.0.2-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for biostrings-0.0.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 acae24137c65efe71c57152c52f5161dbbe3dfda3937d1351c4d9b97413fc8c0
MD5 9d08ca4d08e69437487e25184b1b92c9
BLAKE2b-256 a5c645aad698eb90d3d5e15ade2db06f47556bf0a5a36005bd98d486e240800f

See more details on using hashes here.

Provenance

The following attestation bundles were made for biostrings-0.0.2-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on BiocPy/biostrings

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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