Skip to main content

A simple bioinformatics package

Project description

pyoinformatics ๐Ÿ

CI/CD codecov image black PyPI

pip install pyoinformatics

Examples

Find the reverse complement of all the sequences in a file:

with open('out.fasta', 'w') as f:
  for seq in Bio.read_fasta('in.fasta'):
    f.writelines(seq.reverse_complement().to_fasta())

Count the number of occurrences of 'ATG' in seq1

seq1.count('ATG')

Count the number of occurrences of 'ATG' in seq1 that differ by <= 1 base.

seq1.count('ATG', 1)

Find the number of occurrences of 'ATG' or 'AAG' in seq1

len(seq1.find('A[AT]G'))

Find the average position of all occurrences of 'ATG' in a fasta file

from statistics import mean
for seq in Bio.read_fasta('in.fasta'):
  print(mean(seq.find('ATG')))

ASCI plot the relative nt counts for all the sequences in a file

for seq in Bio.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


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.0.3.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

pyoinformatics-0.0.3-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page