Code Monkey home page Code Monkey logo

nucleic's Introduction

nucleic

Testing Status codecov Documentation Build Status PyPi Release Python Versions MyPy Checked Code style: black

Analysis and plotting library for base substitution spectra and signatures.

❯ pip install nucleic

Features:

  • Model DNA and variant alleles within their local context using an elegant API
  • Combine single nucleotide variants into spectrums of mutagenesis
  • Fetch COSMIC signatures of mutation, as well as other published signatures
  • SVG plotting functions for displaying single nucleotide variant spectrums

Read the documentation at: nucleic.readthedocs.io

from nucleic.cosmic import fetch_cosmic_signatures
from nucleic.plotting import trinucleotide_spectrum

signatures = fetch_cosmic_signatures()
canvas, (ax1, ax2) = trinucleotide_spectrum(signatures['Signature 24'])

signature-24

nucleic's People

Contributors

clintval avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nucleic's Issues

Make plots more customizable.

It would be useful to expose certain Canvas methods or more easily pass in cartesian parameters via plot_stratton_spectrum. For example, passing in a predefined ymin and ymax so that multiple stratton spectrums will be on the same scale.

`canvas.cartesian(ymin=0, ymax=.12)' results in the new scale being layered on top of the old scale. By example:
test.pdf

pip install fails

Not sure if this is a problem with pip or an issue with snv-spectrum.

Using pip install snv-spectrum gives the following error: "Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/mf/28775vz108sbnym4j9yd83w00000gn/T/pip-build-gypnrbfk/snv-spectrum/"

Looking at similar error codes suggests that it's due to an old version of setuptools, but I have 38.6.0 installed, so not likely the issue. Pip version 9.0.1.

Implement statistical tests for comparison of signatures between samples.

I'm running into situations in my work where I have two samples (say treatment and control) that seem like they have different trinucleotide signatures, but I want to rigorously show that to be the case. Some old literature suggests that a generalized form of Fischer's exact test may be the best way to proceed. I've attached the relevant literature to see if this is something you'd be interested in potentially implementing. I should point out that these papers, written in the 80's, make use of Monte Carlo approaches to approximating p-values. Given the large number of calculations needed to compute exact p-values, this approach is likely still valid. I also have some functional code, but it will need to be significantly cleaned up and better integrated into the Nucleic API.
agresti_wackerly_boyett.pdf
Adams&Skopek.pdf

Trinucleotide context heatmaps for multiple sample comparisons

Plot count or density heatmaps for a list of spectra with k=3 and identical reference_notation.

spectra

Figure 1A: Differences in mutation burden and spectra between carcinogen and genetic models1

1 Westcott et al. (2014) The mutational landscapes of genetic and chemical models of Kras-driven lung cancer

Clear exception needed when adding purine Snv to pyrimidine Spectrum and vice-versa

>>> spectrum = Spectrum(3, 'purine')
>>> spectrum[Snv(reference='T', alternate='C', context='TTA')]
"""
~/miniconda3/lib/python3.6/site-packages/snv_spectrum-0.3.0-py3.6.egg/snv_spectrum/_snv_spectrum.py in __getitem__(self, key)
    209 
    210     def __getitem__(self, key):
--> 211         return self._substitutions[key]
    212 
    213     def __setitem__(self, key, item):

KeyError: Snv(reference="T", alternate="C", context="TTA")
"""

The solution is:

# Thymine is not a purine, it is a pyrimidine
>>> spectrum = Spectrum(3, 'purine')
>>> spectrum[Snv(reference='T', alternate='C', context='TTA').with_purine_reference]

Issue found by @scottrk2.

setup.py fails

Python version: 3.6

Mes-MacBook-Air:snv-spectrum-master SRK$ python setup.py build
running build
running build_py
file snv_spectrum.py (for module snv_spectrum) not found
file snv_spectrum.py (for module snv_spectrum) not found

Option to report ref pyrimidine and purine triplets simultaneously

Some genomes exhibit very strong biases in their mutations between their reference and anti-reference bases. For example, human mitochondrial DNA shows a 4X higher mutation frequency for reference G->A mutations compared to reference C->T. It would be nice to either be able to plot out all 192 sequence contexts or, alternatively, have an option that converts to the same reference_notation via with_p[yrimidine, urine]_reference, but separately plot the spectra in a "reference" and "anti-reference" manner, as indicated in the attached figure.

Picture1.pdf

Local copy of published Spectrum data?

We provide a dynamic get_cosmic_signatures() helper function for pulling recent work from COSMIC.

Should we also support storage of signatures from other publications?

Would a JSON data store in a data/ folder be appropriate?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.