pyrosetta学习详记

2023-12-01 06:36
文章标签 学习 pyrosetta 详记

本文主要是介绍pyrosetta学习详记,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

1.Packing and Relax
Packing:优化侧链
TaskFactories:控制需要优化的残基
2.导入一些工具包:

#Python
from pyrosetta import *
from pyrosetta.rosetta import *
from pyrosetta.teaching import *#Core Includes
from rosetta.core.kinematics import MoveMap
from rosetta.core.kinematics import FoldTree
from rosetta.core.pack.task import TaskFactory
from rosetta.core.pack.task import operation
from rosetta.core.simple_metrics import metrics
from rosetta.core.select import residue_selector as selections
from rosetta.core import select
from rosetta.core.select.movemap import *#Protocol Includes
from rosetta.protocols import minimization_packing as pack_min
from rosetta.protocols import relax as rel
from rosetta.protocols.antibody.residue_selector import CDRResidueSelector
from rosetta.protocols.antibody import *
from rosetta.protocols.loops import *
from rosetta.protocols.relax import FastRelax

3.初始化
(1)为了加快演示速度,将松弛轮数由默认的5改为2(原文作者说在代码中修改有点难,我问号脸???)
(2)演示者根据他们的实验,为了增加可用于Packing的rotamer,加入-ex1 和 -ex2,但是这会降低运算速度
初始化代码:

init('-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \-ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 2 -no_fconfig')

4.Import and copy pose
克隆一份初始的蛋白位置?

#Import a pose
pose = pose_from_pdb("inputs/2r0l_1_1.pdb")
original_pose = pose.clone()

5.Setup a Normal TaskFactory
TaskFactory:control packing specific residues in a pose \colorbox{yellow}{TaskFactory:control packing specific residues in a pose} TaskFactory:control packing specific residues in a pose
The TaskFactory is made up of a list of TaskOperations. These Taskops make up the bread and butter of controlling packing (and subsequently design). The taskops can be given to factory in any order. \colorbox{cyan}{The TaskFactory is made up of a list of TaskOperations. These Taskops make up the bread and butter of controlling packing (and subsequently design). The taskops can be given to factory in any order.} The TaskFactory is made up of a list of TaskOperations. These Taskops make up the bread and butter of controlling packing (and subsequently design). The taskops can be given to factory in any order.
In Rosetta, ALL residues are set to both pack AND design by default. We use taskops to turn things off, like creating an ice sculpture. Here, we turn design off by using the RestrictToRepacking operation. \colorbox{cyan}{In Rosetta, ALL residues are set to both pack AND design by default. We use taskops to turn things off, like creating an ice sculpture. Here, we turn design off by using the RestrictToRepacking operation.} In Rosetta, ALL residues are set to both pack AND design by default. We use taskops to turn things off, like creating an ice sculpture. Here, we turn design off by using the RestrictToRepacking operation.

tf = TaskFactory()
tf.push_back(operation.InitializeFromCommandline())
tf.push_back(operation.RestrictToRepacking())

6.Setup The Packer
关键词:
(1)setup the packer and pass the TaskFactory
(2)PackerTask(has all of the instructions needed for Rosetta to do packing and design)

packer = pack_min.PackRotamersMover()
packer.task_factory(tf)#Note that we are not passing a scorefunction here.  We will use the default, cmd-line scorefunction, 
# which is accessed through rosetta.core.scoring.get_score_function() and part of the packer.  We use use a scorefunction later. #Run the packer. (Note this may take a few minutes)
#Skip for tests
if not os.getenv("DEBUG"):packer.apply(pose)#Dump the PDB
pose.dump_pdb('/outputs/2r0l_all_repack.pdb')

7.Lets compare the energies of the before and after pose. Any difference?

scorefxn = get_score_function()
before = scorefxn.score(original_pose)

8.检查操作过后的序列和原始序列,确保前后序列一致,也就是只对这些残基rotamers进行Packing

### BEGIN SOLUTIONseq_metric = metrics.SequenceMetric()print("Sequence:")
print(seq_metric.calculate(pose))#OR
print("\nSequence:")
print(pose.sequence())### END SOLUTION

9.Regional Packing
关键词:
(1)a single CDR loop(什么是CDR)
(2)ResidueSelector?

10.Make selection using the CDRResidueSelector and NeighborhoodResidueSelector
关键词:PackerTask

nbr_selector = selections.NeighborhoodResidueSelector()
cdr_selector = CDRResidueSelector()
cdr_selector.set_cdr(h1)
nbr_selector.set_focus_selector(cdr_selector)
nbr_selector.set_include_focus_in_subset(True)

11.Restrict to our selection

prevent_repacking_rlt = operation.PreventRepackingRLT()
#True indicates here that we are flipping the selection.  So that we are turning off everything but the CDR and
#  its neighbors.prevent_subset_repacking = operation.OperateOnResidueSubset(prevent_repacking_rlt, nbr_selector, True )

Lets check to see what residues have been selected as the CDR, and then the CDR and its neighbors. We will use this to make sure our PackerTask is setup properly

cdr_res = []
print("CDR")
for i in select.get_residue_set_from_subset(cdr_selector.apply(pose)):print(i)cdr_res.append(i)print("\nCDR+Neighbors")
for i in select.get_residue_set_from_subset(nbr_selector.apply(pose)):if i in cdr_res:print(i,"CDR")else:print(i)

12.Reset the pose

pose = original_pose.clone()tf.push_back(prevent_subset_repacking)pack_cdrs_and_neighbors_tf = tf.clone()packer.task_factory(tf)

Before we start, lets take a look at our PackerTask. Are we designing anything? Does this match our selection?

print(tf.create_task_and_apply_taskoperations(pose))
### BEGIN SOLUTION#Skip for tests
if not os.getenv("DEBUG"):packer.apply(pose)pose.dump_pdb("outputs/2r0l_cdr_repack.pdb")### END SOLUTION

13.Design

pose = original_pose.clone()tf.clear()
tf.push_back(operation.InitializeFromCommandline())
tf.push_back(prevent_subset_repacking)#Turn off design of neighbors
nbr_selector2 = selections.NeighborhoodResidueSelector()
nbr_selector2.set_focus_selector(cdr_selector)
nbr_selector2.set_include_focus_in_subset(False)restrict_to_repack = operation.RestrictToRepackingRLT()
prevent_nbr_design = operation.OperateOnResidueSubset(restrict_to_repack, nbr_selector2, False )
tf.push_back(prevent_nbr_design)

14.Set and Run

15.Relax

16.Regional Relax
关键词:
(1)MoveMapFactory

这篇关于pyrosetta学习详记的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/440173

相关文章

Go学习记录之runtime包深入解析

《Go学习记录之runtime包深入解析》Go语言runtime包管理运行时环境,涵盖goroutine调度、内存分配、垃圾回收、类型信息等核心功能,:本文主要介绍Go学习记录之runtime包的... 目录前言:一、runtime包内容学习1、作用:① Goroutine和并发控制:② 垃圾回收:③ 栈和

Android学习总结之Java和kotlin区别超详细分析

《Android学习总结之Java和kotlin区别超详细分析》Java和Kotlin都是用于Android开发的编程语言,它们各自具有独特的特点和优势,:本文主要介绍Android学习总结之Ja... 目录一、空安全机制真题 1:Kotlin 如何解决 Java 的 NullPointerExceptio

重新对Java的类加载器的学习方式

《重新对Java的类加载器的学习方式》:本文主要介绍重新对Java的类加载器的学习方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、介绍1.1、简介1.2、符号引用和直接引用1、符号引用2、直接引用3、符号转直接的过程2、加载流程3、类加载的分类3.1、显示

Java学习手册之Filter和Listener使用方法

《Java学习手册之Filter和Listener使用方法》:本文主要介绍Java学习手册之Filter和Listener使用方法的相关资料,Filter是一种拦截器,可以在请求到达Servl... 目录一、Filter(过滤器)1. Filter 的工作原理2. Filter 的配置与使用二、Listen

Java进阶学习之如何开启远程调式

《Java进阶学习之如何开启远程调式》Java开发中的远程调试是一项至关重要的技能,特别是在处理生产环境的问题或者协作开发时,:本文主要介绍Java进阶学习之如何开启远程调式的相关资料,需要的朋友... 目录概述Java远程调试的开启与底层原理开启Java远程调试底层原理JVM参数总结&nbsMbKKXJx

Java深度学习库DJL实现Python的NumPy方式

《Java深度学习库DJL实现Python的NumPy方式》本文介绍了DJL库的背景和基本功能,包括NDArray的创建、数学运算、数据获取和设置等,同时,还展示了如何使用NDArray进行数据预处理... 目录1 NDArray 的背景介绍1.1 架构2 JavaDJL使用2.1 安装DJL2.2 基本操

HarmonyOS学习(七)——UI(五)常用布局总结

自适应布局 1.1、线性布局(LinearLayout) 通过线性容器Row和Column实现线性布局。Column容器内的子组件按照垂直方向排列,Row组件中的子组件按照水平方向排列。 属性说明space通过space参数设置主轴上子组件的间距,达到各子组件在排列上的等间距效果alignItems设置子组件在交叉轴上的对齐方式,且在各类尺寸屏幕上表现一致,其中交叉轴为垂直时,取值为Vert

Ilya-AI分享的他在OpenAI学习到的15个提示工程技巧

Ilya(不是本人,claude AI)在社交媒体上分享了他在OpenAI学习到的15个Prompt撰写技巧。 以下是详细的内容: 提示精确化:在编写提示时,力求表达清晰准确。清楚地阐述任务需求和概念定义至关重要。例:不用"分析文本",而用"判断这段话的情感倾向:积极、消极还是中性"。 快速迭代:善于快速连续调整提示。熟练的提示工程师能够灵活地进行多轮优化。例:从"总结文章"到"用

【前端学习】AntV G6-08 深入图形与图形分组、自定义节点、节点动画(下)

【课程链接】 AntV G6:深入图形与图形分组、自定义节点、节点动画(下)_哔哩哔哩_bilibili 本章十吾老师讲解了一个复杂的自定义节点中,应该怎样去计算和绘制图形,如何给一个图形制作不间断的动画,以及在鼠标事件之后产生动画。(有点难,需要好好理解) <!DOCTYPE html><html><head><meta charset="UTF-8"><title>06

学习hash总结

2014/1/29/   最近刚开始学hash,名字很陌生,但是hash的思想却很熟悉,以前早就做过此类的题,但是不知道这就是hash思想而已,说白了hash就是一个映射,往往灵活利用数组的下标来实现算法,hash的作用:1、判重;2、统计次数;