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_DIALECTfor GENCODE genome annotation;biofiles.dialects.refseq.REFSEQ_DIALECTfor RefSeq genome annotation;biofiles.dialects.stringtie.STRINGTIE_DIALECTfor StringTie output files.
License
MIT license, see License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file biofiles-0.1.7.tar.gz.
File metadata
- Download URL: biofiles-0.1.7.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f012bab86cc01dc8fc991d781e034552f9f2e328596b3910773ce3616ee7b5be
|
|
| MD5 |
4935988d9612074294e8cf10d2549ee1
|
|
| BLAKE2b-256 |
aeac497ec496f1e20ef1ead1f8ebedbe01bdf75e5bbcd40011c306bcbfc2481f
|
File details
Details for the file biofiles-0.1.7-py3-none-any.whl.
File metadata
- Download URL: biofiles-0.1.7-py3-none-any.whl
- Upload date:
- Size: 25.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fd8fb35c28b3b148f4ddc15adb691cef994610ab239211d239ac2915f077b48
|
|
| MD5 |
42d6f663f597063099e78a938b308e42
|
|
| BLAKE2b-256 |
f696a110d6488eef138d37eb4c6d6b8af590b348517c84c7f953ddc1b681b564
|