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.dialects.gencode import GENCODE_DIALECT
from biofiles.dialects.genomic_base import Gene

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

Currently three dialects are supported:

  • biofiles.dialects.gencode.GENCODE_DIALECT for GENCODE genome annotation;
  • biofiles.dialects.refseq.REFSEQ_DIALECT for RefSeq genome annotation;
  • biofiles.dialects.stringtie.STRINGTIE_DIALECT for StringTie output files.

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.1.6.tar.gz (19.7 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.1.6-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for biofiles-0.1.6.tar.gz
Algorithm Hash digest
SHA256 c0c1a6719588cf5794f625db5dcc18d4a766cb63bf8e3efd3a6258fb7f5af620
MD5 0bbd982bf4e41732a2315ae0fe583d64
BLAKE2b-256 f5389836563293b728125f7f9c7af9d2ee0092cdaaf5a84804a90daad7ba4055

See more details on using hashes here.

File details

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

File metadata

  • Download URL: biofiles-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 25.1 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.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5512079350c3ecc5121ea4775a7af2830e152ce62bd7b609a35b4ca5e83fbf75
MD5 167602ed1a7200f02c55e5bc1a6a0b07
BLAKE2b-256 da2c34eb15be3fbd44d6b6869c9d5a7573993c415a2dceb8fdd3f2c45ab86525

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