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:

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


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.2.5.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

pyoinformatics-0.2.5-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file pyoinformatics-0.2.5.tar.gz.

File metadata

  • Download URL: pyoinformatics-0.2.5.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

File hashes

Hashes for pyoinformatics-0.2.5.tar.gz
Algorithm Hash digest
SHA256 292faffcce05f0d2d1a22042764b541c3ed9dbd0e20c1e384a4a455a7737160a
MD5 ed906221d7c60e3287feb91f4e156cf5
BLAKE2b-256 1a06e8578b81a80b27220ef0a2decd87abf7d2d74bf2f2aaee233d2b0c0d7470

See more details on using hashes here.

File details

Details for the file pyoinformatics-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: pyoinformatics-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

File hashes

Hashes for pyoinformatics-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f97e2aa727ff7b41590b8d7ddc0fc11e5deff6b179662b88206c586586330fa6
MD5 081262e2d894376f897e5dbd16987542
BLAKE2b-256 796b583d1d42c70b2c571feba865a6ef35800dd5ecc37cee9dd1209082775827

See more details on using hashes here.

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