Skip to main content

Pure-Python, zero-dependency collection of bioinformatics-related file readers and writers

Project description

biofiles

Pure-Python, zero-dependency collection of bioinformatics-related file readers and writers.

Installation

python -m pip install biofiles

Usage

Reading FASTA files:

from biofiles.fasta import FASTAReader

with FASTAReader("sequences.fasta") as r:
    for seq in r:
        print(seq.id, len(seq.sequence))

# or

with open("sequences.fasta") as f:
    r = FASTAReader(f)
    for seq in r:
        print(seq.id, len(seq.sequence))

Writing FASTA files:

from biofiles.fasta import FASTAWriter
from biofiles.types.sequence import Sequence

seq = Sequence(id="SEQ", description="Important sequence", sequence="GAGAGA")

with FASTAWriter("output.fasta") as w:
    w.write(seq)

Reading GFF genome annotations:

from biofiles.gff import GFFReader
from biofiles.types.feature import Gene

with GFFReader("GCF_009914755.1_T2T-CHM13v2.0_genomic.gff") as r:
    for feature in r:
        if isinstance(feature, Gene):
            print(feature.name, len(feature.exons))

License

MIT license, see License.

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

biofiles-0.0.8.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

biofiles-0.0.8-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file biofiles-0.0.8.tar.gz.

File metadata

  • Download URL: biofiles-0.0.8.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for biofiles-0.0.8.tar.gz
Algorithm Hash digest
SHA256 cf46f07aa4d51a06e4e46630dce94d9d407e1322a43bc9b821421a5609faf466
MD5 f0fe38da8c84151b86a5f18bd3c2b4ee
BLAKE2b-256 a564dec4091153baa3c421177d450b0d741e920ac6d6b7d21882d54af2e6bf09

See more details on using hashes here.

File details

Details for the file biofiles-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: biofiles-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.9

File hashes

Hashes for biofiles-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 38a82f421238350a4bfdc9ee7ebd9f81d87cc191069b87e01849ae331151a10f
MD5 e4ce5b7cf0a190ca41ac6fdd0ab90381
BLAKE2b-256 5db14c5ad5255c8545d4e3a475ac5b211408e4a6a126a6b62fca95379303a165

See more details on using hashes here.

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