Skip to main content

Read sequences in (compressed) FASTX files or from stdin

Project description

streamseqs

pytest-badge

streamseqs is a tiny package to quickly read in sequences from stdin or from (compressed) FAST(A/Q) files from disk.

It only performs barebones error checking and parsing and expects its input to be reasonably sane. If you need more sophisticated parsing and error checking, you are probably better of using Biopython.

Installation

pip install streamseqs

Usage

from streamseqs import stream_records

# Stream from file
for record in stream_records("seqs.fasta"):
    process(record)

# Records are dicts:
# {"id": "sequence header", "seq": "ATGCT", "qual": "HHHHH"}
# For FASTA files, "qual" is `None`.

# Gzip compressed files are transparently handled
for record in stream_records("seqs.fastq.gz"):
    process(record)

# Can stream from stdin. Expects a stream, not a TTY!
import sys
for record in stream_records(sys.stdin):
    process(record)

# Format record for writing - as FASTQ if "qual" is present, as FASTA if not.
from streamseqs import format_record
format_record(record)

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

streamseqs-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

streamseqs-0.1.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file streamseqs-0.1.0.tar.gz.

File metadata

  • Download URL: streamseqs-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for streamseqs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4437387ee73c4df8dbf83b93dc9ef77f1173329efc7e3dc31e71a6d0605e709a
MD5 845f81dc8db705f0444f59008b91d881
BLAKE2b-256 e4cc5ca77e9590af23c3f0f42e7895e9570048fa1a230c8f04862eaea77cc6af

See more details on using hashes here.

File details

Details for the file streamseqs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: streamseqs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for streamseqs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39a345e03621a025de63de2de6f945224a5b91fe88753797bbb5a8dbb143cdf8
MD5 2355a39fb029169d06deeebde52a7b63
BLAKE2b-256 42aaf65ea5ce11815d5c159ae540909f37cfb320a79905b2cd0e659d89828777

See more details on using hashes here.

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