{ "cells": [ { "cell_type": "markdown", "id": "1143818e-25b2-4d6e-9d55-7390b6990518", "metadata": {}, "source": [ "# Average amino acid mass (Da)\n", "It calculates the average mass of the 20 standar amino acids\n", "### Note \n", "1 Da = 1.660539 $10^{−27}$ Kg" ] }, { "cell_type": "markdown", "id": "7ce9bc2d-1d4a-472d-908b-f6fbe0df7dd8", "metadata": {}, "source": [ "## The mass of the different aminoacids\n", "this data structure is a dictionary" ] }, { "cell_type": "code", "execution_count": 1, "id": "980d96cb-6eea-4b48-8ac1-587b0587ada5", "metadata": {}, "outputs": [], "source": [ "amino_acid_masses = {\n", " \"A\": 89.1, # Alanine\n", " \"R\": 174.2, # Arginine\n", " \"N\": 132.1, # Asparagine\n", " \"D\": 133.1, # Aspartic acid\n", " \"C\": 121.2, # Cysteine\n", " \"Q\": 146.2, # Glutamine\n", " \"E\": 147.1, # Glutamic acid\n", " \"G\": 75.1, # Glycine\n", " \"H\": 155.2, # Histidine\n", " \"I\": 131.2, # Isoleucine\n", " \"L\": 131.2, # Leucine\n", " \"K\": 146.2, # Lysine\n", " \"M\": 149.2, # Methionine\n", " \"F\": 165.2, # Phenylalanine\n", " \"P\": 115.1, # Proline\n", " \"S\": 105.1, # Serine\n", " \"T\": 119.1, # Threonine\n", " \"W\": 204.2, # Tryptophan\n", " \"Y\": 181.2, # Tyrosine\n", " \"V\": 117.1 # Valine\n", "}\n" ] }, { "cell_type": "code", "execution_count": 2, "id": "c73dfe51-58d2-4ab8-a594-2577c70ac50b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The mass of Alanine is 89.1 g/mol.\n" ] } ], "source": [ "# Just to see how to access to the mass of one amino acid\n", "# Get the mass of Alanine\n", "alanine_mass = amino_acid_masses[\"A\"]\n", "print(f\"The mass of Alanine is {alanine_mass} g/mol.\")" ] }, { "cell_type": "markdown", "id": "f525c7b9-a2cb-466a-9556-2264c85b9d86", "metadata": {}, "source": [ "## Calculate the average mass in Da" ] }, { "cell_type": "code", "execution_count": 3, "id": "5b8fa130-ef13-4a68-9d19-7e09eb3118d4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "The average mass of the 20 aa is 136.905 g/mol.\n" ] } ], "source": [ "mass = 0 # Da\n", "num = 0\n", "for k in amino_acid_masses.keys(): # iterate all over the aa\n", " num = num + 1\n", " mass = mass + amino_acid_masses[k]\n", "average_mass = mass/num\n", "print(f\"The average mass of the 20 aa is {average_mass} g/mol.\")" ] }, { "cell_type": "code", "execution_count": null, "id": "1cab9161-0ea2-4413-85a3-fd6b6dc6d569", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.7" } }, "nbformat": 4, "nbformat_minor": 5 }