Unverified Commit 591b3e30 authored by Jeroen F.J. Laros's avatar Jeroen F.J. Laros
Browse files

Package rename.

parent d60c01b3
*.egg-info
*.pyc *.pyc
.cache/ .cache/
.tox/ .tox/
build/ build/
dist/ dist/
docs/Makefile
docs/_build/
examples/.ipynb_checkpoints/ examples/.ipynb_checkpoints/
mutalyzer_backtranslate.egg-info
...@@ -5,14 +5,14 @@ Back translation ...@@ -5,14 +5,14 @@ Back translation
:target: https://github.com/mutalyzer/backtranslate/graphs/commit-activity :target: https://github.com/mutalyzer/backtranslate/graphs/commit-activity
.. image:: https://travis-ci.org/mutalyzer/backtranslate.svg?branch=master .. image:: https://travis-ci.org/mutalyzer/backtranslate.svg?branch=master
:target: https://travis-ci.org/mutalyzer/backtranslate :target: https://travis-ci.org/mutalyzer/backtranslate
.. image:: https://readthedocs.org/projects/simplerpc/badge/?version=latest .. image:: https://readthedocs.org/projects/mutalyzer-backtranslate/badge/?version=latest
:target: https://backtranslate.readthedocs.io/en/latest :target: https://mutalyzer-backtranslate.readthedocs.io/en/latest
.. image:: https://img.shields.io/github/release-date/mutalyzer/backtranslate.svg .. image:: https://img.shields.io/github/release-date/mutalyzer/backtranslate.svg
:target: https://github.com/mutalyzer/backtranslate/releases :target: https://github.com/mutalyzer/backtranslate/releases
.. image:: https://img.shields.io/github/release/mutalyzer/backtranslate.svg .. image:: https://img.shields.io/github/release/mutalyzer/backtranslate.svg
:target: https://github.com/mutalyzer/backtranslate/releases :target: https://github.com/mutalyzer/backtranslate/releases
.. image:: https://img.shields.io/pypi/v/backtranslate.svg .. image:: https://img.shields.io/pypi/v/mutalyzer-backtranslate.svg
:target: https://pypi.org/project/backtranslate/ :target: https://pypi.org/project/mutalyzer-backtranslate/
.. image:: https://img.shields.io/github/languages/code-size/mutalyzer/backtranslate.svg .. image:: https://img.shields.io/github/languages/code-size/mutalyzer/backtranslate.svg
:target: https://github.com/mutalyzer/backtranslate :target: https://github.com/mutalyzer/backtranslate
.. image:: https://img.shields.io/github/languages/count/mutalyzer/backtranslate.svg .. image:: https://img.shields.io/github/languages/count/mutalyzer/backtranslate.svg
...@@ -30,4 +30,4 @@ nucleotides. ...@@ -30,4 +30,4 @@ nucleotides.
Please see ReadTheDocs_ for the latest documentation. Please see ReadTheDocs_ for the latest documentation.
.. _ReadTheDocs: https://backtranslate.readthedocs.io .. _ReadTheDocs: https://mutalyzer-backtranslate.readthedocs.io
API documentation
=================
Main library
------------
.. automodule:: mutalyzer_backtranslate.backtranslate
:members:
Utils
-----
.. automodule:: mutalyzer_backtranslate.util
:members:
import os
import subprocess
import sys
subprocess.call('pip install ..', shell=True)
from mutalyzer_backtranslate import _get_metadata
author = _get_metadata('Author')
copyright = _get_metadata('Author')
project = _get_metadata('Name')
release = _get_metadata('Version')
autoclass_content = 'both'
extensions = ['sphinx.ext.autodoc']
master_doc = 'index'
...@@ -8,4 +8,5 @@ ...@@ -8,4 +8,5 @@
install install
usage usage
library library
api
credits credits
...@@ -5,7 +5,7 @@ The software is distributed via PyPI_, it can be installed with ``pip``: ...@@ -5,7 +5,7 @@ The software is distributed via PyPI_, it can be installed with ``pip``:
:: ::
pip install backtranslate pip install mutalyzer-backtranslate
From source From source
...@@ -21,5 +21,5 @@ the following commands. ...@@ -21,5 +21,5 @@ the following commands.
pip install . pip install .
.. _PyPI: https://pypi.org/project/backtranslate/ .. _PyPI: https://pypi.org/project/mutalyzer-backtranslate/
.. _GitHub: https://github.com/mutalyzer/backtranslate .. _GitHub: https://github.com/mutalyzer/backtranslate
...@@ -6,7 +6,7 @@ nucleotides. ...@@ -6,7 +6,7 @@ nucleotides.
.. code:: python .. code:: python
>>> from backtranslate import BackTranslate >>> from mutalyzer_backtranslate import BackTranslate
>>> >>>
>>> # Create a class instance, optionally giving the translation table id. >>> # Create a class instance, optionally giving the translation table id.
>>> bt = BackTranslate() >>> bt = BackTranslate()
...@@ -41,7 +41,7 @@ To get substitutions in a readable format, we can use the following: ...@@ -41,7 +41,7 @@ To get substitutions in a readable format, we can use the following:
.. code:: python .. code:: python
>>> from backtranslate.util import subst_to_cds >>> from mutalyzer_backtranslate.util import subst_to_cds
>>> >>>
>>> substitutions = bt.without_dna('W', '*') >>> substitutions = bt.without_dna('W', '*')
>>> >>>
......
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
# Back translation # Back translation
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
%pylab inline %pylab inline
``` ```
%% Output %% Output
Populating the interactive namespace from numpy and matplotlib Populating the interactive namespace from numpy and matplotlib
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
from collections import defaultdict from collections import defaultdict
from backtranslate import BackTranslate from mutalyzer_backtranslate import BackTranslate
from backtranslate.util import protein_letters from mutalyzer_backtranslate.util import protein_letters
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Create a reverse translation class instance. Create a reverse translation class instance.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
bt = BackTranslate() bt = BackTranslate()
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
For each pair of amino acids, calculate the number of one-nucleotide substitutions that transform one amino acid into the other. For each pair of amino acids, calculate the number of one-nucleotide substitutions that transform one amino acid into the other.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
table = [] table = []
for i in protein_letters: for i in protein_letters:
table.append([]) table.append([])
for j in protein_letters: for j in protein_letters:
s = bt.without_dna(i, j) s = bt.without_dna(i, j)
table[-1].append(int(sum(list(map(len, s.values()))))) table[-1].append(int(sum(list(map(len, s.values())))))
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise the resutling matrix. Visualise the resutling matrix.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
imshow(table, interpolation='nearest') imshow(table, interpolation='nearest')
xticks(range(21), protein_letters) xticks(range(21), protein_letters)
yticks(range(21), protein_letters) yticks(range(21), protein_letters)
set_cmap('cool') set_cmap('cool')
colorbar(); colorbar();
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise the distribution of values in the matrix. Visualise the distribution of values in the matrix.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
d = defaultdict(int) d = defaultdict(int)
for row in table: for row in table:
for element in row: for element in row:
d[element] += 1 d[element] += 1
ind = sorted(d.keys()) ind = sorted(d.keys())
values = [] values = []
for i in ind: for i in ind:
values.append(d[i]) values.append(d[i])
bar(ind, values); bar(ind, values);
``` ```
%% Output %% Output
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Print some summaries. Print some summaries.
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
total = 21 ** 2 total = 21 ** 2
total_p = total / 100 total_p = total / 100
imperfect = sum(values[2:]) imperfect = sum(values[2:])
print('\n{} substitutions in total.'.format(total)) print('\n{} substitutions in total.'.format(total))
print('{:3} impossible substitutions ({:.2f}%).'.format(values[0], values[0] / total_p)) print('{:3} impossible substitutions ({:.2f}%).'.format(values[0], values[0] / total_p))
print('{:3} perfect substitutions ({:.2f}%).'.format(values[1], values[1] / total_p)) print('{:3} perfect substitutions ({:.2f}%).'.format(values[1], values[1] / total_p))
print('{:3} imperfect substitutions ({:.2f}%).'.format(imperfect, imperfect / total_p)) print('{:3} imperfect substitutions ({:.2f}%).'.format(imperfect, imperfect / total_p))
possible = sum(values[1:]) possible = sum(values[1:])
possible_p = possible / 100 possible_p = possible / 100
print('\n{:3} possible substitutions, of which {:.2f}% is perfect and {:.2f}% is imperfect.'.format( print('\n{:3} possible substitutions, of which {:.2f}% is perfect and {:.2f}% is imperfect.'.format(
possible, values[1] / possible_p, imperfect / possible_p)) possible, values[1] / possible_p, imperfect / possible_p))
``` ```
%% Output %% Output
441 substitutions in total. 441 substitutions in total.
252 impossible substitutions (57.14%). 252 impossible substitutions (57.14%).
130 perfect substitutions (29.48%). 130 perfect substitutions (29.48%).
59 imperfect substitutions (13.38%). 59 imperfect substitutions (13.38%).
189 possible substitutions, of which 68.78% is perfect and 31.22% is imperfect. 189 possible substitutions, of which 68.78% is perfect and 31.22% is imperfect.
......
...@@ -43,8 +43,7 @@ def reverse_translation_table(table_id=1): ...@@ -43,8 +43,7 @@ def reverse_translation_table(table_id=1):
class BackTranslate(object): class BackTranslate(object):
"""Back translation.""" """Back translation."""
def __init__(self, table_id=1): def __init__(self, table_id=1):
"""Initialise the class. """
:arg int table_id: Translation table id. :arg int table_id: Translation table id.
""" """
self._back_table = reverse_translation_table(table_id) self._back_table = reverse_translation_table(table_id)
......
[metadata] [metadata]
name = backtranslate name = mutalyzer_backtranslate
version = 0.1.2 version = 0.1.3
description = Functions for reverse translation. description = Functions for reverse translation.
long_description = file: README.rst long_description = file: README.rst
author = LUMC, Jeroen F.J. Laros author = LUMC, Jeroen F.J. Laros
...@@ -28,4 +28,4 @@ tests_require = ...@@ -28,4 +28,4 @@ tests_require =
[options.entry_points] [options.entry_points]
console_scripts = console_scripts =
backtranslate = backtranslate.cli:main backtranslate = mutalyzer_backtranslate.cli:main
"""Tests for the backtranslate.backtranslate module.""" """Tests for the backtranslate module."""
from backtranslate.backtranslate import BackTranslate, cmp_subst from mutalyzer_backtranslate.backtranslate import BackTranslate, cmp_subst
class TestParser(object): class TestParser(object):
......
...@@ -6,7 +6,7 @@ from io import StringIO ...@@ -6,7 +6,7 @@ from io import StringIO
from fake_open import md5_check from fake_open import md5_check
from backtranslate import cli from mutalyzer_backtranslate import cli
class TestParser(object): class TestParser(object):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment