{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Getting Started\n",
"\n",
"Welcome to the first BuildAMol tutorial, where we shall learn the basics of operating with BuildAMol!\n",
"\n",
"> ### In this tutorial we will cover:\n",
"> - which (main) classes and modules exist and when to use them\n",
"> - how to read input to make `Molecule`s\n",
"> - how to connect two molecules together"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Main Classes in BuildAMol\n",
"\n",
"The most important class is the `Molecule` class which houses ~90% of all functionality that the average user is likely to use. \n",
"Next, comes the `Linkage` class that defines how multiple molecules can be connected, so the user can build larger structures. Third are the ptimization environments of the `optimizers` module. They can be used to optimize conformations. Also, the `MoleculeViewer3D` may come in quite handy. It is essentially just a plotly 3D-plot but it can be selectively colored easily so as to highlight specific parts of your molecule - it is a great tool to check if your building process is working (or to debug why it may not be). Finally, the `resources` module houses a wealth of reference structures for users to use when building their favourite structures.\n",
"\n",
"That's already about it! Of course, there is a lot more - but everything else is mostly underneath the surface and will most likely not bother the average user directly. "
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly\n",
"plotly.offline.init_notebook_mode()\n",
"\n",
"import buildamol as bam"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Resources\n",
"\n",
"BuildAMol includes the _PDBE_ component library for small molecules (or at least a pretty large part of it). Since this is quite large, BuildAMol will not by default load any data, but offers a buch of functions for the user to load what they are interested in using selectively. We can also set defaults that are always loaded if we want to re-use our own custom builds in different sessions. \n",
"\n",
"Available pre-loadable sets are:\n",
"\n",
"```python\n",
"# to load the amino acid and derivative compounds\n",
"bam.load_amino_acids()\n",
"\n",
"# to load nucleotide and derivative compounds\n",
"bam.load_nucleic_acids()\n",
"\n",
"# to load sugar and derivative compounds\n",
"bam.load_sugars()\n",
"\n",
"# to load miscallaneous small molecules of less than 40 atoms\n",
"bam.load_small_molecules()\n",
"```"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Molecules\n",
"\n",
"Molecules are the essential data unit in BuildAMol. Each Molecule houses atoms that form a molecular structure. We can generate Molecules from:\n",
"- a PDB or CIF file (e.g. \"my_structure.pdb\")\n",
"- a PDB ID (e.g. \"GLC\" - the PDB id for alpha-D-glucose)\n",
"- a trivial name (e.g. \"triacetamide\")\n",
"- a chemical formula (e.g. \"C2H6O\" - caution, may produce ambiguities!)\n",
"- SMILES and InChI/InChIKey\n",
"- ... and more\n",
"\n",
"\n",
"The `Molecule` class has classmethods for all of these named `from_pdb`, `from_compound` (for PDB ID, name etc.), `from_pubchem` and so forth. But there also exists the toplevel `molecule` function that will try to automatically figure out the user input and generate a molecule for you."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"customdata": [
[
"N",
1,
1,
"SER",
"A"
]
],
"hovertemplate": "atom_element=N
x=%{x}
y=%{y}
z=%{z}
__marker_size=%{marker.size}
atom_id=%{customdata[0]}
atom_serial=%{customdata[1]}
residue_serial=%{customdata[2]}
residue_name=%{customdata[3]}
chain_id=%{customdata[4]}
x=%{x}
y=%{y}
z=%{z}
__marker_size=%{marker.size}
atom_id=%{customdata[0]}
atom_serial=%{customdata[1]}
residue_serial=%{customdata[2]}
residue_name=%{customdata[3]}
chain_id=%{customdata[4]}
x=%{x}
y=%{y}
z=%{z}
__marker_size=%{marker.size}
atom_id=%{customdata[0]}
atom_serial=%{customdata[1]}
residue_serial=%{customdata[2]}
residue_name=%{customdata[3]}
chain_id=%{customdata[4]}
x=%{x}
y=%{y}
z=%{z}
__marker_size=%{marker.size}
atom_id=%{customdata[0]}
atom_serial=%{customdata[1]}
residue_serial=%{customdata[2]}
residue_name=%{customdata[3]}
chain_id=%{customdata[4]}
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.
3Dmol.js failed to load for some reason. Please check your browser console for error messages.