A simple bioinformatics package
Project description
pyoinformatics ๐
pip install pyoinformatics
Examples
Find the reverse complement of all the sequences in a file:
import pyoinformatics as pyo
with open('out.fasta', 'w') as f:
for seq in pyo.read_fasta('in.fasta'):
f.writelines(seq.reverse_complement().to_fasta())
Count the number of occurrences of 'ATG' in seq object
seq.count('ATG')
Count the number of occurrences of 'ATG' in seq object that differ by <= 1 base.
seq.count('ATG', 1)
Find the average position of all occurrences of 'ATG' in a fasta file
from statistics import mean
for seq in pyo.read_fasta('in.fasta'):
print(mean(seq.find('ATG')))
Find the number of occurrences of 'ATG' or 'AAG' in seq object
len(seq1.find('A[AT]G'))
ASCI plot the relative nt counts for all the sequences in a file
for seq in pyo.read_fasta('in.fasta'):
counts = seq.counts
print(f">{seq.id}")
for nt in sorted(counts.keys()):
bar = int((counts[nt]/len(seq))*100)
print(f"{nt}: {'โ' * bar}")
>HSBGPG Human gene for bone gla protein (BGP)
A: โโโโโโโโโโโโโโโโโ
C: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
G: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
T: โโโโโโโโโโโโโโโโโโ
>HSGLTH1 Human theta 1-globin gene
A: โโโโโโโโโโโโโโ
C: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
G: โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
T: โโโโโโโโโโโโโโโ
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
pyoinformatics-0.1.7.tar.gz
(5.1 kB
view hashes)
Built Distribution
Close
Hashes for pyoinformatics-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f871b2b6f5f04e22101b3a31fccf85b9c35a526e630ed9a1762411e04715aa3 |
|
MD5 | 7683605e4bbce9e7b48d84008ba84ea7 |
|
BLAKE2b-256 | 2f6a53bd17d7d1061a04d78ddc7d229d2580903d51ddab48fdff1dc356829f76 |