Skip to content

Commit

Permalink
Created a Jupyter Notebook containing an minimal example of how to ex…
Browse files Browse the repository at this point in the history
…ecute each measure
  • Loading branch information
mikicanyelles committed Jan 25, 2024
1 parent f67bdba commit 02c4233
Showing 1 changed file with 292 additions and 0 deletions.
292 changes: 292 additions & 0 deletions example/example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,292 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Easy MD Analysis Example Notebook"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/mcanyelles/miniconda3/envs/rcbs/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n",
"/home/mcanyelles/miniconda3/envs/rcbs/lib/python3.11/site-packages/MDAnalysis/topology/TPRParser.py:161: DeprecationWarning: 'xdrlib' is deprecated and slated for removal in Python 3.13\n",
" import xdrlib\n"
]
}
],
"source": [
"from EMDA.emda import EMDA"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"parameters = 'parameters.prmtop'\n",
"trajectory = 'trajectory.nc'"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Trajectory has been loaded!\n"
]
}
],
"source": [
"emda = EMDA(parameters=parameters, trajectory=trajectory)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"emda.select('C10', 'C10', sel_type='at_name')\n",
"emda.select('C11', 'C11', sel_type='at_name')\n",
"emda.select('C12', 'C12', sel_type='at_name')\n",
"emda.select('C13', 'C13', sel_type='at_name')\n",
"emda.select('C14', 'C14', sel_type='at_name')\n",
"\n",
"emda.select('H12', ['H12A', 'H12B'], sel_type='at_name')\n",
"emda.select('Fe', 10596, sel_type='at_num')\n",
"\n",
"emda.select('cof', 10597, sel_type='at_num')\n",
"\n",
"emda.select('COO', [10599, 10600, 10601], sel_type='at_num')\n",
"\n",
"\n",
"emda.select('subs', 666, sel_type='res_num')\n",
"\n",
"emda.select('protein', 'protein')\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1mMethod: add_RMSD\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This function outputs the RMSD of a selection\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"\u001b[1mMethod: add_angle\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This functions measures the angle between 3 specified atoms and returns the value between 0 and 360 degrees.\n",
" The input selections have to be single atoms.\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"\u001b[1mMethod: add_contacts\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This function takes a Universe, a selection and a radius and returns the list of residues nearer than the specified radius.\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"\u001b[1mMethod: add_dihedral\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This functions measures the dihedral angle between 4 specified atoms and returns the dihedral value between 0 and 360 degrees.\n",
" The input selections have to be single atoms.\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"\u001b[1mMethod: add_distWATbridge\u001b[0m\n",
"Help:\n",
"DESCRIPTION\n",
" This function takes a Universe, two selections and the size of their environments and returns the nearest bridging water between the two selections and the distance to both of them.\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"\u001b[1mMethod: add_distance\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This function outputs the minimum measured distance between the two input selections or coordinates or their combination.\n",
"\n",
"USAGE:\n",
" EMDA.add_distance(name, sel1, sel2, type=['min' | 'cog' | 'com'])\n",
"\n",
"\n",
"\u001b[1mMethod: add_pKa\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This function allows the prediction of the pKa using PROpKa3 of the protein for each frame.\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"\u001b[1mMethod: add_planar_angle\u001b[0m\n",
"Help:\n",
"DESCRIPTION:\n",
" This function measures the angle between two planes specified by three atoms each one and returns the angle.\n",
" The input selections have to contain three atoms.\n",
"\n",
"No usage available.\n",
"\n",
"\n",
"Use '>>> help(EMDA.add_***)' to get the complete information of an adder.\n"
]
}
],
"source": [
"emda.print_available_adders()"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"emda.add_distance('dist_H12_cof', 'H12', 'cof', type='min')\n",
"emda.add_angle('ang_C12_cof_Fe', 'Fe', 'cof', 'C12')\n",
"emda.add_dihedral('dihe_C10C14', 'C10', 'C11', 'C13', 'C14', domain=180)\n",
"emda.add_contacts('contacts_COO', 'COO', sel_env=5, interactions='all', include_WAT=True)\n",
"emda.add_contacts('contacts_protein', 'protein')\n",
"emda.add_pKa('pka_protein', 'protein', )\n",
"emda.add_RMSD('rmsd_subs', 'subs', )"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'contacts_COO', 'contacts_protein', 'dihe_C10C14', 'dist_H12_cof', 'ang_C12_cof_Fe'}\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Measuring: 100%|██████████| 10/10 [00:17<00:00, 1.70s/Frame]\n"
]
}
],
"source": [
"emda.run()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'dist_H12_cof': Measure dataclass with:\n",
"\tName: dist_H12_cof\n",
"\tType: distance\n",
"\tSel: [<AtomGroup with 2 atoms>, <AtomGroup with 1 atom>]\n",
"\tStatus: Calculated\n",
", 'ang_C12_cof_Fe': Measure dataclass with:\n",
"\tName: ang_C12_cof_Fe\n",
"\tType: angle\n",
"\tSel: [<AtomGroup with 1 atom>, <AtomGroup with 1 atom>, <AtomGroup with 1 atom>]\n",
"\tStatus: Calculated\n",
", 'dihe_C10C14': Measure dataclass with:\n",
"\tName: dihe_C10C14\n",
"\tType: dihedral\n",
"\tSel: [<AtomGroup with 1 atom>, <AtomGroup with 1 atom>, <AtomGroup with 1 atom>, <AtomGroup with 1 atom>]\n",
"\tStatus: Calculated\n",
", 'contacts_COO': Measure dataclass with:\n",
"\tName: contacts_COO\n",
"\tType: contacts\n",
"\tSel: [<AtomGroup with 3 atoms>, <AtomGroup with 77 atoms, with selection 'around 5 group select' on the entire Universe.>]\n",
"\tStatus: Calculated\n",
", 'contacts_protein': Measure dataclass with:\n",
"\tName: contacts_protein\n",
"\tType: contacts\n",
"\tSel: [<AtomGroup with 10510 atoms>, 3]\n",
"\tStatus: Calculated\n",
", 'pka_protein': Measure dataclass with:\n",
"\tName: pka_protein\n",
"\tType: pka\n",
"\tSel: [<AtomGroup with 10659 atoms>]\n",
"\tStatus: Not calculated\n",
", 'rmsd_subs': Measure dataclass with:\n",
"\tName: rmsd_subs\n",
"\tType: RMSD\n",
"\tSel: [<AtomGroup with 55 atoms>]\n",
"\tStatus: Not calculated\n",
"}\n"
]
}
],
"source": [
"print(emda.measures)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "rcbs",
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 02c4233

Please sign in to comment.