Python library that parses GFF, Fasta files into python classes
Project description
# bioinfo_tools 0.2.1
## Installation
```bash
pip install bioinfo_tools
```
## Parsers
*HEADS UP!* These parsers are still under development and usage is not consistent from one parser to another.
### Fasta parser
```python
from bioinfo_tools.parsers.fasta import FastaParser
fasta_parser = FastaParser()
# by default, sequence IDs are separated by the firstly found '|' or ':'
for seqid, sequence in fasta_parser.read("/path/to/file.fasta"):
print(seqid, sequence)
# you may specify a specific separator for your sequence ID (e.g white space):
for seqid, sequence in fasta_parser.read("/path/to/file.fasta", id_separator=" "):
print(seqid, sequence)
```
### GFF parser
```python
from bioinfo_tools.parsers.gff import Gff3
gff_parser = Gff3()
with open("/path/to/file.gff") as fh:
for gene in gff_parser.read(fh):
print(gene)
import gzip
with gzip.open("/path/to/file.gz", "rb") as fh:
for gene in gff_parser.read(fh):
print(gene)
```
### OBO parser
```python
from bioinfo_tools.parsers.obo import OboParser
obo_parser = OboParser()
with open("/path/to/file.obo") as fh:
go_terms = obo_parser.read(fh)
for go_term in go_terms.values():
print(go_term)
# you may also get the GO term parents via the parser
parents = obo_parser.get_parents(go_term)
```
## Installation
```bash
pip install bioinfo_tools
```
## Parsers
*HEADS UP!* These parsers are still under development and usage is not consistent from one parser to another.
### Fasta parser
```python
from bioinfo_tools.parsers.fasta import FastaParser
fasta_parser = FastaParser()
# by default, sequence IDs are separated by the firstly found '|' or ':'
for seqid, sequence in fasta_parser.read("/path/to/file.fasta"):
print(seqid, sequence)
# you may specify a specific separator for your sequence ID (e.g white space):
for seqid, sequence in fasta_parser.read("/path/to/file.fasta", id_separator=" "):
print(seqid, sequence)
```
### GFF parser
```python
from bioinfo_tools.parsers.gff import Gff3
gff_parser = Gff3()
with open("/path/to/file.gff") as fh:
for gene in gff_parser.read(fh):
print(gene)
import gzip
with gzip.open("/path/to/file.gz", "rb") as fh:
for gene in gff_parser.read(fh):
print(gene)
```
### OBO parser
```python
from bioinfo_tools.parsers.obo import OboParser
obo_parser = OboParser()
with open("/path/to/file.obo") as fh:
go_terms = obo_parser.read(fh)
for go_term in go_terms.values():
print(go_term)
# you may also get the GO term parents via the parser
parents = obo_parser.get_parents(go_term)
```
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
bioinfo_tools-0.2.1.tar.gz
(10.2 kB
view details)
File details
Details for the file bioinfo_tools-0.2.1.tar.gz
.
File metadata
- Download URL: bioinfo_tools-0.2.1.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c84548061871470406530572ae6f79cb80f717a483a820ed6e6261c8af341bf4 |
|
MD5 | 65b8d7195dde5243b89a024bb1680ec5 |
|
BLAKE2b-256 | 30914df8b89bfcefabb46a7e9a715003c8de21e976046bc6ac180b8eb121c40c |