<jupyter_start><jupyter_text>Before you turn this problem in, make sure everything runs as expected. First, **restart the kernel** (in the menubar, select Kernel$\rightarrow$Restart) and then **run all cells** (in the menubar, select Cell$\rightarrow$Run All).Make sure you fill in any place that says `YOUR CODE HERE` or "YOUR ANSWER HERE", as well as your name and collaborators below:<jupyter_code>NAME = ""
COLLABORATORS = ""<jupyter_output><empty_output><jupyter_text>--- *This notebook contains material from [PyRosetta](https://RosettaCommons.github.io/PyRosetta.notebooks);content is available [on Github](https://github.com/RosettaCommons/PyRosetta.notebooks.git).*   Setting up a membrane protein in the bilayerKeywords: membrane, bilayer, AddMembraneMover, OCTOPUS  Getting Started: Setting up the protein in the lipid bilayerTo start modeling membrane proteins, we must place the protein in the lipid bilayer. This begs an important question: how should the protein be oriented? The orientation of a protein in the bilayer is driven by a number of biophysical factors, such as burying nonpolar side chains in the hydrophobic membrane. For RosettaMP, there are three ways to choose the initial orientation. The choice is up to you, and often depends on how much information you have about your protein beforehand.<jupyter_code># Notebook setup
import sys
if 'google.colab' in sys.modules:
    !pip install pyrosettacolabsetup
    import pyrosettacolabsetup
    pyrosettacolabsetup.mount_pyrosetta_install()
    print ("Notebook is set for PyRosetta use in Colab.  Have fun!")
from pyrosetta import *
pyrosetta.init()<jupyter_output><empty_output><jupyter_text>Make sure you are in the right directory for accessing the `.pdb` files:`cd google_drive/My\ Drive/student-notebooks/`<jupyter_code>#cd google_drive/My\ Drive/student-notebooks/<jupyter_output><empty_output><jupyter_text>Option 1: Download a pre-transformed PDB from the OPM database<jupyter_code>from pyrosetta.toolbox import cleanATOM
cleanATOM("inputs/1afo.pdb")
pose = pose_from_pdb("inputs/1afo.clean.pdb")<jupyter_output><empty_output><jupyter_text>Then, initialize RosettaMP using AddMembraneMover. In this option, the orientation is known and you can estimate the transmembrane spans from the orientation. Therefore, we tell RosettaMP to estimate the spanning topology from structure:<jupyter_code>from pyrosetta.rosetta.protocols.membrane import *
addmem = AddMembraneMover("from_structure")
addmem.apply(pose)<jupyter_output><empty_output><jupyter_text>Option 2: Estimate the transmembrane spans and use this information to choose an orientation In this option, you will need to figure out what the transmembrane spans are. For this, you can used a sequence-based server such as OCTOPUS  (http://octopus.cbr.su.se ). You will need to find the sequence of 1AFO on the PDB, copy/paste the sequence of one of the chains into OCTOPUS, and then save the output as a text file. Then, you will need to convert the output from OCTOPUS to the Rosetta format using the `octopus2memb` script.  Next, initialize RosettaMP with AddMembraneMover. Here, instead of specifying “from_structure”, you will specify the path to your spanning topology file:<jupyter_code>from pyrosetta.rosetta.protocols.membrane import *
if not os.getenv("DEBUG"):
    addmem = AddMembraneMover("inputs/1afo.span")
    addmem.apply(pose)<jupyter_output><empty_output><jupyter_text>Key Concepts for the membrane representation1.	AddMembraneMover adds an additional residue to the protein called the Membrane residue. It is not a physical residue, but it contains information about the membrane. Note that AddMembraneMover attaches the MEM residue to the protein in Rosetta’s representation, but it does not physically exist as a residue. This is a special kind of connection called a “jump edge” whereas connections between the actual residues like are called “peptide edges” (more on that in the fold tree section). 2.	The spanning information is stored in a SpanningTopology object Let’s check some information about our current pose:		print(pose.conformation())	print(pose.conformation().membrane_info())pose.conformation() shows information about all residues in the pose, fold_tree() shows information about the Edges of the FoldTree, and membrane_info() shows information about the membrane residue.<jupyter_code>if not os.getenv("DEBUG"):
    # YOUR CODE HERE
    raise NotImplementedError()<jupyter_output><empty_output><jupyter_text>**Questions:**How many residues compose 1AFO? ___Which residue is the Membrane residue? ___How many transmembrane spans does membrane_info() say there are?   Fold TreeUnderstanding the fold tree is necessary to use movers that move parts of the protein with respect to other parts of the protein. For example, TiltMover requires a jump number and tilts the section after the jump number by a specified amount. SpinAroundPartnerMover spins one partner with respect to another, which also requires a jump number. We will explain the terminology shortly! Enter this code in the Python command line:`print(pose.conformation().fold_tree())`<jupyter_code>if not os.getenv("DEBUG"):
    # YOUR CODE HERE
    raise NotImplementedError()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06732786572572955, 'fraction_numerical': 0.0019073049780659929, 'mean_word_length': 5.854901960784313, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '110756', 'license': 'MIT', 'n_tokens_mistral': 1544, 'n_tokens_neox': 1418, 'n_words': 613, 'path': 'student-notebooks/15.01-Accounting-for-the-lipid-bilayer.ipynb', 'repo_name': 'wrbl96/pyRosetta', 'size': '5243'}