Created
April 11, 2018 20:05
-
-
Save jbarnoud/16ba64c211c953e6cbcff477ba9765af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "cells": [ | |
| { | |
| "cell_type": "code", | |
| "execution_count": 1, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.767741Z", | |
| "start_time": "2018-04-11T20:03:41.164828Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "name": "stdout", | |
| "output_type": "stream", | |
| "text": [ | |
| "Using redistributed KDTree\n" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "import networkx as nx\n", | |
| "import martinize2\n", | |
| "import martinize2.forcefield\n", | |
| "import collections" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 2, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.779488Z", | |
| "start_time": "2018-04-11T20:03:41.769948Z" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "nter = nx.Graph()\n", | |
| "nter.add_nodes_from((\n", | |
| " (0, {'atomname': 'CA', 'PTM_atom': False, 'element': 'C'}),\n", | |
| " (1, {'atomname': 'N', 'PTM_atom': False, 'element': 'N'}),\n", | |
| " (2, {'atomname': 'HN', 'PTM_atom': False, 'element': 'H'}),\n", | |
| " (3, {'atomname': 'H', 'PTM_atom': True, 'element': 'H'}),\n", | |
| "))\n", | |
| "nter.add_edges_from([[0, 1], [1, 2], [1, 3]])\n", | |
| "\n", | |
| "gluh = nx.Graph()\n", | |
| "gluh.add_nodes_from((\n", | |
| " (0, {'atomname': 'CD', 'PTM_atom': False, 'element': 'C'}),\n", | |
| " (1, {'atomname': 'OE1', 'PTM_atom': False, 'element': 'O'}),\n", | |
| " (2, {'atomname': 'OE2', 'PTM_atom': False, 'element': 'O'}),\n", | |
| " (3, {'atomname': 'HE1', 'PTM_atom': True, 'element': 'H'}),\n", | |
| "))\n", | |
| "gluh.add_edges_from([[0, 1], [0, 2], [1, 3]])\n", | |
| "martinize2.forcefield.FORCE_FIELDS['universal'].modifications = [nter, gluh]" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 3, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.805750Z", | |
| "start_time": "2018-04-11T20:03:41.783818Z" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "molecule = martinize2.molecule.Molecule()\n", | |
| "molecule.add_nodes_from((\n", | |
| " (0, {'resid': 1, 'resname': 'GLU', 'atomname': 'N', 'chain': 'A', 'element': 'N'}),\n", | |
| " (1, {'resid': 1, 'resname': 'GLU', 'atomname': 'CA', 'chain': 'A', 'element': 'C'}),\n", | |
| " (2, {'resid': 1, 'resname': 'GLU', 'atomname': 'C', 'chain': 'A', 'element': 'C'}),\n", | |
| " (3, {'resid': 1, 'resname': 'GLU', 'atomname': 'O', 'chain': 'A', 'element': 'O'}),\n", | |
| " (4, {'resid': 1, 'resname': 'GLU', 'atomname': 'CB', 'chain': 'A', 'element': 'C'}),\n", | |
| " (5, {'resid': 1, 'resname': 'GLU', 'atomname': 'HB1', 'chain': 'A', 'element': 'H'}),\n", | |
| " (6, {'resid': 1, 'resname': 'GLU', 'atomname': 'HB2', 'chain': 'A', 'element': 'H'}),\n", | |
| " (7, {'resid': 1, 'resname': 'GLU', 'atomname': 'CG', 'chain': 'A', 'element': 'C'}),\n", | |
| " (8, {'resid': 1, 'resname': 'GLU', 'atomname': 'HG1', 'chain': 'A', 'element': 'H'}),\n", | |
| " (9, {'resid': 1, 'resname': 'GLU', 'atomname': 'HG2', 'chain': 'A', 'element': 'H'}),\n", | |
| " (10, {'resid': 1, 'resname': 'GLU', 'atomname': 'CD', 'chain': 'A', 'element': 'C'}),\n", | |
| " (11, {'resid': 1, 'resname': 'GLU', 'atomname': 'OE2', 'chain': 'A', 'element': 'O'}),\n", | |
| " (12, {'resid': 1, 'resname': 'GLU', 'atomname': 'OE1', 'chain': 'A', 'element': 'O'}),\n", | |
| " (13, {'resid': 1, 'resname': 'GLU', 'atomname': 'HE1', 'chain': 'A', 'element': 'H'}),\n", | |
| " (14, {'resid': 1, 'resname': 'GLU', 'atomname': 'H', 'chain': 'A', 'element': 'H'}),\n", | |
| " (15, {'resid': 1, 'resname': 'GLU', 'atomname': 'HA', 'chain': 'A', 'element': 'H'}),\n", | |
| " (16, {'resid': 1, 'resname': 'GLU', 'atomname': 'HN', 'chain': 'A', 'element': 'H'}),\n", | |
| "))\n", | |
| "molecule.add_edges_from([\n", | |
| " [0, 1], [1, 2], [2, 3], [1, 4], [4, 5], [4, 6], [4, 7], [7, 8],\n", | |
| " [7, 9], [7, 10], [10, 11], [10, 12], [12, 13], [14, 0], [15, 1], [16, 0],\n", | |
| "])\n", | |
| "system = martinize2.System()\n", | |
| "system.molecules = [molecule]\n", | |
| "system.force_field = martinize2.forcefield.FORCE_FIELDS['universal']" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 4, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.818947Z", | |
| "start_time": "2018-04-11T20:03:41.807438Z" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "name_count_before = collections.Counter(\n", | |
| " node['atomname']\n", | |
| " for molecule in system.molecules\n", | |
| " for node in molecule.nodes.values()\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 5, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.840786Z", | |
| "start_time": "2018-04-11T20:03:41.821025Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "Counter({'N': 1,\n", | |
| " 'CA': 1,\n", | |
| " 'C': 1,\n", | |
| " 'O': 1,\n", | |
| " 'CB': 1,\n", | |
| " 'HB1': 1,\n", | |
| " 'HB2': 1,\n", | |
| " 'CG': 1,\n", | |
| " 'HG1': 1,\n", | |
| " 'HG2': 1,\n", | |
| " 'CD': 1,\n", | |
| " 'OE2': 1,\n", | |
| " 'OE1': 1,\n", | |
| " 'HE1': 1,\n", | |
| " 'H': 1,\n", | |
| " 'HA': 1,\n", | |
| " 'HN': 1})" | |
| ] | |
| }, | |
| "execution_count": 5, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "name_count_before" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 6, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.847993Z", | |
| "start_time": "2018-04-11T20:03:41.843615Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "17" | |
| ] | |
| }, | |
| "execution_count": 6, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "sum(name_count_before.values())" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 7, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.876396Z", | |
| "start_time": "2018-04-11T20:03:41.850605Z" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "martinize2.RepairGraph().run_system(system)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 8, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.886258Z", | |
| "start_time": "2018-04-11T20:03:41.879735Z" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "name_count_after = collections.Counter(\n", | |
| " node['atomname']\n", | |
| " for molecule in system.molecules\n", | |
| " for node in molecule.nodes.values()\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 9, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.900032Z", | |
| "start_time": "2018-04-11T20:03:41.888643Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "Counter({'N': 1,\n", | |
| " 'CA': 1,\n", | |
| " 'C': 1,\n", | |
| " 'O': 1,\n", | |
| " 'CB': 1,\n", | |
| " 'HB1': 1,\n", | |
| " 'HB2': 1,\n", | |
| " 'CG': 1,\n", | |
| " 'HG1': 1,\n", | |
| " 'HG2': 1,\n", | |
| " 'CD': 1,\n", | |
| " 'OE1': 1,\n", | |
| " 'OE2': 1,\n", | |
| " 'HE1': 1,\n", | |
| " 'HN': 2,\n", | |
| " 'HA': 1})" | |
| ] | |
| }, | |
| "execution_count": 9, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "name_count_after" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 10, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.910968Z", | |
| "start_time": "2018-04-11T20:03:41.902614Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "17" | |
| ] | |
| }, | |
| "execution_count": 10, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "sum(name_count_after.values())" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 11, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.919526Z", | |
| "start_time": "2018-04-11T20:03:41.913014Z" | |
| } | |
| }, | |
| "outputs": [], | |
| "source": [ | |
| "name_count_block = collections.Counter(\n", | |
| " martinize2.forcefield.FORCE_FIELDS['universal'].blocks['GLU'].nodes.keys()\n", | |
| ")" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 12, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.933827Z", | |
| "start_time": "2018-04-11T20:03:41.921245Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "Counter({'N': 1,\n", | |
| " 'HN': 1,\n", | |
| " 'CA': 1,\n", | |
| " 'HA': 1,\n", | |
| " 'CB': 1,\n", | |
| " 'HB1': 1,\n", | |
| " 'HB2': 1,\n", | |
| " 'CG': 1,\n", | |
| " 'HG1': 1,\n", | |
| " 'HG2': 1,\n", | |
| " 'CD': 1,\n", | |
| " 'OE1': 1,\n", | |
| " 'OE2': 1,\n", | |
| " 'C': 1,\n", | |
| " 'O': 1})" | |
| ] | |
| }, | |
| "execution_count": 12, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "name_count_block" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 13, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.944965Z", | |
| "start_time": "2018-04-11T20:03:41.936403Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "15" | |
| ] | |
| }, | |
| "execution_count": 13, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "sum(name_count_block.values())" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 14, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:41.967892Z", | |
| "start_time": "2018-04-11T20:03:41.948353Z" | |
| }, | |
| "scrolled": false | |
| }, | |
| "outputs": [ | |
| { | |
| "data": { | |
| "text/plain": [ | |
| "[{'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'N',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'N',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836358>,\n", | |
| " 'atype': 'NH1',\n", | |
| " 'charge': -0.47,\n", | |
| " 'charge_group': 0},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'CA',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'C',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f26138361d0>,\n", | |
| " 'atype': 'CT1',\n", | |
| " 'charge': 0.07,\n", | |
| " 'charge_group': 2},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'C',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'C',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836320>,\n", | |
| " 'atype': 'C',\n", | |
| " 'charge': 0.51,\n", | |
| " 'charge_group': 13},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'O',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'O',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f26137ef438>,\n", | |
| " 'atype': 'O',\n", | |
| " 'charge': -0.51,\n", | |
| " 'charge_group': 14},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'CB',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'C',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836a20>,\n", | |
| " 'atype': 'CT2',\n", | |
| " 'charge': -0.18,\n", | |
| " 'charge_group': 4},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HB1',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836a58>,\n", | |
| " 'atype': 'HA',\n", | |
| " 'charge': 0.09,\n", | |
| " 'charge_group': 5},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HB2',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f26138367f0>,\n", | |
| " 'atype': 'HA',\n", | |
| " 'charge': 0.09,\n", | |
| " 'charge_group': 6},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'CG',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'C',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f26138366d8>,\n", | |
| " 'atype': 'CT2',\n", | |
| " 'charge': -0.28,\n", | |
| " 'charge_group': 7},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HG1',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836da0>,\n", | |
| " 'atype': 'HA',\n", | |
| " 'charge': 0.09,\n", | |
| " 'charge_group': 8},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HG2',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836d68>,\n", | |
| " 'atype': 'HA',\n", | |
| " 'charge': 0.09,\n", | |
| " 'charge_group': 9},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'CD',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'C',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836ef0>,\n", | |
| " 'atype': 'CC',\n", | |
| " 'charge': 0.62,\n", | |
| " 'charge_group': 10},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'OE1',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'O',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836eb8>,\n", | |
| " 'atype': 'OC',\n", | |
| " 'charge': -0.76,\n", | |
| " 'charge_group': 11},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'OE2',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'O',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836f98>,\n", | |
| " 'atype': 'OC',\n", | |
| " 'charge': -0.76,\n", | |
| " 'charge_group': 12},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HE1',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'PTM_atom': True},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HN',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f26138360f0>,\n", | |
| " 'atype': 'H',\n", | |
| " 'charge': 0.31,\n", | |
| " 'charge_group': 1},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HA',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'graph': <martinize2.molecule.Molecule at 0x7f2613836b38>,\n", | |
| " 'atype': 'HB',\n", | |
| " 'charge': 0.09,\n", | |
| " 'charge_group': 3},\n", | |
| " {'resid': 1,\n", | |
| " 'resname': 'GLU',\n", | |
| " 'atomname': 'HN',\n", | |
| " 'chain': 'A',\n", | |
| " 'element': 'H',\n", | |
| " 'PTM_atom': True}]" | |
| ] | |
| }, | |
| "execution_count": 14, | |
| "metadata": {}, | |
| "output_type": "execute_result" | |
| } | |
| ], | |
| "source": [ | |
| "list(system.molecules[0].nodes.values())" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": 15, | |
| "metadata": { | |
| "ExecuteTime": { | |
| "end_time": "2018-04-11T20:03:42.087028Z", | |
| "start_time": "2018-04-11T20:03:41.971193Z" | |
| } | |
| }, | |
| "outputs": [ | |
| { | |
| "ename": "KeyError", | |
| "evalue": "'Could not identify PTM'", | |
| "output_type": "error", | |
| "traceback": [ | |
| "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", | |
| "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", | |
| "\u001b[0;32m<ipython-input-15-a0d2d8d78673>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mmartinize2\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCanonicalizeModifications\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_system\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msystem\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", | |
| "\u001b[0;32m~/dev/old/vermouth-martinize/martinize2/processors/processor.py\u001b[0m in \u001b[0;36mrun_system\u001b[0;34m(self, system)\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0mmols\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mmolecule\u001b[0m \u001b[0;32min\u001b[0m \u001b[0msystem\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmolecules\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 13\u001b[0;31m \u001b[0mmols\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_molecule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmolecule\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 14\u001b[0m \u001b[0msystem\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmolecules\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmols\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
| "\u001b[0;32m~/dev/old/vermouth-martinize/martinize2/processors/canonicalize_modifications.py\u001b[0m in \u001b[0;36mrun_molecule\u001b[0;34m(self, molecule)\u001b[0m\n\u001b[1;32m 275\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0mCanonicalizeModifications\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mProcessor\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 276\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mrun_molecule\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmolecule\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 277\u001b[0;31m \u001b[0mfix_ptm\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmolecule\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 278\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mmolecule\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
| "\u001b[0;32m~/dev/old/vermouth-martinize/martinize2/processors/canonicalize_modifications.py\u001b[0m in \u001b[0;36mfix_ptm\u001b[0;34m(molecule)\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[0;31m# TODO/FIXME: This includes anchors in sorting by size.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 245\u001b[0m \u001b[0moptions\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msorted\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moptions\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mlambda\u001b[0m \u001b[0mopt\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mopt\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mreverse\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 246\u001b[0;31m \u001b[0midentified\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0midentify_ptms\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresidue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mres_ptms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moptions\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 247\u001b[0m \u001b[0;31m# INFO output: Identified modification X.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 248\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Today your answer is: {}!'\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mformat\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mout\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'name'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mout\u001b[0m \u001b[0;32min\u001b[0m \u001b[0midentified\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", | |
| "\u001b[0;32m~/dev/old/vermouth-martinize/martinize2/processors/canonicalize_modifications.py\u001b[0m in \u001b[0;36midentify_ptms\u001b[0;34m(residue, residue_ptms, known_PTMs)\u001b[0m\n\u001b[1;32m 155\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 156\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 157\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'Could not identify PTM'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 158\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 159\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", | |
| "\u001b[0;31mKeyError\u001b[0m: 'Could not identify PTM'" | |
| ] | |
| } | |
| ], | |
| "source": [ | |
| "martinize2.CanonicalizeModifications().run_system(system)" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "execution_count": null, | |
| "metadata": {}, | |
| "outputs": [], | |
| "source": [] | |
| } | |
| ], | |
| "metadata": { | |
| "hide_input": false, | |
| "kernelspec": { | |
| "display_name": "Python 3 (oldm2)", | |
| "language": "python", | |
| "name": "oldm2" | |
| }, | |
| "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.6.5" | |
| }, | |
| "toc": { | |
| "nav_menu": {}, | |
| "number_sections": true, | |
| "sideBar": true, | |
| "skip_h1_title": false, | |
| "toc_cell": false, | |
| "toc_position": {}, | |
| "toc_section_display": "block", | |
| "toc_window_display": false | |
| } | |
| }, | |
| "nbformat": 4, | |
| "nbformat_minor": 2 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment