Skip to main content

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: ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊

Metadata

Release files for pyoinformatics 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyoinformatics 0.2.5
File Size Uploaded Provenance
pyoinformatics-0.2.5.tar.gz 5.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyoinformatics 0.2.5
File Interpreter ABI Platform
pyoinformatics-0.2.5-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / pyoinformatics-0.2.5.tar.gz

Download URL pyoinformatics-0.2.5.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
292faffcce05f0d2d1a22042764b541c3ed9dbd0e20c1e384a4a455a7737160a
BLAKE2b-256 checksum
How to use checksums
1a06e8578b81a80b27220ef0a2decd87abf7d2d74bf2f2aaee233d2b0c0d7470
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / pyoinformatics-0.2.5-py3-none-any.whl

Download URL pyoinformatics-0.2.5-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f97e2aa727ff7b41590b8d7ddc0fc11e5deff6b179662b88206c586586330fa6
BLAKE2b-256 checksum
How to use checksums
796b583d1d42c70b2c571feba865a6ef35800dd5ecc37cee9dd1209082775827
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for pyoinformatics 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page