{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks);\n", "content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Rosetta Energy Score Functions](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.00-Rosetta-Energy-Score-Functions.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Practice: Analyzing energy between residues](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.02-Analyzing-energy-between-residues.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-eeaeae18e9d996eb", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "# Score Function Basics\n", "Keywords: score function, ScoreFunction(), get_score_function(), set_weight(), show(), etable_atom_pair_energies(), Atom objects, get_hbonds(), nhbonds(), residue_hbonds()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "!pip install pyrosettacolabsetup\n", "import pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\n", "import pyrosetta; pyrosetta.init()\n", "import pyrosetta\n", "pyrosetta.init()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Make sure you are in the directory with the pdb files:**\n", "\n", "`cd google_drive/MyDrive/student-notebooks/`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this module, we will explore the PyRosetta score function interface. You will learn to inspect energies of a biomolecule at the whole protein, per-residue, and per-atom level. Finally, you will gain practice applying the energies to answering biological questions involving proteins. For these exercises, we will use the protein Ras (PDB 6q21). Either make sure you have the PDB file \"6Q21_A.pdb\" in your current directory, or if you have an Internet connection, load the pdb into a pose called `ras` with the pyrosetta.pose_from_pdb method. " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-be26a363af7b009c", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0mcore.init: \u001b[0mChecking for fconfig files in pwd and ./rosetta/flags\n", "\u001b[0mcore.init: \u001b[0mRosetta version: PyRosetta4.Release.python36.mac r208 2019.04+release.fd666910a5e fd666910a5edac957383b32b3b4c9d10020f34c1 http://www.pyrosetta.org 2019-01-22T15:55:37\n", "\u001b[0mcore.init: \u001b[0mcommand: PyRosetta -ex1 -ex2aro -database /Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/database\n", "\u001b[0mcore.init: \u001b[0m'RNG device' seed mode, using '/dev/urandom', seed=-331629677 seed_offset=0 real_seed=-331629677\n", "\u001b[0mcore.init.random: \u001b[0mRandomGenerator:init: Normal mode, seed=-331629677 RG_type=mt19937\n", "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mFinished initializing fa_standard residue type set. Created 696 residue types\n", "\u001b[0mcore.chemical.GlobalResidueTypeSet: \u001b[0mTotal time to initialize 1.22777 seconds.\n", "\u001b[0mcore.import_pose.import_pose: \u001b[0mFile '6Q21_A.pdb' automatically determined to be of type PDB\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "ras = pyrosetta.pose_from_pdb(\"inputs/6Q21_A.pdb\")\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-ed57c5745ba69a27", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "To score a protein, you will begin by defining a score function using the `get_score_function(is_fullatom: bool)` method in the `pyrosetta.teaching` namespace. Specifying `True` will return the default `ref2015` all-atom energy function, while `False` will specify the default centroid score function.\n", "\n", "Create a PyRosetta score function using:\n", "```\n", "sfxn = get_score_function(True)\n", "```" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-a8401defb7b4a814", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0mcore.scoring.ScoreFunctionFactory: \u001b[0mSCOREFUNCTION: \u001b[32mref2015\u001b[0m\n", "\u001b[0mcore.scoring.etable: \u001b[0mStarting energy table calculation\n", "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: changing atr/rep split to bottom of energy well\n", "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing lj etables (maxdis = 6)\n", "\u001b[0mcore.scoring.etable: \u001b[0msmooth_etable: spline smoothing solvation etables (max_dis = 6)\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/teaching.py:13: UserWarning: Import of 'rosetta' as a top-level module is deprecated and may be removed in 2018, import via 'pyrosetta.rosetta'.\n", " from rosetta.core.scoring import *\n" ] }, { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0mcore.scoring.etable: \u001b[0mFinished calculating energy tables.\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBPoly1D.csv\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBFadeIntervals.csv\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/HBEval.csv\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/DonStrength.csv\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/hbonds/ref2015_params/AccStrength.csv\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/all.ramaProb\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/rama/fd/prepro.ramaProb\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.all.txt\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.gly.txt\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.pro.txt\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/omega/omega_ppdep.valile.txt\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/P_AA_n\n", "\u001b[0mcore.scoring.P_AA: \u001b[0mshapovalov_lib::shap_p_aa_pp_smooth_level of 1( aka low_smooth ) got activated.\n", "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/P_AA_pp/shapovalov/10deg/kappa131/a20.prop\n" ] } ], "source": [ "from pyrosetta.teaching import *\n", "\n", "### BEGIN SOLUTION\n", "sfxn = get_score_function(True)\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-67b6769efaa385af", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "You can see the terms, weights, and energy method options by printing the score function:\n", "\n", "```\n", "print(sfxn)\n", "```" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-d9875a1b051c6971", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "ScoreFunction::show():\n", "weights: (fa_atr 1) (fa_rep 0.55) (fa_sol 1) (fa_intra_rep 0.005) (fa_intra_sol_xover4 1) (lk_ball_wtd 1) (fa_elec 1) (pro_close 1.25) (hbond_sr_bb 1) (hbond_lr_bb 1) (hbond_bb_sc 1) (hbond_sc 1) (dslf_fa13 1.25) (omega 0.4) (fa_dun 0.7) (p_aa_pp 0.6) (yhh_planarity 0.625) (ref 1) (rama_prepro 0.45)\n", "energy_method_options: EnergyMethodOptions::show: aa_composition_setup_files: \n", "EnergyMethodOptions::show: mhc_epitope_setup_files: \n", "EnergyMethodOptions::show: netcharge_setup_files: \n", "EnergyMethodOptions::show: aspartimide_penalty_value: 25\n", "EnergyMethodOptions::show: etable_type: FA_STANDARD_DEFAULT\n", "analytic_etable_evaluation: 1\n", "EnergyMethodOptions::show: method_weights: ref 1.32468 3.25479 -2.14574 -2.72453 1.21829 0.79816 -0.30065 2.30374 -0.71458 1.66147 1.65735 -1.34026 -1.64321 -1.45095 -0.09474 -0.28969 1.15175 2.64269 2.26099 0.58223\n", "EnergyMethodOptions::show: method_weights: free_res\n", "EnergyMethodOptions::show: unfolded_energies_type: UNFOLDED_SCORE12\n", "EnergyMethodOptions::show: split_unfolded_label_type: SPLIT_UNFOLDED_MM\n", "EnergyMethodOptions::show: split_unfolded_value_type: SPLIT_UNFOLDED_BOLTZ\n", "EnergyMethodOptions::show: atom_vdw_atom_type_set_name: centroid\n", "EnergyMethodOptions::show: exclude_protein_protein_fa_elec: false\n", "EnergyMethodOptions::show: exclude_RNA_RNA_fa_elec: false\n", "EnergyMethodOptions::show: exclude_RNA_protein_fa_elec: false\n", "EnergyMethodOptions::show: exclude_monomer_fa_elec: false\n", "EnergyMethodOptions::show: elec_max_dis: 5.5\n", "EnergyMethodOptions::show: elec_min_dis: 1.6\n", "EnergyMethodOptions::show: elec_die: 10\n", "EnergyMethodOptions::show: elec_no_dis_dep_die: false\n", "EnergyMethodOptions::show: elec_sigmoidal_die: true\n", "EnergyMethodOptions::show: elec_sigmoidal_D: 80\n", "EnergyMethodOptions::show: elec_sigmoidal_D0: 6\n", "EnergyMethodOptions::show: elec_sigmoidal_S: 0.4\n", "EnergyMethodOptions::show: smooth_fa_elec: true\n", "EnergyMethodOptions::show: grpelec_fade_type: false\n", "EnergyMethodOptions::show: grpelec_fade_param1: 1\n", "EnergyMethodOptions::show: grpelec_fade_param2: 1\n", "EnergyMethodOptions::show: grpelec_fade_hbond: 0\n", "EnergyMethodOptions::show: grp_cpfxn: 1\n", "EnergyMethodOptions::show: elec_group_file: /scoring/score_functions/elec_group_def.dat\n", "EnergyMethodOptions::show: grpelec_context_dependent: 0\n", "EnergyMethodOptions::show: use_polarization: true\n", "EnergyMethodOptions::show: use_gen_kirkwood: true\n", "EnergyMethodOptions::show: protein_dielectric: 1\n", "EnergyMethodOptions::show: water_dielectric: 78.3\n", "EnergyMethodOptions::show: exclude_DNA_DNA: true\n", "EnergyMethodOptions::show: exclude_intra_res_protein: false\n", "EnergyMethodOptions::show: count_pair_hybrid: false\n", "EnergyMethodOptions::show: put_intra_into_total: false\n", "EnergyMethodOptions::show: geom_sol_interres_path_distance_cutoff: false\n", "EnergyMethodOptions::show: geom_sol_intrares_path_distance_cutoff: true\n", "EnergyMethodOptions::show: eval_intrares_elec_ST_only: false\n", "EnergyMethodOptions::show: envsmooth_zero_negatives: false\n", "EnergyMethodOptions::show: cst_max_seq_sep: 18446744073709551615\n", "EnergyMethodOptions::show: pb_bound_tag: bound\n", "EnergyMethodOptions::show: pb_unbound_tag: unbound\n", "EnergyMethodOptions::show: ordered_wat_penalty: 1.221\n", "EnergyMethodOptions::show: ordered_pt_wat_penalty: 2.709\n", "EnergyMethodOptions::show: voids_penalty_energy_containing_cones_cutoff_:6\n", "EnergyMethodOptions::show: voids_penalty_energy_cone_distance_cutoff_: 8\n", "EnergyMethodOptions::show: voids_penalty_energy_cone_dotproduct_cutoff_: 0.1\n", "EnergyMethodOptions::show: voids_penalty_energy_voxel_grid_padding_: 1\n", "EnergyMethodOptions::show: voids_penalty_energy_voxel_size_: 0.5\n", "EnergyMethodOptions::show: voids_penalty_energy_disabled_except_during_packing_: TRUE\n", "EnergyMethodOptions::show: hbnet_bonus_ramping_function_: \"quadratic\"\n", "EnergyMethodOptions::show: hbnet_max_network_size_: 0\n", "EnergyMethodOptions::show: approximate_buried_unsat_penalty_hbond_energy_threshold_: -0.25\n", "EnergyMethodOptions::show: approximate_buried_unsat_penalty_burial_atomic_depth_: 4.5\n", "EnergyMethodOptions::show: approximate_buried_unsat_penalty_burial_probe_radius_: 2.3\n", "EnergyMethodOptions::show: approximate_buried_unsat_penalty_burial_resolution_: 0.5\n", "EnergyMethodOptions::show: approximate_buried_unsat_penalty_oversat_penalty_: 1\n", "EnergyMethodOptions::show: approximate_buried_unsat_penalty_assume_const_backbone_:1\n", "EnergyMethodOptions::show: bond_angle_central_atoms_to_score:\n", "EnergyMethodOptions::show: bond_angle_residue_type_param_set: none\n", "HBondOptions::show: exclude_DNA_DNA: true\n", "HBondOptions::show: exclude_intra_res_protein_: false\n", "HBondOptions::show: exclude_intra_res_RNA_: false\n", "HBondOptions::show: put_intra_into_total_: false\n", "HBondOptions::show: exclude_self_hbonds: true\n", "HBondOptions::show: use_hb_env_dep: false\n", "HBondOptions::show: use_hb_env_dep_DNA: true\n", "HBondOptions::show: smooth_hb_env_dep: true\n", "HBondOptions::show: bb_donor_acceptor_check: true\n", "HBondOptions::show: decompose_bb_hb_into_pair_energies: false\n", "HBondOptions::show: params_database_tag_: ref2015_params\n", "HBondOptions::show: use_sp2_chi_penalty_: true\n", "HBondOptions::show: sp2_BAH180_rise_: 0.75\n", "HBondOptions::show: sp2_outer_width_: 0.357\n", "HBondOptions::show: measure_sp3acc_BAH_from_hvy_: true\n", "HBondOptions::show: fade_energy_: 1\n", "HBondOptions::show: exclude_ether_oxygens_: 0\n", "HBondOptions::show: Mbhbond: false \n", "HbondOptions::show: mphbond: false\n", "HBondOptions::show: hbond_energy_shift: 0\n", "HBondOptions::show: water_hybrid_sf: false\n", "RNA_EnergyMethodOptions::show: syn_G_potential_bonus: 0\n", "RNA_EnergyMethodOptions::show: torsion_potential: ps_04282011\n", "RNA_EnergyMethodOptions::show: suiteness_bonus: Richardson\n", "RNA_EnergyMethodOptions::show: rna_base_pair_xy_filename: scoring/rna/rna_base_pair_xy.dat\n", "FreeDOF_Options::show: free_suite_bonus: -1\n", "FreeDOF_Options::show: free_2HOprime_bonus: -0.5\n", "FreeDOF_Options::show: free_sugar_bonus: -1\n", "FreeDOF_Options::show: pack_phosphate_penalty: 0.25\n", "FreeDOF_Options::show: free_side_chain_bonus: -0.5\n", "\n", "\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "print(sfxn)\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-5714b7bc994c3fe3", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "## Practice: List the terms in the energy function and their relative weights\n", "\n", "**Hint:** look at the top line that starts with 'weights'" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-22ba33466d6eb287", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "## Your Response Here\n", "\n", "### BEGIN SOLUTION\n", "\n", "# (fa_atr 1) (fa_rep 0.55) (fa_sol 1) (fa_intra_rep 0.005)\n", "# (fa_intra_sol_xover4 1) (lk_ball_wtd 1) (fa_elec 1)\n", "# (pro_close 1.25) (hbond_sr_bb 1) (hbond_lr_bb 1)\n", "# (hbond_bb_sc 1) (hbond_sc 1) (dslf_fa13 1.25) (omega 0.4)\n", "# (fa_dun 0.7) (p_aa_pp 0.6) (yhh_planarity 0.625) (ref 1)\n", "# (rama_prepro 0.45)\n", "\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Custom energy functions" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-9c06a7c877210a94", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "You can also create a custom energy function that includes select terms. Typically, creating a whole new score function is unneccesary because the current one works well in most cases. However, tweaking the current enrgy function by reassigning weights and adding certain energy terms can be useful.\n", "\n", "Here, we will make an example energy function with only the van der Waals attractive and repulsive terms, both with weights of 1. We need to use the `set_weight()`. Make a new `ScoreFunction` and set the weights accordingly. This is how we set the full-atom attractive (`fa_atr`) and the full-atom repulsive (`fa_rep`) terms.\n", "\n", "```\n", "sfxn2 = ScoreFunction()\n", "sfxn2.set_weight(fa_atr, 1.0)\n", "sfxn2.set_weight(fa_rep, 1.0)\n", "```" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-c4c5c8d7de03487d", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [], "source": [ "### BEGIN SOLUTION\n", "sfxn2 = ScoreFunction()\n", "sfxn2.set_weight(fa_atr, 1.0)\n", "sfxn2.set_weight(fa_rep, 1.0)\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-951446e04ce45937", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "Lets compare the score of `ras` using the full-atom `ScoreFunction` versus the `ScoreFunction` we made above using only the attractive and repulsive terms.\n", "\n", "First, print the total energy of `ras` using `print(sfxn(ras))`\n", "Then, print the attractive and repulsive energy only of `ras` using `print(sfxn2(ras))`" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-7013e0c60ab37e65", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0mbasic.io.database: \u001b[0mDatabase file opened: scoring/score_functions/elec_cp_reps.dat\n", "\u001b[0mcore.scoring.elec.util: \u001b[0mRead 40 countpair representative atoms\n", "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib_fixes_enable option is true.\n", "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mshapovalov_lib::shap_dun10_smooth_level of 1( aka lowest_smooth ) got activated.\n", "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mBinary rotamer library selected: /Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin\n", "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mUsing Dunbrack library binary file '/Users/kathyle/Computational Protein Prediction and Design/PyRosetta4.Release.python36.mac.release-208/pyrosetta/database/rotamer/shapovalov/StpDwn_0-0-0/Dunbrack10.lib.bin'.\n", "\u001b[0mcore.pack.dunbrack.RotamerLibrary: \u001b[0mDunbrack 2010 library took 0.450999 seconds to load from binary\n", "1215.729069796814\n", "154.59159174026854\n" ] } ], "source": [ "# print total energy of ras\n", "### BEGIN SOLUTION\n", "print(sfxn(ras))\n", "### END SOLUTION\n", "\n", "# print the attractive and repulsive energy of ras\n", "### BEGIN SOLUTION\n", "print(sfxn2(ras))\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Energy Breakdown" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-952b996905b5bfc0", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "Using the full-atom `ScoreFunction` `sfxn`, break the energy of `ras` down into its individual pieces with the `sfxn.show(ras)` method. Which are the three most dominant contributions, and what are their values? Is this what you would have expected? Why? Note which terms are positive and negative" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-1985d733350b2c83", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0mcore.scoring: \u001b[0m\n", "------------------------------------------------------------\n", " Scores Weight Raw Score Wghtd.Score\n", "------------------------------------------------------------\n", " fa_atr 1.000 -1039.246 -1039.246\n", " fa_rep 0.550 1193.837 656.611\n", " fa_sol 1.000 682.582 682.582\n", " fa_intra_rep 0.005 700.419 3.502\n", " fa_intra_sol_xover4 1.000 46.564 46.564\n", " lk_ball_wtd 1.000 -14.597 -14.597\n", " fa_elec 1.000 -195.387 -195.387\n", " pro_close 1.250 97.210 121.513\n", " hbond_sr_bb 1.000 -41.656 -41.656\n", " hbond_lr_bb 1.000 -28.352 -28.352\n", " hbond_bb_sc 1.000 -13.111 -13.111\n", " hbond_sc 1.000 -7.771 -7.771\n", " dslf_fa13 1.250 0.000 0.000\n", " omega 0.400 41.525 16.610\n", " fa_dun 0.700 1296.642 907.650\n", " p_aa_pp 0.600 -25.496 -15.298\n", " yhh_planarity 0.625 0.000 0.000\n", " ref 1.000 47.114 47.114\n", " rama_prepro 0.450 197.781 89.002\n", "---------------------------------------------------\n", " Total weighted score: 1215.729\n" ] } ], "source": [ "# use the sfxn.show() method\n", "### BEGIN SOLUTION\n", "sfxn.show(ras)\n", "### END SOLUTION" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "code_folding": [], "nbgrader": { "grade": false, "grade_id": "cell-4ad3a4c661b9a763", "locked": true, "schema_version": 3, "solution": false } }, "outputs": [], "source": [ "# Your response here: what are the three most dominant contributions?" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-dfa8632eb3d02079", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "Unweighted, individual component energies of each residue in a structure are stored in the `Pose` object and can be accessed by the `energies()` method. For example, to break down the energy into each residue's contribution, we use: \n", "```\n", "print(ras.energies().show())\n", "```\n", "Where `` is the residue number.\n", "\n", "What are the total van der Waals, solvation, and hydrogen-bonding contributions of residue 24?\n", "\n", "Note: The _backbone_ hydrogen-bonding terms for each residue are not available from the `Energies` object. You can get them by using EnergyMethodOptions. See http://www.pyrosetta.org/documentation#TOC-Hydrogen-Bonds-and-Hydrogen-Bond-Scoring." ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-cd5175f1ed3fd0ad", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[0mcore.scoring.Energies: \u001b[0mE fa_atr fa_rep fa_sol fa_intra_repfa_intra_sol_x lk_ball_wtd fa_elec pro_close hbond_sr_bb hbond_lr_bb hbond_bb_sc hbond_sc dslf_fa13 omega fa_dun p_aa_pp yhh_planarity ref rama_prepro\n", "\u001b[0mcore.scoring.Energies: \u001b[0mE(i) 24 -7.40 19.03 2.94 8.76 0.09 -0.11 -0.56 0.00 0.00 0.00 0.00 0.00 0.00 0.12 2.68 0.06 0.00 2.30 3.58\n", "None\n" ] } ], "source": [ "### BEGIN SOLUTION\n", "print(ras.energies().show(24))\n", "### END SOLUTION" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-910b1116d1d0becf", "locked": true, "schema_version": 3, "solution": false } }, "outputs": [], "source": [ "# your response here" ] }, { "cell_type": "markdown", "metadata": { "nbgrader": { "grade": false, "grade_id": "cell-4832aeb37f36c0c6", "locked": true, "schema_version": 3, "solution": false } }, "source": [ "The van der Waals, solvation, and electrostatic terms are atom-atom pairwise energies calculated from a pre-tabulated lookup table, dependent upon the distance between the two atoms and their types. You can access this lookup table, called the `etable` directly to check these energy calculations on an atom-by-atom basis. Use the `etable_atom_pair_energies` function which returns a triplet of energies for attractive, repulsive and solvation scores.\n", "\n", "(Note that the `etable_atom_pair_energies()` function requires `Atom` objects, not the `AtomID` objects we saw in Workshop #2. For more info, look at the [documentation](https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.toolbox.atom_pair_energy.html?highlight=etable_atom_pair_energies#pyrosetta.toolbox.atom_pair_energy.etable_atom_pair_energies).)\n", "\n", "**Practice:** What are the attractive, repulsive, solvation, and electrostatic components between the nitrogen of residue 24 and the oxygen of residue 20? \n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "nbgrader": { "grade": true, "grade_id": "cell-7ce1bc99f2fd0b00", "locked": false, "points": 0, "schema_version": 3, "solution": true } }, "outputs": [ { "data": { "text/plain": [ "(-0.1505855046001568, 0.0, 0.5903452111877215, 2.173111777247698)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "### BEGIN SOLUTION\n", "res24 = ras.residue(24)\n", "res20 = ras.residue(20)\n", "res24_atomN = res24.atom_index(\"N\")\n", "res20_atomO = res20.atom_index(\"O\")\n", "pyrosetta.etable_atom_pair_energies(res24, res24_atomN, res20, res20_atomO, sfxn)\n", "### END SOLUTION" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Rosetta Energy Score Functions](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.00-Rosetta-Energy-Score-Functions.ipynb) | [Contents](toc.ipynb) | [Index](index.ipynb) | [Practice: Analyzing energy between residues](http://nbviewer.jupyter.org/github/RosettaCommons/PyRosetta.notebooks/blob/master/notebooks/03.02-Analyzing-energy-between-residues.ipynb) >

\"Open" ] } ], "metadata": { "celltoolbar": "Create Assignment", "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.6.0" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": { "height": "503.333px", "left": "207px", "top": "151.722px", "width": "254.167px" }, "toc_section_display": true, "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 2 }