Skip to main content

Mutational spectra analysis package

Project description

PyMutSpec

Python library for mutational spectra analysis

Requirements

  • python 3.8+

Installation

pip3 install pymutspec

https://pypi.org/project/PyMutSpec/

Example code

from Bio import SeqIO
from pymutspec.annotation import calculate_mutspec, CodonAnnotation
from pymutspec.draw import plot_mutspec12, plot_mutspec192

coda = CodonAnnotation(gencode=2) # mitochondrial genetic code

path_to_observed_mutations = ... 
path_to_reference_seq = ...

# load data (mutations and sequence)
gene = SeqIO.parse(path_to_reference_seq, format='fasta')
observed_mutations = pd.read_csv(path_to_observed_mutations, sep='\t')
for col in ['Mut', 'MutType']:
    assert col in observed_mutations.columns

# sample only syn mutations
mut_syn = observed_mutations[observed_mutations.MutType >= 1] # 0 for all mutations, 1 for syn, 2 for fourfold syn (syn4f)

# derive expected mutations from reference gene
sbs12_freqs, sbs192_freqs = coda.collect_exp_mut_freqs(gene, labels['all', 'syn', 'syn4f'])
sbs12_freqs_syn = sbs12_freqs['syn']
sbs192_freqs_syn = sbs192_freqs['syn']

# calculate mutation spectra
spectra12 = calculate_mutspec(mut_syn, sbs12_freqs_syn, use_context=False)
spectra192 = calculate_mutspec(mut_syn, sbs192_freqs_syn, use_context=True)

# plot mutation spectra
plot_mutspec12(spectra12)
plot_mutspec192(spectra192)

Spectra barplots

Links

  1. IQ-Tree2 - efficient software for phylogenomic inference
  2. Genetic codes

How to cite?

Bogdan Efimenko, Konstantin Popadin, Konstantin Gunbin, NeMu: a comprehensive pipeline for accurate reconstruction of neutral mutation spectra from evolutionary data, Nucleic Acids Research, Volume 52, Issue W1, 5 July 2024, Pages W108–W115, https://doi.org/10.1093/nar/gkae438

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

pymutspec-0.0.12.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

PyMutSpec-0.0.12-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file pymutspec-0.0.12.tar.gz.

File metadata

  • Download URL: pymutspec-0.0.12.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for pymutspec-0.0.12.tar.gz
Algorithm Hash digest
SHA256 45e04d8379a9d872fe389699ab428f02ed9102b1f723b3d395d9d1c977fadcdc
MD5 8fe990a5373a0f6a0b005ffbb3b1f552
BLAKE2b-256 4207823dfc7618297d4ed7e68522bed708483bb86fdbab34ee4e21d68c2e64d3

See more details on using hashes here.

File details

Details for the file PyMutSpec-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: PyMutSpec-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for PyMutSpec-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 9dd9a88e832f10ae45e214c516c40ce4a756c4f9e5cb901f854896be32d6dd14
MD5 144f234e8daf26ad52986921bb5bb864
BLAKE2b-256 ffe61efe7530bd1b256ab8822e1316e0be004137005fc3d739b7b893f1b58d54

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