FASTA file reader/writer
Project description
fasta-reader-py
FASTA file reader/writer.
Examples
Open a file and loop over its contents.
from fasta_reader import read_fasta
for item in read_fasta("fasta_reader/test/correct1.faa"):
print(item)
# FASTAItem(defline='ID1', sequence='GAGUUA')
# FASTAItem(defline='ID2', sequence='CAUAACAAATT')
# FASTAItem(defline='ID3', sequence='AAGAA')
# FASTAItem(defline='ID4', sequence='AAGAA')
Open a compressed file and show the first item.
from fasta_reader import read_fasta
with read_fasta("fasta_reader/test/protein.faa.gz") as file:
item = file.read_item()
print(item.defline, item.sequence[:10] + "...")
# P01013 GENE X PROTEIN (OVALBUMIN-RELATED) QIKDLLVSSS...
Write to output.faa.gz
.
from fasta_reader import write_fasta
with write_fasta("output.faa.gz") as file:
file.write_item("id1 gene x protein", "AGUTAGA")
file.write_item("id2 gene x protein", "TUUA")
Install
pip install fasta-reader
Author
License
This project is licensed under the MIT 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
fasta_reader-1.0.1.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for fasta_reader-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de1ceb12910151801ca422eaa9e61e8127ef6ca593a8b8e53a10b0b8fa31fd14 |
|
MD5 | 488a1fc0566d42c408d070e781626f89 |
|
BLAKE2b-256 | 27baa30ce9ce898e0ccd6c705bc367f758003f52de7c4273157d17ebc529e440 |