Commit 645d598f authored by Jeroen F.J. Laros's avatar Jeroen F.J. Laros
Browse files

Documentation, implemented improvable substitution detection.

parent 802cbc89
......@@ -3,12 +3,34 @@ This library provides functions for back translation from amino acids to
nucleotides.
from backtranslate.backtranslate import (
reverse_translation_table, one_subst, subst_to_var)
reverse_translation_table, one_subst)
# First create the reverse translation table for the organism of interest.
back_table = reverse_translation_table(1)
# Find all substitutions that transform the codon 'TTG' into a stop codon.
substitutions = one_subst(back_table, 'TGG', '*')
Sometimes we do not have access to the DNA sequence so we have to find
possible substitutions from the amino acids directly.
from backtranslate.backtranslate import (
reverse_translation_table, one_subst_without_dna)
# Find all substitutions that transform a Tryptophan into a stop codon.
substitutions = one_subst_without_dna(back_table, 'W', '*')
To find out which substitution predictions can be improved by adding codon
information, use the following function.
from backtranslate.backtranslate import improvable_substitutions
improvable_substitutions(back_table)
To get substitutions in a readable format, we can use the following:
from backtranslate.backtranslate import subst_to_var
# Transform the substitutions to HGVS.
variants = subst_to_var('TGG', substitutions, 12)
# Print the variants in human readable format.
......
......@@ -17,6 +17,19 @@ def _three_to_one():
return protein_letters_3to1
def _compare_dict(d1, d2):
"""
"""
if len(d1) != len(d2):
return False
for item in d1:
if d1[item] != d2[item]:
return False
return True
def reverse_translation_table(table_id=1):
"""
Calculate a reverse translation table.
......@@ -108,4 +121,31 @@ def subst_to_var(reference_codon, substitutions, offset=0):
return variants
def improvable_substitutions(back_table):
"""
Calculate all pairs of amino acid substututions that can be improved by
looking at the underlying codon.
:arg dict back_table: Reverse translation table.
:returns list: List of improvable substitutions.
"""
substitutions = set()
for reference_amino_acid in back_table:
for sample_amino_acid in back_table:
substitutions_without_dna = one_subst_without_dna(
back_table, reference_amino_acid, sample_amino_acid)
for codon in back_table[reference_amino_acid]:
substitutions_with_dna = one_subst(
back_table, codon, sample_amino_acid)
if (substitutions_with_dna and not _compare_dict(
substitutions_without_dna, substitutions_with_dna) and
reference_amino_acid != sample_amino_acid):
substitutions.add(
(reference_amino_acid, sample_amino_acid))
return substitutions
protein_letters_3to1 = _three_to_one()
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"%pylab inline"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
}
],
"prompt_number": 17
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from backtranslate.backtranslate import *"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 18
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"back_table = reverse_translation_table(1)"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 43
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"table = []\n",
"\n",
"for i in back_table:\n",
" table.append([])\n",
" for j in back_table:\n",
" s = one_subst_without_dna(back_table, i, j)\n",
" table[-1].append(int(sum(map(len, s.values()))))\n",
"\n",
"for i in table:\n",
" print i"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"[4, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0]\n",
"[0, 2, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 2, 1, 0, 1, 0, 1]\n",
"[1, 0, 2, 2, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n",
"[1, 0, 2, 2, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1]\n",
"[1, 1, 1, 1, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, 1, 1, 0]\n",
"[0, 1, 0, 0, 0, 2, 1, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 1]\n",
"[0, 0, 0, 0, 0, 1, 3, 0, 1, 0, 1, 2, 1, 0,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ow(table, interpolation='nearest', shape=(500, 500))\n",
"xticks(range(21), back_table.keys())\n",
"yticks(arange(21), back_table.keys());"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD7CAYAAABDsImYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHElJREFUeJzt3XtQlNfdB/DvAqKIxKCS1htZDGISFnTRqqBRQlJjYtSq\nryg4ES8j4xicimgmb+hbsJNbhXgr0xoTrU7iLCoZoSNqrAreYOTVMBWpKUaDIqkWcSxFLhF83j98\n2XDZXZ6zPIdl3e9nZmd2H86e57eXH8/tt+foFEVRQERPNDdHB0BE8jHRiVwAE53IBTDRiVwAE53I\nBTDRiVyAh9Yd6nQ6rbskIgGWrpgLJ3p2djbmzp2LK1euYNSoUZZXVNlxWeonQGpS22W6oSkWnp0P\nILLtoudTLQdTlQr4WfmbvW2ttfvW0nPz0SFWq9S2dZY+u3n9lr4D3fmZtl+/rXV36NdKnyL9qu5z\ng8XVCO+6m0wmvPnmmzCZTKJPJSIHEUr02tpanD9/HhkZGdi3b5+smIhIY0KJnpOTg+nTp8Pf3x9+\nfn745ptvVD83MlxtS736gPpGat9WpE+RWFW3dZY+e8D6HfmZyvqeqO5XoE8IHqObTCYkJiYCAObP\nnw+TyYSwsLAO7VI/+el+ZDgQGfH4po5efUDekdq3FenTaZJCRp89YP2O/ExlfU9U99vSZ/n/32xT\nnej37t1DXl4eLl++DJ1Oh+bmZuh0OqSlpXVo2/6kGxHJokfbfySnLLZSveuelZWFxYsXo7y8HN9/\n/z1u3ryJgIAAnDlzpkthEpF8qhM9MzMTc+bMabNs3rx5yMzM1DwoItKW6l33kydPdli2evVqTYMh\nIjl0Wg888bgyzlIhjAWXU9W1M6hsJ8paIU5XWCzC6EYir8nRscqi9nv1XwJ9irxXMj4DtX1+q7NY\nGSdcMHP79m0sXLgQgYGBGDduHGbMmIGrV6+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CVLlli9bCd6qNFZ+/Z/1+l0Vp/TstzX1xdHjx7F+++/j0OHDgnF\nY63PoUOHmk9AWouhrq4Ow4cPN99sHT60fn5SUhLu3r1rte3BgweRlZWFoKAgDBo0CDU1NUhPT7fZ\nZ2dqa2uxZMkSBAcHY/To0fj222+Rmppqs88xY8YgMDDQ6t6nmlgMBgOqq6sxceJE87LQ0FA8/fTT\nGDBggMXn2DMxish7oXmtO1FXFRYWYsWKFThw4ABeeOEFR4fzRGCiE7kAlsASuQAmOpELYKITuQAm\nOpELYKITuQAmOpELYKITuYD/A+s5COmpBzZUAAAAAElFTkSuQmCC\n",
"text": [
"<matplotlib.figure.Figure at 0x7f048cc1bc50>"
]
}
],
"prompt_number": 72
}
],
"metadata": {}
}
]
}
\ No newline at end of file
#!/usr/bin/env python
from backtranslate.backtranslate import (
reverse_translation_table, one_subst_without_dna, one_subst)
back_table = reverse_translation_table(1)
result = set()
for aa1 in back_table:
for aa2 in back_table:
p = one_subst_without_dna(back_table, aa1, aa2)
for codon in back_table[aa1]:
q = one_subst(back_table, codon, aa2)
#print aa1, aa2, p, codon, q,
if q and str(p) != str(q) and aa1 != aa2:
#print '<--',
result.add((aa1, aa2))
#print
print result
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