{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "# PB assignation"
   ]
  },
  {
   "cell_type": "raw",
   "metadata": {
    "deletable": true,
    "editable": true,
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    ".. contents:: Table of Contents\n",
    "   :local:\n",
    "   :backlinks: none"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "We hereby demonstrate how to use the API to assign PB sequences."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Date & time: 2017-03-13 10:26:07.996272\n",
      "Python version: 3.5.2 (default, Nov 17 2016, 17:05:23) \n",
      "[GCC 5.4.0 20160609]\n"
     ]
    }
   ],
   "source": [
    "from pprint import pprint\n",
    "import urllib.request\n",
    "import os\n",
    "\n",
    "# print date & versions\n",
    "import datetime\n",
    "print(\"Date & time:\",datetime.datetime.now())\n",
    "import sys\n",
    "print(\"Python version:\", sys.version)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PBxplore version: 1.3.5\n"
     ]
    }
   ],
   "source": [
    "import pbxplore as pbx\n",
    "print(\"PBxplore version:\", pbx.__version__)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Use the built-in structure parser"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "### Assign PB for a single structure"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true,
    "raw_mimetype": "text/restructuredtext"
   },
   "source": [
    "The `pbxplore.chains_from_files()` function is the prefered way to read PDB and PDBx/mmCIF files using PBxplore. This function takes a list of file path as argument, and yield each chain it can read from these files. It provides a single interface to read PDB and PDBx/mmCIF files, to read single model and multimodel files, and to read a single file of a collection of files.\n",
    "\n",
    "Here we want to read a single file with a single model and a single chain. Therefore, we need the first and only record that is yield by `pbxplore.chains_from_files()`. This record contains a name for the chain, and the chain itself as a `pbxplore.structure.structure.Chain` object. Note that, even if we want to read a single file, we need to provide it as a list to `pbxplore.chains_from_files()`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1BTA.pdb | chain A\n",
      "Chain A / model : 1434 atoms\n"
     ]
    }
   ],
   "source": [
    "pdb_name, _ = urllib.request.urlretrieve('https://files.rcsb.org/view/1BTA.pdb', '1BTA.pdb')\n",
    "\n",
    "structure_reader = pbx.chains_from_files([pdb_name])\n",
    "chain_name, chain = next(structure_reader)\n",
    "print(chain_name)\n",
    "print(chain)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Protein Blocks are assigned based on the dihedral angles of the backbone. So we need to calculate them. The `pbxplore.structure.structure.Chain.get_phi_psi_angles()` methods calculate these angles and return them in a form that can be directly provided to the assignement function.\n",
    "\n",
    "The dihedral angles are returned as a dictionnary. Each key of this dictionary is a residue number, and each value is a dictionary with the phi and psi angles."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{1: {'phi': None, 'psi': -171.65563134448544},\n",
      " 2: {'phi': -133.80467711845586, 'psi': 153.74322760775027},\n",
      " 3: {'phi': -134.6617568892695, 'psi': 157.30476083095581},\n",
      " 4: {'phi': -144.49159910635186, 'psi': 118.59706956501037},\n",
      " 5: {'phi': -100.12866913978127, 'psi': 92.98634825528089},\n",
      " 6: {'phi': -83.48980457968895, 'psi': 104.23730726195485},\n",
      " 7: {'phi': -64.77163869310709, 'psi': -43.25159835828049},\n",
      " 8: {'phi': -44.47885842536948, 'psi': -25.89184262616925},\n",
      " 9: {'phi': -94.90790101955957, 'psi': -47.182577907117775},\n",
      " 10: {'phi': -41.312671692330014, 'psi': 133.73743399231304},\n",
      " 11: {'phi': -119.15122785547305, 'psi': -11.827895864023617},\n",
      " 12: {'phi': -174.21196552933984, 'psi': 175.87239770676175},\n",
      " 13: {'phi': -56.61341695443224, 'psi': -45.74767617535588},\n",
      " 14: {'phi': -50.78226415072095, 'psi': -45.3742585970337},\n",
      " 15: {'phi': -57.93584481869442, 'psi': -43.329444361460844},\n",
      " 16: {'phi': -55.20960354113049, 'psi': -56.47559202715399},\n",
      " 17: {'phi': -64.51979885245254, 'psi': -18.577118068149446},\n",
      " 18: {'phi': -70.24273354141474, 'psi': -55.153744337676926},\n",
      " 19: {'phi': -65.20648546633561, 'psi': -41.28370221159952},\n",
      " 20: {'phi': -58.98821952110768, 'psi': -35.78957701447905},\n",
      " 21: {'phi': -66.8659714296852, 'psi': -42.14634696303375},\n",
      " 22: {'phi': -67.34201665142825, 'psi': -57.40438549689628},\n",
      " 23: {'phi': -52.29793609141382, 'psi': -66.09120830346023},\n",
      " 24: {'phi': -61.19010445362886, 'psi': -14.807316930892569},\n",
      " 25: {'phi': 54.95158694420636, 'psi': 47.59528477656777},\n",
      " 26: {'phi': -69.51531755580697, 'psi': 161.10806531443856},\n",
      " 27: {'phi': -57.36300935545188, 'psi': -179.66365615297644},\n",
      " 28: {'phi': -79.91369005407893, 'psi': -18.494472196394668},\n",
      " 29: {'phi': -93.51717329199727, 'psi': 13.802530546559774},\n",
      " 30: {'phi': -38.40653214238887, 'psi': 105.85297788366393},\n",
      " 31: {'phi': -64.01559307951965, 'psi': -5.507357757886837},\n",
      " 32: {'phi': 50.06519606710965, 'psi': 3.6047302867544038},\n",
      " 33: {'phi': -84.83560576923662, 'psi': -176.048770127013},\n",
      " 34: {'phi': -76.65985981150652, 'psi': -36.89428882663367},\n",
      " 35: {'phi': -66.20745817863622, 'psi': -36.19018119951471},\n",
      " 36: {'phi': -80.76844188891471, 'psi': -55.88509876949212},\n",
      " 37: {'phi': -45.0995601497454, 'psi': -50.82304368319501},\n",
      " 38: {'phi': -58.512419169182465, 'psi': -56.4318511704347},\n",
      " 39: {'phi': -44.00775783983471, 'psi': -26.06209153795419},\n",
      " 40: {'phi': -79.6799641005731, 'psi': -51.3827703817916},\n",
      " 41: {'phi': -58.80532943671335, 'psi': -49.46425322450557},\n",
      " 42: {'phi': -75.73059711071141, 'psi': 3.9162670655634235},\n",
      " 43: {'phi': -177.14613562249534, 'psi': 60.46495675947553},\n",
      " 44: {'phi': 177.1265816932884, 'psi': -66.62887199130637},\n",
      " 45: {'phi': -58.436100708193806, 'psi': 149.59997847317612},\n",
      " 46: {'phi': -102.66050573267097, 'psi': 132.43212727859543},\n",
      " 47: {'phi': -114.5213275524662, 'psi': 169.33012343233455},\n",
      " 48: {'phi': -61.39150617820462, 'psi': 136.7035538929314},\n",
      " 49: {'phi': -113.17589693608565, 'psi': 156.54195412530404},\n",
      " 50: {'phi': -117.26440335376827, 'psi': 138.51305036902693},\n",
      " 51: {'phi': -120.03410170277817, 'psi': 81.75707989178757},\n",
      " 52: {'phi': -77.60981590398825, 'psi': 83.18451037698443},\n",
      " 53: {'phi': -79.65858964180552, 'psi': 111.40143302647459},\n",
      " 54: {'phi': -100.37011629225776, 'psi': 150.03395825502497},\n",
      " 55: {'phi': 49.87330458406238, 'psi': 68.7419980340502},\n",
      " 56: {'phi': -73.87938409722335, 'psi': -66.7355521840301},\n",
      " 57: {'phi': -56.20534388077749, 'psi': -35.207843043514686},\n",
      " 58: {'phi': -66.38284564180043, 'psi': -32.21866387324769},\n",
      " 59: {'phi': -94.6778115344365, 'psi': 17.686140221665617},\n",
      " 60: {'phi': -111.48538994784963, 'psi': -38.097764578613976},\n",
      " 61: {'phi': -70.64502750557983, 'psi': -62.8582975880629},\n",
      " 62: {'phi': -33.50588994671665, 'psi': -32.02546270762565},\n",
      " 63: {'phi': -128.57384077349852, 'psi': 62.57927537310066},\n",
      " 64: {'phi': -12.365761900396365, 'psi': 106.99327496259977},\n",
      " 65: {'phi': 73.68588813063126, 'psi': 32.131558860201714},\n",
      " 66: {'phi': -89.05260862755028, 'psi': -69.16778908477181},\n",
      " 67: {'phi': -77.83088301001709, 'psi': -21.564910924673597},\n",
      " 68: {'phi': -71.32122280651765, 'psi': -21.85941318260012},\n",
      " 69: {'phi': -81.4118653034867, 'psi': -55.2935117883826},\n",
      " 70: {'phi': -52.047970110313145, 'psi': -43.22593946145588},\n",
      " 71: {'phi': -59.215594114973726, 'psi': -45.283196644537554},\n",
      " 72: {'phi': -52.67186926130671, 'psi': -38.127901315075064},\n",
      " 73: {'phi': -75.00963018964649, 'psi': -30.83999517691734},\n",
      " 74: {'phi': -74.69878930178584, 'psi': -35.042954979175136},\n",
      " 75: {'phi': -80.22740138668189, 'psi': -37.2721834868002},\n",
      " 76: {'phi': -63.3253002341084, 'psi': -46.736848174955014},\n",
      " 77: {'phi': -62.577975558265166, 'psi': -38.836376804396195},\n",
      " 78: {'phi': -58.4371262613883, 'psi': -30.932534133630554},\n",
      " 79: {'phi': -77.25603045197096, 'psi': -28.810984281581455},\n",
      " 80: {'phi': -65.77402807318447, 'psi': -6.587861693755428},\n",
      " 81: {'phi': 113.27162201541087, 'psi': -14.067924223417435},\n",
      " 82: {'phi': -63.856071155072016, 'psi': 160.46313493362328},\n",
      " 83: {'phi': -109.29442965951228, 'psi': 65.33016925110071},\n",
      " 84: {'phi': -94.29902268445335, 'psi': 87.93029438989075},\n",
      " 85: {'phi': -52.91938395571083, 'psi': 98.897475962567},\n",
      " 86: {'phi': -73.44769372512917, 'psi': 114.64881254410926},\n",
      " 87: {'phi': -114.16119204550668, 'psi': 101.24805765454327},\n",
      " 88: {'phi': -96.78933556699712, 'psi': 106.74340425527281},\n",
      " 89: {'phi': -109.02775603395975, 'psi': None}}\n"
     ]
    }
   ],
   "source": [
    "dihedrals = chain.get_phi_psi_angles()\n",
    "pprint(dihedrals)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "The dihedral angles can be provided to the `pbxplore.assign()` function that assigns a Protein Block to each residue, and that returns the PB sequence as a string. Note that the first and last two residues are assigned to the `Z` jocker block as some dihedral angles cannot be calculated."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ZZdddfklonbfklmmmmmmmmnopafklnoiaklmmmmmnoopacddddddehkllmmmmngoilmmmmmmmmmmmmnopacdcddZZ\n"
     ]
    }
   ],
   "source": [
    "pb_seq = pbx.assign(dihedrals)\n",
    "print(pb_seq)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "### Assign PB for several models of a single file"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "A single PDB file can contain several models. Then, we do not want to read only the first chain. Instead, we want to iterate over all the chains."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 2LFU.pdb | model 1 | chain A\n",
      "  ZZbghiacfkbccdddddehiadddddddddddfklggcdddddddddddddehifbdcddddddddddfklopadddddfhpamlnopcddddddehjadddddehjacbddddddddfklmaccddddddfbgniaghiapaddddddfklnoambZZ\n",
      "* 2LFU.pdb | model 2 | chain A\n",
      "  ZZpcfblcffbccdddddeehjacdddddddddfklggcddddddddddddddfblghiadddddddddfklopadddddehpmmmnopcddddddeehiacdddfblopadcddddddfklpaccdddddfklmlmgcdehiaddddddfklmmgopZZ\n",
      "* 2LFU.pdb | model 3 | chain A\n",
      "  ZZmgghiafbbccdddddehjbdcdddddddddfklggcddddddddddddddfbfghpacddddddddfklopadddddehiaklmmmgcdddddeehiaddddfkbgciacdddddefklpaccddddddfkgojbdfehpaddddddfkbccfbgZZ\n",
      "* 2LFU.pdb | model 4 | chain A\n",
      "  ZZcghiacfkbacdddddfbhpacdddddddddfklmcfdddddddddddddehiacddddddddddddfknopadddddfkpamlnopaddddddehjaccdddfklnopacddddddfklmpccdddddddehiabghehiaddddddfklpccfkZZ\n",
      "* 2LFU.pdb | model 5 | chain A\n",
      "  ZZpaehiehkaccdddddehjbccdddddddddfklggcddddddddddddddfbhpadddddddddddfklopadddddehiamlmmpccdddddeehiadddddfbacddcddddddfklmaccddddddfbgghiafehiadddddddfklpacfZZ\n",
      "* 2LFU.pdb | model 6 | chain A\n",
      "  ZZmghbacfkbccdddddeehpacdddddddddfklggcdddddddddddddehiacadddddddddddfklopadddddehiaklnopcddddddeehiadddehjlnopacddddddfklmaccddddehiaehbgcdehiadddddddfehjlpcZZ\n",
      "* 2LFU.pdb | model 7 | chain A\n",
      "  ZZcchbacfkbccdddddfehpacdddddddddfklggcdddddddddddddddehjapadddddddddfknopadddddfklmmmnopcddddddehjiddddddfknopacddddddfklpaccdddddfklmaacdfehpadddddehjblckknZZ\n",
      "* 2LFU.pdb | model 8 | chain A\n",
      "  ZZcehjdeehiacdjdddedjbdcdddddddddfklggcdddddddddddddddbfblbacddddddddfklopacddddehiamlnopaddddddehjacddddfehpaaccdddddefklpaccdddddfklmbfbehehiaddddddffkgoiehZZ\n",
      "* 2LFU.pdb | model 9 | chain A\n",
      "  ZZpccdjdfkbccdddddehhpacdddddddddfklggcdddddddddddddehiacbdcdddddddddfklopadddddehiammnopcddddddeejiadddehjlgobacddddddfklmpccddddehiacbcbdfehpadddddehjklmklmZZ\n",
      "* 2LFU.pdb | model 10 | chain A\n",
      "  ZZccfklcfkbccdddddehjbdcdddddddddfklggcdddddddddddddehiapaccdddddddddfklopadddddehjamlnopaddddddehjddcdddfbfghpacddddddfklpaccddddddfbcfbacfehpadddddddekpghiaZZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Read 10 chain(s) in 2LFU.pdb\n"
     ]
    }
   ],
   "source": [
    "pdb_name, _ = urllib.request.urlretrieve('https://files.rcsb.org/view/2LFU.pdb', '2LFU.pdb')\n",
    "\n",
    "for chain_name, chain in pbx.chains_from_files([pdb_name]):\n",
    "    dihedrals = chain.get_phi_psi_angles()\n",
    "    pb_seq = pbx.assign(dihedrals)\n",
    "    print('* {}'.format(chain_name))\n",
    "    print('  {}'.format(pb_seq))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "### Assign PB for a set of structures"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "The `pbxplore.chains_from_files()` function can also handle several chains from several files."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The following files will be used:\n",
      "['1BTA.pdb', '2LFU.pdb', '3ICH.pdb']\n",
      "* 1BTA.pdb | chain A\n",
      "  ZZdddfklonbfklmmmmmmmmnopafklnoiaklmmmmmnoopacddddddehkllmmmmngoilmmmmmmmmmmmmnopacdcddZZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Read 1 chain(s) in 1BTA.pdb\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* 2LFU.pdb | model 1 | chain A\n",
      "  ZZbghiacfkbccdddddehiadddddddddddfklggcdddddddddddddehifbdcddddddddddfklopadddddfhpamlnopcddddddehjadddddehjacbddddddddfklmaccddddddfbgniaghiapaddddddfklnoambZZ\n",
      "* 2LFU.pdb | model 2 | chain A\n",
      "  ZZpcfblcffbccdddddeehjacdddddddddfklggcddddddddddddddfblghiadddddddddfklopadddddehpmmmnopcddddddeehiacdddfblopadcddddddfklpaccdddddfklmlmgcdehiaddddddfklmmgopZZ\n",
      "* 2LFU.pdb | model 3 | chain A\n",
      "  ZZmgghiafbbccdddddehjbdcdddddddddfklggcddddddddddddddfbfghpacddddddddfklopadddddehiaklmmmgcdddddeehiaddddfkbgciacdddddefklpaccddddddfkgojbdfehpaddddddfkbccfbgZZ\n",
      "* 2LFU.pdb | model 4 | chain A\n",
      "  ZZcghiacfkbacdddddfbhpacdddddddddfklmcfdddddddddddddehiacddddddddddddfknopadddddfkpamlnopaddddddehjaccdddfklnopacddddddfklmpccdddddddehiabghehiaddddddfklpccfkZZ\n",
      "* 2LFU.pdb | model 5 | chain A\n",
      "  ZZpaehiehkaccdddddehjbccdddddddddfklggcddddddddddddddfbhpadddddddddddfklopadddddehiamlmmpccdddddeehiadddddfbacddcddddddfklmaccddddddfbgghiafehiadddddddfklpacfZZ\n",
      "* 2LFU.pdb | model 6 | chain A\n",
      "  ZZmghbacfkbccdddddeehpacdddddddddfklggcdddddddddddddehiacadddddddddddfklopadddddehiaklnopcddddddeehiadddehjlnopacddddddfklmaccddddehiaehbgcdehiadddddddfehjlpcZZ\n",
      "* 2LFU.pdb | model 7 | chain A\n",
      "  ZZcchbacfkbccdddddfehpacdddddddddfklggcdddddddddddddddehjapadddddddddfknopadddddfklmmmnopcddddddehjiddddddfknopacddddddfklpaccdddddfklmaacdfehpadddddehjblckknZZ\n",
      "* 2LFU.pdb | model 8 | chain A\n",
      "  ZZcehjdeehiacdjdddedjbdcdddddddddfklggcdddddddddddddddbfblbacddddddddfklopacddddehiamlnopaddddddehjacddddfehpaaccdddddefklpaccdddddfklmbfbehehiaddddddffkgoiehZZ\n",
      "* 2LFU.pdb | model 9 | chain A\n",
      "  ZZpccdjdfkbccdddddehhpacdddddddddfklggcdddddddddddddehiacbdcdddddddddfklopadddddehiammnopcddddddeejiadddehjlgobacddddddfklmpccddddehiacbcbdfehpadddddehjklmklmZZ\n",
      "* 2LFU.pdb | model 10 | chain A\n",
      "  ZZccfklcfkbccdddddehjbdcdddddddddfklggcdddddddddddddehiapaccdddddddddfklopadddddehjamlnopaddddddehjddcdddfbfghpacddddddfklpaccddddddfbcfbacfehpadddddddekpghiaZZ\n",
      "* 3ICH.pdb | chain A\n",
      "  ZZccdfbdcdddddehjbdebjcdddddfklmmmlmmmmmmmmnopnopajeopacfbdcehibacehiamnonopgocdfkbjbdcdfblmbccfbghiacdddebehiafkbccddfbdcfklgokaccfbdcfbhklmmmmmmmpccdfkopafbacddfbgcddddfbacddddZZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Read 10 chain(s) in 2LFU.pdb\n",
      "Read 1 chain(s) in 3ICH.pdb\n"
     ]
    }
   ],
   "source": [
    "import glob\n",
    "files = ['1BTA.pdb', '2LFU.pdb', '3ICH.pdb']\n",
    "for pdb_name in files:\n",
    "    urllib.request.urlretrieve('https://files.rcsb.org/view/{0}'.format(pdb_name), pdb_name)\n",
    "\n",
    "print('The following files will be used:')\n",
    "pprint(files)\n",
    "for chain_name, chain in pbx.chains_from_files(files):\n",
    "    dihedrals = chain.get_phi_psi_angles()\n",
    "    pb_seq = pbx.assign(dihedrals)\n",
    "    print('* {}'.format(chain_name))\n",
    "    print('  {}'.format(pb_seq))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "### Assign PB for frames in a trajectory"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "PB sequences can be assigned from a trajectory. To do so, we use the `pbxplore.chains_from_trajectory()` function that takes the path to a trajectory and the path to the corresponding topology as argument. Any file formats readable by MDAnalysis can be used. Except for its arguments, `pbxplore.chains_from_trajectory()` works the same as `pbxplore.chains_from_files()`.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/pierre/.virtualenvs/pbx-py3-test/lib/python3.5/site-packages/MDAnalysis/coordinates/XDR.py:126: UserWarning: Reload offsets from trajectory\n",
      " ctime or size or n_atoms did not match\n",
      "  warnings.warn(\"Reload offsets from trajectory\\n \"\n",
      "Frame 1/225.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "* psi_md_traj.xtc | frame 0\n",
      "  ZZfkbcnopabfklmmmmpckbccdfbfkbcghiaghidfklmmmmmpcfklccZZ\n",
      "* psi_md_traj.xtc | frame 1\n",
      "  ZZfkbcnhpabfklmmmmpckbccdfbfkbcchiachidfklmmmmmbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 2\n",
      "  ZZfkbcnhpabfklmmmmcckbccdfbfkbcchiacdddfklmmmmmbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 3\n",
      "  ZZfkbcnhpacfklmmmmpckbccdfbfkbcehiaedddfklmmmpccdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 4\n",
      "  ZZfkbmnopabfklmmmmmmmbccddbfkbcghiaehidfklmmmmmcdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 5\n",
      "  ZZfkbcnlpabfklmmmmpmkbccdfbfkbcchiacdddfklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 6\n",
      "  ZZfkbcnopabfklmmmnofkbccdfbfkbcchiacdddfklmmoccbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 7\n",
      "  ZZfkbmnopabfklmmmmcfkbccdddfkbcchiaghidfklmmmccbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 8\n",
      "  ZZfkbcnhpabfklmmmmockbccdfbfkbcehiaehiafklmmmmcbcfklccZZ\n",
      "* psi_md_traj.xtc | frame 9\n",
      "  ZZfkbcnhpabfklmmmmcckbccdfbfkbcghiaehidfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 10\n",
      "  ZZfkbcnopabfklmmmmpmkbccdfbfklcghiaehidfklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 11\n",
      "  ZZfkbcghpabfklmmmnockbccdfbfcbcehiaedddfklmmmpcbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 12\n",
      "  ZZfkbanopabfklmmmmockbccdfbfkbcchiaehidfklmmmmmbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 13\n",
      "  ZZfkbcnhpabfklmmmmockbccdfbfkbcchiaghidfklmmmpccdfklccZZ\n",
      "* psi_md_traj.xtc | frame 14\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcchiaghidfklmmopfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 15\n",
      "  ZZfkbcnlpabfklmmmmockbccdfbfklcchiacdddfklmmmpccdfklccZZ\n",
      "* psi_md_traj.xtc | frame 16\n",
      "  ZZfkbcghpabfklmmmmmmkbccdfbfkbcehiachidfklmmmpcbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 17\n",
      "  ZZfkbanlpabfklmmmmpckbccdfbfkbcchiaedddfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 18\n",
      "  ZZfkbcnhpabfklmmmmomkbccdfbfkbcehiaehidfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 19\n",
      "  ZZfkbcnopabfklmmmmpmkbccdfbfkbcehiaehidfklmmmpmbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 20\n",
      "  ZZfkbcnhpabfklmmmmockbccdfbfkbaghiaedddfklmmmgfbafklccZZ\n",
      "* psi_md_traj.xtc | frame 21\n",
      "  ZZfkbcnbpabfklmmmmcckbccdfbfkbcehiaghiafklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 22\n",
      "  ZZfkbcnlpabfklmmmmofkbccdfbfkbcchiaghiafklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 23\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcchiaehiafklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 24\n",
      "  ZZfkbcnbpabfklmmmmockbccddbfkbcchiaehidfklmmmpmbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 25\n",
      "  ZZfkbcgbpabfklmmmmockbccdfbfkbcchiachidfklmmmccbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 26\n",
      "  ZZfkbcnbpabfklmmmmbgkbccdfbfkbcchiacdidfklmmmpmbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 27\n",
      "  ZZfkbcnopabfklmmmmpmkbccdfbfkbaghiaghiafklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 28\n",
      "  ZZfkbcnhpabfklmmmmockbccdfbfkbcghiaedidfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 29\n",
      "  ZZfkbcnhpabfklmmmmmmmbccdfbfkbcghiaehidfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 30\n",
      "  ZZfkbcnlpabfklmmmmmmmbccdfbfklcchiaehidfklmmmpfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 31\n",
      "  ZZfkbonhpabfklmmmmmmmbccdfbfkbcghiaghidfklmmmmmbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 32\n",
      "  ZZfkbcfbpabfklmmmmmmmbccdfbdcbcehiaghidfklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 33\n",
      "  ZZfkbcnhpabfklmmmmmmkbccdfbfkbcchiaghidfklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 34\n",
      "  ZZfklcnopabfklmmmmbmmbccdfbfklcghiaghidfklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 35\n",
      "  ZZfklcnopabfklmmmmpfkbccdfbfkbcehiaehiafklmmmccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 36\n",
      "  ZZfkbcnopabfklmmmnofkbccdfbfcbcehiacdddfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 37\n",
      "  ZZfklcnopabfklmmmmmmmbccdfbfklcghiaghidfklmmmcfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 38\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcehiaehiafklmmmccbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 39\n",
      "  ZZfkbcnopabfklmmmmmmmbccdfbfkbcghiaehiafklmmmpfbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 40\n",
      "  ZZfkbcnlpabfklmmmmockbccdddfklcchiaghiafklmmmpfbafklccZZ\n",
      "* psi_md_traj.xtc | frame 41\n",
      "  ZZfkbcnopacfklmmmmmmkbccdddfkbcehiaghiafklmmmcfbdfklmcZZ\n",
      "* psi_md_traj.xtc | frame 42\n",
      "  ZZfkbcnopabfklmmmnockbccdddfkbcchiaehidfklmmncfbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 43\n",
      "  ZZfkbcnopabfklmmmmockbccdddfkbcchiaehidfklmmmgmbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 44\n",
      "  ZZfkbcnhpabfklmmmmcfkbccdfbfkbcehiaghiafklmmmcfbdfklpcZZ\n",
      "* psi_md_traj.xtc | frame 45\n",
      "  ZZfkbcnhpabfklmmmmmgcbccdfbfkbcchiaehidfklmmmccbdfkbccZZ\n",
      "* psi_md_traj.xtc | frame 46\n",
      "  ZZfkbcnopabfklmmmmocbbccdfbdfbcehiaehidfklmmmgfbacklccZZ\n",
      "* psi_md_traj.xtc | frame 47\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcchiaehidfklmmoccbdfklccZZ\n",
      "* psi_md_traj.xtc | frame 48\n",
      "  ZZfkbmnbpabfklmmmmockbccdfbfkbcchiaehiafklmmommbcfklccZZ\n",
      "* psi_md_traj.xtc | frame 49\n",
      "  ZZfkbcnlpabfklmmmmcfkbccdfbfklcghiaehiafklmmmmmbcfklccZZ\n",
      "* psi_md_traj.xtc | frame 50\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfcbcehiacdidfklmmmmmpcfklpcZZ\n",
      "* psi_md_traj.xtc | frame 51\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcchiaehidfklmmmmmbcfklccZZ\n",
      "* psi_md_traj.xtc | frame 52\n",
      "  ZZfkbcnbpabfklmmmmomkbccdfbfklcghiaghidfklmmmmmmcfklccZZ\n",
      "* psi_md_traj.xtc | frame 53\n",
      "  ZZfkbmnopcbfklmmmmpckbccdfbfklcghiaghiafklmmmmmccfklpcZZ\n",
      "* psi_md_traj.xtc | frame 54\n",
      "  ZZfkbcnbpfbfklmmmmpckbccdddfkbcchiaghiafklmmmmmpcfklpcZZ\n",
      "* psi_md_traj.xtc | frame 55\n",
      "  ZZfkbcnbpfbfklmmmmockbccdfbfkbcchiaehidfklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 56\n",
      "  ZZfkbmnopabfklmmmmcckbccdfbfkbcchiaehiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 57\n",
      "  ZZfkbcnbpabfklmmmmcfkbccdfbfkbcehiaehiafklmmmmmacdfbacZZ\n",
      "* psi_md_traj.xtc | frame 58\n",
      "  ZZfkbcnhpabfklmmmmockbccdfbdfbachiaehiafklmmmmmmcfklccZZ\n",
      "* psi_md_traj.xtc | frame 59\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcchiaghidfklmmmmmmccfbacZZ\n",
      "* psi_md_traj.xtc | frame 60\n",
      "  ZZfkbcnbpabfklmmmmofkbccdfbfkbcehiaghidfklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 61\n",
      "  ZZfkbanbpfbfklmmmmockbccdfbfkbcehiaghidfklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 62\n",
      "  ZZfkbcnbpabfklmmmmomkbccdfbfkbachiaehiafklmmnomacdfbacZZ\n",
      "* psi_md_traj.xtc | frame 63\n",
      "  ZZfkbcnbpabfklmmmmpmkbccdfbfkbcchiaehiafklmmmmnocchiacZZ\n",
      "* psi_md_traj.xtc | frame 64\n",
      "  ZZfkbcnbpabfklmmmmpckbccdfbfkbcehiaehiafklmmmmmpccfkacZZ\n",
      "* psi_md_traj.xtc | frame 65\n",
      "  ZZfkbcnbpcbfklmmmmpckbccdfbfkbcehiaghiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 66\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcchiaehiafklmmmmmbccfbccZZ\n",
      "* psi_md_traj.xtc | frame 67\n",
      "  ZZfkbcnhpabfklmmmmcfkbccdfbfkbcehiaehiafklmmmmmbccfbccZZ\n",
      "* psi_md_traj.xtc | frame 68\n",
      "  ZZfkbcnbpabfklmmmmpckbccdfbfkbcehiaehidfklmmmmmbccfbacZZ\n",
      "* psi_md_traj.xtc | frame 69\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcghiaehiafklmmmmmocfklccZZ\n",
      "* psi_md_traj.xtc | frame 70\n",
      "  ZZfkbcnopabfklmmmmmmkbccdfbfkbcchiaehidfklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 71\n",
      "  ZZfkbcnbpabfklmmmmomkbccdfbfkbcehiaghidfklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 72\n",
      "  ZZfkbcfbpabfklmmmmofkbccdfbfcbcehiaehidfklmmmmmmccfbacZZ\n",
      "* psi_md_traj.xtc | frame 73\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbffbcchiaehiafklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 74\n",
      "  ZZfkbcnbpabfklmmmmcckbccdfbfklcghiaehiafklmmmmmcccfbdcZZ\n",
      "* psi_md_traj.xtc | frame 75\n",
      "  ZZfkbcfhpabfklmmmmpmkbccdfbfklcchiaehiafklmmmmmccfklccZZ\n",
      "* psi_md_traj.xtc | frame 76\n",
      "  ZZfkbcghpabfklmmmmmmmbccdfbfkbcchiaehiafklmmmmmpacfbacZZ\n",
      "* psi_md_traj.xtc | frame 77\n",
      "  ZZfkbcchiabfklmmmmbfkbccdfbfkbcehiaehiafklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 78\n",
      "  ZZfkbcchiacfklmmmmmmkbccdfbfkbcehiaehiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 79\n",
      "  ZZfkbcghpabfklmmmmmmkbccdfbfkbcchiaehidfklmmmmmacfklpcZZ\n",
      "* psi_md_traj.xtc | frame 80\n",
      "  ZZfkbcghpabfklmmmmmmkbccdfbfkbcghiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 81\n",
      "  ZZfkbcnhpabfklmmmmockbccdfbfkbcehiaghidfklmmmmmbcchiacZZ\n",
      "* psi_md_traj.xtc | frame 82\n",
      "  ZZfkbcghpabfklmmmmmmcbccdfbfklcghiaghiafklmmmmmpcfklccZZ\n",
      "* psi_md_traj.xtc | frame 83\n",
      "  ZZfkbcfbpabfklmmmmockbccdfbfklcghiaghidfklmmnomacdfbacZZ\n",
      "* psi_md_traj.xtc | frame 84\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbdfbgghiaehiafklmmmmmbccfbccZZ\n",
      "* psi_md_traj.xtc | frame 85\n",
      "  ZZfkbcgbpacfklmmmmomkbccdfbfkbcehiaghiafklmmmmmpcfklccZZ\n",
      "* psi_md_traj.xtc | frame 86\n",
      "  ZZfkbcghpacfklmmmmmmmbccdfbfkbcehiaehiafklmmmmmccfklccZZ\n",
      "* psi_md_traj.xtc | frame 87\n",
      "  ZZfkbcnopabfklmmmmomkbccdfbdcbcehiaghiafklmmmmmacfklpcZZ\n",
      "* psi_md_traj.xtc | frame 88\n",
      "  ZZfkbcfbpacfklmmmmmmmbccdfbfkbcghiaehiafklmmmmmacfklacZZ\n",
      "* psi_md_traj.xtc | frame 89\n",
      "  ZZfkbcnopabfklmmmmomkbccdfbfklcghiaghiafklmmmmmmcfklpcZZ\n",
      "* psi_md_traj.xtc | frame 90\n",
      "  ZZfkbcnhpacfklmmmmockbccdfbfkbcghiaghiafklmmmmmccfklccZZ\n",
      "* psi_md_traj.xtc | frame 91\n",
      "  ZZffbcnopacfklmmmmockbccdfbfklaghiaehiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 92\n",
      "  ZZfkbcnlpacfklmmmmcckbccdfbfkbcghiaehidfklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 93\n",
      "  ZZdfbanhpacfklmmmmcfkbccdfbfkbcehiaghiafklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 94\n",
      "  ZZfkbcnhpacfklmmmmockbccdfbfkbcehiaehiafklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 95\n",
      "  ZZfkbcnopabfklmmmmmmmbccdfbfkbcehiaehiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 96\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcehiaghiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 97\n",
      "  ZZfkbcnbpabfklmmmmmmkbccdfbfklcghiaehiafklmmmmmmccfbccZZ\n",
      "* psi_md_traj.xtc | frame 98\n",
      "  ZZdfbfnbpfbfklmmmmmmkbccdfbfkbcchiaehidfklmmmmmpccklccZZ\n",
      "* psi_md_traj.xtc | frame 99\n",
      "  ZZfkbcnbpabfklmmmncckbccdfbafbcchiaghidfklmmmmmbcehiacZZ\n",
      "* psi_md_traj.xtc | frame 100\n",
      "  ZZfkbcnbpabfklmmmmmmkbccdfbfkbachiaghidfklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 101\n",
      "  ZZfkbcnbjabfklmmmmmmmbccdfbfklpghiaghidfklmmmmmpcfkbccZZ\n",
      "* psi_md_traj.xtc | frame 102\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbfklcghiaehidfklmmmmmpccklccZZ\n",
      "* psi_md_traj.xtc | frame 103\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcchiaehidfklmmmmmccdhiacZZ\n",
      "* psi_md_traj.xtc | frame 104\n",
      "  ZZfkbcnopacfklmmmmpckbccdfbfkbcehiaehiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 105\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfklcchiaehidfklmmmmmbccfbacZZ\n",
      "* psi_md_traj.xtc | frame 106\n",
      "  ZZfkbcnbpcbfklmmmmoccbccdfbfkbcghiaehidfklmmmmmbccfbacZZ\n",
      "* psi_md_traj.xtc | frame 107\n",
      "  ZZfkbcnbjfbfklmmmmockbccdfbfkbcghiaehidfklmmmmmpccfbacZZ"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Frame 100/225.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "* psi_md_traj.xtc | frame 108\n",
      "  ZZfkbckbpcbfklmmmmpmkbccdfbfkbcehiaghidfklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 109\n",
      "  ZZfkbcnbpabfklmmmmpmkbccdfbfklcghiaghiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 110\n",
      "  ZZfkbcnbpabfklmmmnockbccdfbfklcehiaghiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 111\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfklcghiaehiafklmmmnmpacfbacZZ\n",
      "* psi_md_traj.xtc | frame 112\n",
      "  ZZfkbcfbpcbfklmmmmockbccdfbfklcghiaghiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 113\n",
      "  ZZfkbcnhpabfklmmmmpckbccdfbfklcchiaehiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 114\n",
      "  ZZfkbcehpabfklmmmmpmkbccdfbfkbcghiaghiafklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 115\n",
      "  ZZfkbcnbpabfklmmmmomkbccdfbfkbcehiaghiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 116\n",
      "  ZZfkbcnbpabfklmmmmomkbccdfbfklcghiaghiafklmmmmmcccfbccZZ\n",
      "* psi_md_traj.xtc | frame 117\n",
      "  ZZfkbcfbpabfklmmmmomkbccdfbfkbcghiaghiafklmmmmmccdfbccZZ\n",
      "* psi_md_traj.xtc | frame 118\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbfkbcghiaghiafklmmmmmpccfbpcZZ\n",
      "* psi_md_traj.xtc | frame 119\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfklcghiaehiafklmmmmmbccfbdcZZ\n",
      "* psi_md_traj.xtc | frame 120\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcehiaehiafklmmmmmccdfbacZZ\n",
      "* psi_md_traj.xtc | frame 121\n",
      "  ZZfkbcnbpabfklmmmnockbccdfbfklcehiaghiafklmmmmmpccfbccZZ\n",
      "* psi_md_traj.xtc | frame 122\n",
      "  ZZfkbcnopabfklmmmmmckbccdfbfklcghiaghiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 123\n",
      "  ZZfkbcnopabfklmmmmbckbccdfbfkbcchiaghiafklmmnombcfklccZZ\n",
      "* psi_md_traj.xtc | frame 124\n",
      "  ZZfkbcehpabfklmmmmcckbccdfbfkbcehiaehiafklmmmmmbcfklpcZZ\n",
      "* psi_md_traj.xtc | frame 125\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbffbcchiaghiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 126\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfklcghiaehiafklmmmmmpccfbccZZ\n",
      "* psi_md_traj.xtc | frame 127\n",
      "  ZZfkbcnbpabfklmmmmmmkbccdfbfkbcehiachiafklmmmmmmccfbacZZ\n",
      "* psi_md_traj.xtc | frame 128\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfbbcehiaghiafklmmmmmpccfbacZZ\n",
      "* psi_md_traj.xtc | frame 129\n",
      "  ZZfkbcnopabfklmmmmmmkbccdfbfbdcehiaehiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 130\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcghiaghiafklmmmmmcccfbacZZ\n",
      "* psi_md_traj.xtc | frame 131\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcehiaghiafklmmmmmmgcfkacZZ\n",
      "* psi_md_traj.xtc | frame 132\n",
      "  ZZfkbmnlpabfklmmmmockbccdfbfkbcghiaehiafklmmmmmpcghiacZZ\n",
      "* psi_md_traj.xtc | frame 133\n",
      "  ZZfkbcnopabfklmmmmbckbccdfbfcbcehiaehiafklmmmmmacehiacZZ\n",
      "* psi_md_traj.xtc | frame 134\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcehiaehidfklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 135\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcehiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 136\n",
      "  ZZfkbcnbpcbfklmmmmmmkbccdfbfkbcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 137\n",
      "  ZZfkbmnopabfklmmmmcckbccdfbfkbcghiaghiafklmmmmmpgehiacZZ\n",
      "* psi_md_traj.xtc | frame 138\n",
      "  ZZfkbcnbpabfklmmmmmmmbccdfblkbcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 139\n",
      "  ZZfkbcnbpcbfklmmmmbmkbccdfbfkbcehiaehiafklmmmmmmcehjacZZ\n",
      "* psi_md_traj.xtc | frame 140\n",
      "  ZZfkbfnopcbfklmmmmpmkbccdfbfkbcehiaghiafklmmmmmmgehiacZZ\n",
      "* psi_md_traj.xtc | frame 141\n",
      "  ZZfkbcnbpcbfklmmmmmmmbccdfbfkbcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 142\n",
      "  ZZfkbcnopabfklmmmmpmkbccdfbfkbcehiaehiafklmmmmmacehiacZZ\n",
      "* psi_md_traj.xtc | frame 143\n",
      "  ZZfkbcnhpabfklmmmmomkbccdfbfkbcehiaghiafklmmmmmacehiacZZ\n",
      "* psi_md_traj.xtc | frame 144\n",
      "  ZZfkbcnbpabfklmmmmmmkbccdfbfkbcehiachiafklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 145\n",
      "  ZZfkbcfbpabfklmmmmbckbccdfbdfbaehiaghiafklmmmmmacehiacZZ\n",
      "* psi_md_traj.xtc | frame 146\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbdfbaehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 147\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbdhiaghiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 148\n",
      "  ZZfkbcnbpcbfklmmmmomkbccdfbdcbdehiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 149\n",
      "  ZZfkbcnbpabfklmmmmcfkbccdfbfkbcehiaghiafklmmmmmpcghiacZZ\n",
      "* psi_md_traj.xtc | frame 150\n",
      "  ZZfkbcnbpcbfklmmmmomkbccdfbfkbcehiaehiafklmmnombcghiacZZ\n",
      "* psi_md_traj.xtc | frame 151\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfblcehiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 152\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfklcehiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 153\n",
      "  ZZfkbcnbpabfklmmmmpfkbccdfbfblcehiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 154\n",
      "  ZZfkbcnbpabfklmmmmpmkbccdfbfklcghiaehiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 155\n",
      "  ZZfkbcnbpabfklmmmmpmkbccdfbfklcghiaghiafklmmmmmpcghiacZZ\n",
      "* psi_md_traj.xtc | frame 156\n",
      "  ZZfkbcnbpabfklmmmmpckbccdfbfklcghiaehiafklmmmmmbcehiacZZ\n",
      "* psi_md_traj.xtc | frame 157\n",
      "  ZZfkbcnbpabfklmmmmofkbccdfbfkbcghiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 158\n",
      "  ZZfkbcnbpabfklmmmnockbccdfbfkbcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 159\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbdfbaehiaehiafklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 160\n",
      "  ZZfkbcnbpabfklmmmmmmkbccdfbdfbachiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 161\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbacbdehiaehiafklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 162\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcehiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 163\n",
      "  ZZfkbcfbpcbfklmmmmpckbccdfbfkbcghiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 164\n",
      "  ZZfkbcnhpabfklmmmmomkbccdfbdfbaehiaehiafklmmmmmpcehkacZZ\n",
      "* psi_md_traj.xtc | frame 165\n",
      "  ZZfkbcnopabfklmmmmockbccdfbdcbcehiaehiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 166\n",
      "  ZZfkbcnbpabfklmmmmcfkbccdfbfkbcghiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 167\n",
      "  ZZfkbcfbpfbfklmmmmockbccdfbfkbcghiaghiafklmmommpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 168\n",
      "  ZZfkbcfbpabfklmmmmockbccdfbfkbcghiaehiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 169\n",
      "  ZZfkbcfbpabfklmmmmockbccdfbfkbcghiaghiafklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 170\n",
      "  ZZfkbcfbpabfklmmmmockbccdfbfkbcghiachiafklmmmmmacehiacZZ\n",
      "* psi_md_traj.xtc | frame 171\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfklcehiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 172\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfklcghiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 173\n",
      "  ZZfkbcnopabfklmmmmpckbccdfbfkbcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 174\n",
      "  ZZfkbmnopabfklmmmmockbccdfbfklcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 175\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfklcchiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 176\n",
      "  ZZfkbcnbpabfklmmmncfkbccdfbfkbcehiaehiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 177\n",
      "  ZZfkbcnopabfklmmmnockbccdfbfkbcghiaehiafklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 178\n",
      "  ZZfkbcnbpabfklmmmmcckbccdfbfkbcehiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 179\n",
      "  ZZfkbcnbpabfklmmmncfkbccdfbfkbcghiaghiafklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 180\n",
      "  ZZfkbcnopabfklmmmmpckbccdfbfklcehiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 181\n",
      "  ZZfkbfnbpcbfklmmmmockbccdfbdcbcehiacdddfklmmmmnpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 182\n",
      "  ZZfkbcnbpcbfklmmmmpmkbccdfbfkbcghiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 183\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcehiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 184\n",
      "  ZZfkbcnbpabfklmmmmcckbccdfbfklcghiaehiafklmmommccehiacZZ\n",
      "* psi_md_traj.xtc | frame 185\n",
      "  ZZfkbcnbpabfklmmmmpfkbccdfbfkbcehiaehiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 186\n",
      "  ZZfkbcnopabfklmmmmmmkbccdfbfklcghiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 187\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfklcghiaghiafklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 188\n",
      "  ZZfkbcnbpabfklmmmmpmkbccdfbfkbcchiafbdcfklmmmmmpcehjacZZ\n",
      "* psi_md_traj.xtc | frame 189\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbfcbcehiafbdcfklmmmmmbcehiacZZ\n",
      "* psi_md_traj.xtc | frame 190\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbfklcghiafbdcfklmmmmmbcehiacZZ\n",
      "* psi_md_traj.xtc | frame 191\n",
      "  ZZfkbmnbpcbfklmmmnockbccdfblbacehiafbdcfklmmnmmbcehiacZZ\n",
      "* psi_md_traj.xtc | frame 192\n",
      "  ZZfkbcnbpfbfklmmmmpmkbccdfbfbdcehiafbdcfklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 193\n",
      "  ZZfkbcnbpcbfklmmmnomkbccdfbfklcghiacbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 194\n",
      "  ZZfkbmnbpabfklmmmmpmkbccdfbfkbcghiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 195\n",
      "  ZZfkbfnbpabfklmmmmpmkbccdfbfkbcehiafbdcfklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 196\n",
      "  ZZfkbfnbpabfklmmmmpmkbccdfbfkbcehiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 197\n",
      "  ZZfkbmnbpabfklmmmmockbccdfbfkbcehiafbdcfklmmmmmpcchiacZZ\n",
      "* psi_md_traj.xtc | frame 198\n",
      "  ZZfkbmnbpcbfklmmmmpmkbccdfbdfbcehiafbdcfklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 199\n",
      "  ZZfkbcnbpabfklmmmnockbccdfbfkbcghiafbdcfklmmmmmpaehiacZZ\n",
      "* psi_md_traj.xtc | frame 200\n",
      "  ZZfkbcnbpcbfklmmmmockbccdfbdcbcehiafbdcfklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 201\n",
      "  ZZfkbcnopabfklmmmmomkbccdfbfbdcehiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 202\n",
      "  ZZfkbcnopabfklmmmmomkbccdfbfkbcehiafbdcfklmmmmmpcghiacZZ\n",
      "* psi_md_traj.xtc | frame 203\n",
      "  ZZfkbcnopabfklmmmmmmkbccdfbfbbcehiafbdcfklmmmmmpcghiacZZ\n",
      "* psi_md_traj.xtc | frame 204\n",
      "  ZZfkbcnopabfklmmmmpmkbccdfbfbbcehiafbdcfklmmmmmpcghiacZZ\n",
      "* psi_md_traj.xtc | frame 205\n",
      "  ZZfkbcnopabfklmmmmomkbccdfbfbbcehiafbdcfklmmmmmbcghiacZZ\n",
      "* psi_md_traj.xtc | frame 206\n",
      "  ZZfkbcnopabfklmmmmpckbccdfbfkbgghiafbdcfklmmmmmpcehjacZZ\n",
      "* psi_md_traj.xtc | frame 207\n",
      "  ZZfkbcnopacfklmmmmomkbccdfblkbcghiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 208\n",
      "  ZZfkbcfbpabfklmmmmockbccdfbfkbcghiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 209\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcghiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 210\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcghiafbdcfklmmmmmbcehiacZZ\n",
      "* psi_md_traj.xtc | frame 211\n",
      "  ZZdfbanbpabfklmmmmockbccdfbfkbcehiafbdcfklmmmnmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 212\n",
      "  ZZfkbcnopabfklmmmnofkbccdfbfkbcehiafbdcfklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 213\n",
      "  ZZfkbcnbpabfklmmmmockbccdfbfkbcehiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 214\n",
      "  ZZfkbcnopabfklmmmmomkbccdfbfcbcehiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 215\n",
      "  ZZfkbcnopabfklmmmmpfkbccdfbfkbcchiacbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 216\n",
      "  ZZfkbcnopabfklmmmmockbccdfbfkbcehiacbdcfklmmmnmpaghiacZZ\n",
      "* psi_md_traj.xtc | frame 217\n",
      "  ZZfkbcnbpabfklmmmmcckbccdfbfkbcehiafbdcfklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 218\n",
      "  ZZfkbcnhpabfklmmmmpckbccdfbfkbcchiafbdcfklmmmmmccehiacZZ\n",
      "* psi_md_traj.xtc | frame 219\n",
      "  ZZfkbcnbpabfklmmmmpckbccdfbfkbachiafbdcfklmmmmmpcehiacZZ\n",
      "* psi_md_traj.xtc | frame 220\n",
      "  ZZfkbcnbpabfklmmmnockbccdfbfkbcehiafbdcfklmmmnmpaghiacZZ\n",
      "* psi_md_traj.xtc | frame 221\n",
      "  ZZdfbanbpabfklmmmnockbccdfblkbcehiafbdcfklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 222\n",
      "  ZZfkbcnopabfklmmmmcfkbccdfbfkbcehiafbdcfklmmmmmmcehiacZZ\n",
      "* psi_md_traj.xtc | frame 223\n",
      "  ZZfkbcnopabfklmmmmcfkbccdfbfkbcehiafbdcfklmmmmmmcghiacZZ\n",
      "* psi_md_traj.xtc | frame 224\n",
      "  ZZfkbcnbpabfklmmmmofkbccdfbfkbcghiafbdcfklmmmmmpcehiacZZ\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Frame 200/225.\n",
      "Frame 225/225.\n"
     ]
    }
   ],
   "source": [
    "topology, _ = urllib.request.urlretrieve('https://raw.githubusercontent.com/pierrepo/PBxplore/master/demo_doc/psi_md_traj.gro', \n",
    "                                         'psi_md_traj.gro')\n",
    "trajectory, _ = urllib.request.urlretrieve('https://raw.githubusercontent.com/pierrepo/PBxplore/master/demo_doc/psi_md_traj.xtc', \n",
    "                                           'psi_md_traj.xtc')\n",
    "\n",
    "for chain_name, chain in pbx.chains_from_trajectory(trajectory, topology):\n",
    "    dihedrals = chain.get_phi_psi_angles()\n",
    "    pb_seq = pbx.assign(dihedrals)\n",
    "    print('* {}'.format(chain_name))\n",
    "    print('  {}'.format(pb_seq))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "## Use a different structure parser"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "Providing the dihedral angles can be formated as expected by `pbxplore.assign()`, the source of these angles does not matter. For instance, other PDB parser can be used with PBxplore."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "deletable": true,
    "editable": true
   },
   "source": [
    "### BioPython"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false,
    "deletable": true,
    "editable": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "BioPython version: 1.68\n",
      "<Model id=0> <Chain id=A>\n",
      "ZZbghiacfkbccdddddehiadddddddddddfklggcdddddddddddddehifbdcddddddddddfklopadddddfhpamlnopcddddddehjadddddehjacbddddddddfklmaccddddddfbgniaghiapaddddddfklnoambZZ\n",
      "<Model id=1> <Chain id=A>\n",
      "ZZpcfblcffbccdddddeehjacdddddddddfklggcddddddddddddddfblghiadddddddddfklopadddddehpmmmnopcddddddeehiacdddfblopadcddddddfklpaccdddddfklmlmgcdehiaddddddfklmmgopZZ\n",
      "<Model id=2> <Chain id=A>\n",
      "ZZmgghiafbbccdddddehjbdcdddddddddfklggcddddddddddddddfbfghpacddddddddfklopadddddehiaklmmmgcdddddeehiaddddfkbgciacdddddefklpaccddddddfkgojbdfehpaddddddfkbccfbgZZ\n",
      "<Model id=3> <Chain id=A>\n",
      "ZZcghiacfkbacdddddfbhpacdddddddddfklmcfdddddddddddddehiacddddddddddddfknopadddddfkpamlnopaddddddehjaccdddfklnopacddddddfklmpccdddddddehiabghehiaddddddfklpccfkZZ\n",
      "<Model id=4> <Chain id=A>\n",
      "ZZpaehiehkaccdddddehjbccdddddddddfklggcddddddddddddddfbhpadddddddddddfklopadddddehiamlmmpccdddddeehiadddddfbacddcddddddfklmaccddddddfbgghiafehiadddddddfklpacfZZ\n",
      "<Model id=5> <Chain id=A>\n",
      "ZZmghbacfkbccdddddeehpacdddddddddfklggcdddddddddddddehiacadddddddddddfklopadddddehiaklnopcddddddeehiadddehjlnopacddddddfklmaccddddehiaehbgcdehiadddddddfehjlpcZZ\n",
      "<Model id=6> <Chain id=A>\n",
      "ZZcchbacfkbccdddddfehpacdddddddddfklggcdddddddddddddddehjapadddddddddfknopadddddfklmmmnopcddddddehjiddddddfknopacddddddfklpaccdddddfklmaacdfehpadddddehjblckknZZ\n",
      "<Model id=7> <Chain id=A>\n",
      "ZZcehjdeehiacdjdddedjbdcdddddddddfklggcdddddddddddddddbfblbacddddddddfklopacddddehiamlnopaddddddehjacddddfehpaaccdddddefklpaccdddddfklmbfbehehiaddddddffkgoiehZZ\n",
      "<Model id=8> <Chain id=A>\n",
      "ZZpccdjdfkbccdddddehhpacdddddddddfklggcdddddddddddddehiacbdcdddddddddfklopadddddehiammnopcddddddeejiadddehjlgobacddddddfklmpccddddehiacbcbdfehpadddddehjklmklmZZ\n",
      "<Model id=9> <Chain id=A>\n",
      "ZZccfklcfkbccdddddehjbdcdddddddddfklggcdddddddddddddehiapaccdddddddddfklopadddddehjamlnopaddddddehjddcdddfbfghpacddddddfklpaccddddddfbcfbacfehpadddddddekpghiaZZ\n"
     ]
    }
   ],
   "source": [
    "import Bio\n",
    "import Bio.PDB\n",
    "import math\n",
    "print(\"BioPython version:\", Bio.__version__)\n",
    "\n",
    "pdb_name, _ = urllib.request.urlretrieve('https://files.rcsb.org/view/2LFU.pdb', '2LFU.pdb')\n",
    "\n",
    "for model in Bio.PDB.PDBParser().get_structure(\"2LFU\", pdb_name):\n",
    "    for chain in model:\n",
    "        polypeptides = Bio.PDB.PPBuilder().build_peptides(chain)\n",
    "        for poly_index, poly in enumerate(polypeptides):\n",
    "            dihedral_list = poly.get_phi_psi_list()\n",
    "            dihedrals = {}\n",
    "            for resid, (phi, psi) in enumerate(dihedral_list, start=1):\n",
    "                if not phi is None:\n",
    "                    phi = 180 * phi / math.pi\n",
    "                if not psi is None:\n",
    "                    psi = 180 * psi / math.pi\n",
    "                dihedrals[resid] = {'phi': phi, 'psi': psi}\n",
    "        print(model, chain)\n",
    "        pb_seq = pbx.assign(dihedrals)\n",
    "        print(pb_seq)"
   ]
  }
 ],
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "kernelspec": {
   "display_name": "Python 3",
   "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.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
