-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdb.json
More file actions
1 lines (1 loc) · 486 KB
/
db.json
File metadata and controls
1 lines (1 loc) · 486 KB
1
{"meta":{"version":1,"warehouse":"5.0.1"},"models":{"Asset":[{"_id":"themes/ayer/source/404.html","path":"404.html","modified":0,"renderable":1},{"_id":"themes/ayer/source/favicon.#ico","path":"favicon.#ico","modified":0,"renderable":1},{"_id":"themes/ayer/source/favicon.ico","path":"favicon.ico","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/clipboard.styl","path":"css/clipboard.styl","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/custom.styl","path":"css/custom.styl","modified":0,"renderable":1},{"_id":"themes/ayer/source/dist/main.css","path":"dist/main.css","modified":0,"renderable":1},{"_id":"themes/ayer/source/dist/main.js","path":"dist/main.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/404.jpg","path":"images/404.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/alipay.jpg","path":"images/alipay.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/ayer.png","path":"images/ayer.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/ayer-side.svg","path":"images/ayer-side.svg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/ayer.svg","path":"images/ayer.svg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/beian.png","path":"images/beian.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover1.jpg","path":"images/cover1.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover2.jpg","path":"images/cover2.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover3.jpg","path":"images/cover3.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover4.jpg","path":"images/cover4.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover5.jpg","path":"images/cover5.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover6.jpg","path":"images/cover6.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover7.jpg","path":"images/cover7.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/cover8.jpeg","path":"images/cover8.jpeg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/forkme.png","path":"images/forkme.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/gitee.png","path":"images/gitee.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/github.png","path":"images/github.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/hexo-tag-chart.png","path":"images/hexo-tag-chart.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/hexo.png","path":"images/hexo.png","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/logo.svg","path":"images/logo.svg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/logo1.svg","path":"images/logo1.svg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/mouse.cur","path":"images/mouse.cur","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/sponsor.jpg","path":"images/sponsor.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/images/wechat.jpg","path":"images/wechat.jpg","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/busuanzi-2.3.pure.min.js","path":"js/busuanzi-2.3.pure.min.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/clickBoom1.js","path":"js/clickBoom1.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/clickBoom2.js","path":"js/clickBoom2.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/dz.js","path":"js/dz.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/jquery-3.6.0.min.js","path":"js/jquery-3.6.0.min.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/clickLove.js","path":"js/clickLove.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/lazyload.min.js","path":"js/lazyload.min.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/search.js","path":"js/search.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/js/tocbot.min.js","path":"js/tocbot.min.js","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/fonts/remixicon.css","path":"css/fonts/remixicon.css","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/fonts/remixicon.eot","path":"css/fonts/remixicon.eot","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/fonts/remixicon.svg","path":"css/fonts/remixicon.svg","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/fonts/remixicon.ttf","path":"css/fonts/remixicon.ttf","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/fonts/remixicon.woff","path":"css/fonts/remixicon.woff","modified":0,"renderable":1},{"_id":"themes/ayer/source/css/fonts/remixicon.woff2","path":"css/fonts/remixicon.woff2","modified":0,"renderable":1}],"Cache":[{"_id":"source/categories/index.md","hash":"c823ed3eaa092ed1d9df08315571e8eac6653f5f","modified":1706425412160},{"_id":"source/_posts/Note-on-hexo-module-hexo-asset-image.md","hash":"901a5da22c5d067a05d9d327b71f38c9c8739988","modified":1706457437138},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1.md","hash":"ee985c53f2227d9e6ec3ba25bc7ea5eec5a58973","modified":1708061444640},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2.md","hash":"8857a3bd993ee5bb8d38c5781f5e38d0cc9c0a58","modified":1706952341592},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-3.md","hash":"5dc9f3d54b270da96235179c53e532d96b68bc35","modified":1708060158874},{"_id":"source/tags/index.md","hash":"4767c7493033a7d163a4e9a71395c985779c5c05","modified":1708060832187},{"_id":"source/friends/index.md","hash":"32c89d3acfa352bcc517802f544be4789d89bb26","modified":1706425420551},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1/image1.jpg","hash":"7aaf3634dff1307994d7adb40f9164ac0a9137c5","modified":315504000000},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1/image3.png","hash":"3edec46b001637d60179428a9c5a40c7a5276fa5","modified":315504000000},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2/filters.svg","hash":"cf643da287bf7b3f37b5ac0017473455f836930d","modified":1706952331373},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2/midband ommatidia.svg","hash":"237c037ad0a6935973093bb7bd9859c379ae5f38","modified":1706952331373},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2/ommatidia1.svg","hash":"f1de3f13ed1991355a5a6416d1732ee70aec79ba","modified":1706952331372},{"_id":"source/_posts/hello-world.md","hash":"acad91ace80b80295b11a9b7ad4c29a2dcfdd8fb","modified":1705824428080},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1/image2.png","hash":"ff4763739573afcfa96cb0fdf3d2bde2c53f6c3d","modified":315504000000},{"_id":"themes/ayer/.gitattributes","hash":"2e08e93c6f6790b02ab7f81a6191ed097b20cbf9","modified":1705839988509},{"_id":"themes/ayer/.npmignore","hash":"13239db7290ce1d6dfc62fb60191a8048c6e5781","modified":1705839988515},{"_id":"themes/ayer/.gitignore","hash":"8faed9be54528620a8da662ad9f242e7305d6757","modified":1705839988514},{"_id":"themes/ayer/.travis.yml","hash":"870fcd9eb33bc4269d53bc84ddc6f8a69db7c611","modified":1705839988516},{"_id":"themes/ayer/.stylintrc","hash":"eec4e824067be1a223745ca426aa367c8d482673","modified":1705839988515},{"_id":"themes/ayer/_config.yml","hash":"203948904b505414b5647da71cbc084b28a7fbc1","modified":1706965855919},{"_id":"themes/ayer/move_config.js","hash":"9fde64d58714990bf93ba877bbc3b48f6b8fb7d9","modified":1705839988552},{"_id":"themes/ayer/LICENSE","hash":"d7308ddbd63bf372429401e188a906c52622f62e","modified":1705839988516},{"_id":"themes/ayer/package.json","hash":"f171e4375353a66c8b609b3bc8aece58e8b7cd01","modified":1705839988553},{"_id":"themes/ayer/README.md","hash":"df98c8af4a4412483800a8f945e62ece4caa074c","modified":1705839988517},{"_id":"themes/ayer/index.js","hash":"a144d64baec7130267f64272fb256a9be3aa7cd5","modified":1705839988518},{"_id":"themes/ayer/layout/categories.ejs","hash":"b2deae0c31dd7fbf42a124db1b4c8c28d435c8e5","modified":1705839988547},{"_id":"themes/ayer/rollup.config.js","hash":"3d98bd1db1dcf2e0878b6fcbbbf8ff9c3da6d357","modified":1705839988554},{"_id":"themes/ayer/logo.png","hash":"16fbb131601570b21890a922cd6e596691ccff42","modified":1705839988551},{"_id":"themes/ayer/.github/config.yml","hash":"d786334df2ea7feca64d07e573055c3452843f8a","modified":1705839988513},{"_id":"themes/ayer/layout/friends.ejs","hash":"2a4c0bfdf189ebae720f1325786a87c7cac51d37","modified":1705839988548},{"_id":"themes/ayer/layout/archive.ejs","hash":"2703b07cc8ac64ae46d1d263f4653013c7e1666b","modified":1705839988547},{"_id":"themes/ayer/layout/index.ejs","hash":"c40a98c0a6f55c27959e44c9e8e4f2619fc2ad3f","modified":1705839988548},{"_id":"themes/ayer/layout/layout.ejs","hash":"ad2222b1819f763cd981f72b8204a19cb0fa75ae","modified":1705839988549},{"_id":"themes/ayer/layout/page.ejs","hash":"75879224e47b3329d7accfc2403580a2412dce25","modified":1705839988549},{"_id":"themes/ayer/layout/plain-page.ejs","hash":"d351ff4aadd020a1960cc00f17fdd91a17e0cc54","modified":1705839988550},{"_id":"themes/ayer/languages/de.yml","hash":"2b7fa47fbe06f6928a43ea3b345ab3aeaa2cee81","modified":1705839988519},{"_id":"themes/ayer/languages/default.yml","hash":"1853255c243858cf9d26a589d7d26571e11ed5d1","modified":1705839988520},{"_id":"themes/ayer/layout/tags.ejs","hash":"e7c9f93c6f7041a7d2aa95e85cc131b22aa426b7","modified":1705839988550},{"_id":"themes/ayer/languages/fr.yml","hash":"3dac4d53b9b2a1b10c0273ce7472b2e76576dc5a","modified":1705839988521},{"_id":"themes/ayer/layout/post.ejs","hash":"75879224e47b3329d7accfc2403580a2412dce25","modified":1705839988550},{"_id":"themes/ayer/languages/en.yml","hash":"1853255c243858cf9d26a589d7d26571e11ed5d1","modified":1705839988520},{"_id":"themes/ayer/.github/FUNDING.yml","hash":"56f5ebae29b5bd4551df79f38c09ab452e0ab28f","modified":1705839988510},{"_id":"themes/ayer/languages/es.yml","hash":"fc27661276313c1c539252517d664359cb286f8a","modified":1705839988521},{"_id":"themes/ayer/languages/ko.yml","hash":"00db39dd43875774088511b4d467dcb71f1ce8ac","modified":1705839988522},{"_id":"themes/ayer/languages/ja.yml","hash":"aea06ea7bcb439d2b84501924cdd092293ee891a","modified":1705839988522},{"_id":"themes/ayer/languages/no.yml","hash":"fa4d2da9bb00ad0febc631afaf17f76aaa17e950","modified":1705839988524},{"_id":"themes/ayer/languages/pt.yml","hash":"fa0b3a4a01a0493f3ef402039e394a291a1251fd","modified":1705839988524},{"_id":"themes/ayer/languages/nl.yml","hash":"d619955fd9659a209c58f696ee2160dfe8c6ac41","modified":1705839988523},{"_id":"themes/ayer/languages/ru.yml","hash":"45edcadb57176d0b11a839055df1964da8ca08f9","modified":1705839988525},{"_id":"themes/ayer/languages/vi.yml","hash":"20f25fe0e9017d530a771687fe9d21353e034fff","modified":1705839988525},{"_id":"themes/ayer/languages/zh-CN.yml","hash":"edf1f8c164f3d166f94e213148e984fdfc3a7c85","modified":1705839988526},{"_id":"themes/ayer/scripts/default_config.js","hash":"617c2614d8bd8ffda2f2f84ab54fb18866e39b33","modified":1705839988557},{"_id":"themes/ayer/languages/zh-TW.yml","hash":"750fba5314d340ddb00812fc17a608a084f04462","modified":1705839988526},{"_id":"themes/ayer/source/favicon.ico","hash":"ffb419b079e5d5f9c085cb3ba106d37495b7ce52","modified":1705817614000},{"_id":"themes/ayer/source-src/main.js","hash":"fcb7c6c5ffcfd72ba9bd55b475af8a0e74484634","modified":1705839988584},{"_id":"themes/ayer/source/favicon.#ico","hash":"473ba682e828a7e34f24fae320e77b6bed4260c7","modified":1705839988601},{"_id":"themes/ayer/layout/_partial/ads.ejs","hash":"2be035aeef82265c5b0cb6aec6f4135ad1e0aa75","modified":1705839988527},{"_id":"themes/ayer/source/404.html","hash":"fce8d48b2534f5ba5feb3a91e43813f8f85b07d8","modified":1705839988585},{"_id":"themes/ayer/.github/ISSUE_TEMPLATE/bug-report.md","hash":"109c742a5829ca6c9a39d9df5023f6ecc6ff886e","modified":1705839988511},{"_id":"themes/ayer/.github/ISSUE_TEMPLATE/other.md","hash":"e4c347d70c3b8044eec656e8cfb78cfd49f2d991","modified":1705839988512},{"_id":"themes/ayer/layout/_partial/after-footer.ejs","hash":"ec2dd8a5e55b99350d7606a4f4ba0918fd656116","modified":1705839988528},{"_id":"themes/ayer/layout/_partial/archive-post.ejs","hash":"6b3e77cdbf8271c2a22b839608cccaa651f84e93","modified":1705839988528},{"_id":"themes/ayer/layout/_partial/archive.ejs","hash":"1da014dd52294e132bc91eb2f45f67264a41e059","modified":1705839988529},{"_id":"themes/ayer/layout/_partial/ayer.ejs","hash":"84f5c967f5019f4964711f3edd408a7503702e58","modified":1705839988530},{"_id":"themes/ayer/layout/_partial/baidu-analytics.ejs","hash":"155327c23607f69989b58845f24d842a54e504b8","modified":1705839988530},{"_id":"themes/ayer/layout/_partial/article.ejs","hash":"9ef0ed563dd6e3277534f9601ab290b72b3dc42b","modified":1705839988529},{"_id":"themes/ayer/layout/_partial/broadcast.ejs","hash":"21fadeb390cff713fd432d0565bb901f8caff0c0","modified":1705839988531},{"_id":"themes/ayer/layout/_partial/footer.ejs","hash":"16c6877db510a28afff0334be8d2ffe2f76d7a3e","modified":1705839988532},{"_id":"themes/ayer/layout/_partial/float-btns.ejs","hash":"b2fc5726168f012bc61845f33a46404ff4065947","modified":1705839988531},{"_id":"themes/ayer/layout/_partial/google-analytics.ejs","hash":"1a9b8574d4341354ed00127ffb873c80ac1beee9","modified":1705839988532},{"_id":"themes/ayer/layout/_partial/head.ejs","hash":"38abac221b79d83fd8d3ec8ee0fba55ef162d148","modified":1705839988533},{"_id":"themes/ayer/layout/_partial/katex.ejs","hash":"bef830bc48db44c19bfa922d8ed5f6ee1e924ea7","modified":1705839988534},{"_id":"themes/ayer/layout/_partial/lock.ejs","hash":"72ec0a339f98399c5141f4b3aca4cc8e8310f03a","modified":1705839988534},{"_id":"themes/ayer/.github/ISSUE_TEMPLATE/question.md","hash":"20a7174d36e8f090ba7800c08b0c44b15b753736","modified":1705839988513},{"_id":"themes/ayer/layout/_partial/mathjax.ejs","hash":"4d6b2bbe0d50f609a9d6e5d646d07f7ab29e8c66","modified":1705839988534},{"_id":"themes/ayer/.github/ISSUE_TEMPLATE/feature-request.md","hash":"ca76e0709f2e97edfa004922da78599ef35eb039","modified":1705839988512},{"_id":"themes/ayer/layout/_partial/modal.ejs","hash":"b9caece8b5fb47e250c67f6f80f101f08d04eba9","modified":1705839988535},{"_id":"themes/ayer/layout/_partial/music.ejs","hash":"4a67b36cadf2661a5579a454b7d6e0be34e7a0d4","modified":1705839988535},{"_id":"themes/ayer/layout/_partial/viewer.ejs","hash":"ba0639363016f5badd13fefd000ef967c6a4e47b","modified":1705839988546},{"_id":"themes/ayer/scripts/events/index.js","hash":"f3a5d9bda901565e3c302bcb5ed716b6d006089e","modified":1705839988558},{"_id":"themes/ayer/.github/workflows/npmpublish.yml","hash":"6a748fbb9f13da90a00e35d1e8f54bbe71a14571","modified":1705839988514},{"_id":"themes/ayer/layout/_partial/sidebar.ejs","hash":"b7efb7f2b300de23d12ef310d710d809d979f4fd","modified":1705839988546},{"_id":"themes/ayer/scripts/filters/meta_generator.js","hash":"46f6461a2bdc509837c36ede4d32c8b12e3d49b9","modified":1705839988561},{"_id":"themes/ayer/scripts/filters/index.js","hash":"e0c3b821ecd1cb614569282fb4f6e6f555545f8b","modified":1705839988560},{"_id":"themes/ayer/scripts/helpers/ayer-plus-vendors.js","hash":"611f3bcd8220312f92c11fa6a5dad02f011068d2","modified":1705839988561},{"_id":"themes/ayer/scripts/lib/core.js","hash":"00509e97554914e5b0a20e0843dc90bcf53461aa","modified":1705839988563},{"_id":"themes/ayer/scripts/utils/join-path.js","hash":"ec068c699155565aea4aa4ab55d8a10b2947a114","modified":1705839988564},{"_id":"themes/ayer/scripts/utils/object.js","hash":"d798779ec79a53ce04b8ac79efd5d064981d95bd","modified":1705839988564},{"_id":"themes/ayer/scripts/helpers/wordcount.js","hash":"2014b5c5053ad737887b61014a045cc1b08799cd","modified":1705839988562},{"_id":"themes/ayer/source/css/clipboard.styl","hash":"145f335d6369744a75c2c39a50f63a88f720f85b","modified":1705839988586},{"_id":"themes/ayer/source/dist/main.js","hash":"4338ca7a7bc35ee139016c91d4746643a3ee01c8","modified":1705839988601},{"_id":"themes/ayer/source/css/custom.styl","hash":"32990e811ea6fba84673b6d7175c88a3b890b109","modified":1705839988587},{"_id":"themes/ayer/source/dist/main.css","hash":"1f49cde949291ed86277d30721a7e728a4f8671a","modified":1705839988600},{"_id":"themes/ayer/source/images/ayer.png","hash":"0466c05244273f645d239cd27513bfa3c50308aa","modified":1705839988606},{"_id":"themes/ayer/source/images/ayer-side.svg","hash":"ad004ce7a873de0f91774f3d5923e010396a07bd","modified":1705839988606},{"_id":"themes/ayer/source/images/ayer.svg","hash":"379c3307f97c364718a1dbc1e52fb14de12eb11a","modified":1705839988607},{"_id":"themes/ayer/source/images/404.jpg","hash":"4f36a8d378712427cded03f5166949f5e0ba754c","modified":1705839988602},{"_id":"themes/ayer/source/images/beian.png","hash":"29c400bc3b89f6085766dac4e0330ded5cb73d52","modified":1705839988608},{"_id":"themes/ayer/source/images/cover7.jpg","hash":"573bff6899d2d9c5bcba0dc9c60cd1ec9eb8b029","modified":1705839988625},{"_id":"themes/ayer/source/images/github.png","hash":"4853ff37f9d859e7faa77675632a73f8ef089a15","modified":1705839988627},{"_id":"themes/ayer/source/images/forkme.png","hash":"99c3e21a169421e4f249befb428396c729863a75","modified":1705839988626},{"_id":"themes/ayer/source/images/hexo.png","hash":"6b0315fba8a8f496491079b361e2fb5253e19a04","modified":1705839988628},{"_id":"themes/ayer/source/images/hexo-tag-chart.png","hash":"6db432aae30556d151c2fd2c1d11015d9309ba81","modified":1705839988627},{"_id":"themes/ayer/source/images/gitee.png","hash":"250da578e0bd1393f22737f58d0fbae95119e527","modified":1705839988626},{"_id":"themes/ayer/source/images/logo1.svg","hash":"bfb26bf3aee6cd401abbd5f4d12a6d301fe59eff","modified":1706455173010},{"_id":"themes/ayer/source/images/mouse.cur","hash":"c1ffe93a6ba0d25ef06bb3d097560762e4807593","modified":1705839988629},{"_id":"themes/ayer/source/images/logo.svg","hash":"3b535068b581235af361be0299ea7ca3b5af4676","modified":1705904292486},{"_id":"themes/ayer/source/images/sponsor.jpg","hash":"5b5e4498177b369a7eca7ab2b1d0710b8690e21d","modified":1705839988629},{"_id":"themes/ayer/source/js/busuanzi-2.3.pure.min.js","hash":"6e41f31100ae7eb3a6f23f2c168f6dd56e7f7a9a","modified":1705839988632},{"_id":"themes/ayer/source/js/clickBoom1.js","hash":"c97ea1f120dba2c6804d0420186ef5d6f2419b7c","modified":1705839988632},{"_id":"themes/ayer/source/js/clickBoom2.js","hash":"2bc7267652ec49cea5dc3a8bd470c7d5ec57c721","modified":1705839988633},{"_id":"themes/ayer/source/js/dz.js","hash":"079ae73e2e396c2e00919a50a6fe0d064f99303a","modified":1705839988634},{"_id":"themes/ayer/source/js/tocbot.min.js","hash":"bae97e8a24a05a99335f8e725641c8ca9c50502a","modified":1705839988636},{"_id":"themes/ayer/source-src/css/_darkmode.styl","hash":"eda0bf55d64f2cdeb75f9489818c34635bc85c00","modified":1705839988565},{"_id":"themes/ayer/source/js/clickLove.js","hash":"a35dfb7ff19796c005ee30b55fd95e39d6d59a89","modified":1705839988633},{"_id":"themes/ayer/source/js/lazyload.min.js","hash":"d9bc50752cd7e331dbd0a833386838397c9a079f","modified":1705839988635},{"_id":"themes/ayer/source/js/search.js","hash":"6d5c093d12e922ad204dab1723b786c35847bf1b","modified":1705839988636},{"_id":"themes/ayer/source-src/css/_extend.styl","hash":"996ed7faa5ebf69af1f14f90f774dc7a53774537","modified":1705839988566},{"_id":"themes/ayer/source-src/css/_mixins.styl","hash":"e4804d78ded3714495f8ac9cebdbd2871ed97549","modified":1705839988566},{"_id":"themes/ayer/source-src/css/_normalize.styl","hash":"b90386215434cc76549c046e7f67392049492a6a","modified":1705839988567},{"_id":"themes/ayer/source-src/css/_remixicon.styl","hash":"6e7671af612868b750f1dc195f2e7c1c34931800","modified":1705839988581},{"_id":"themes/ayer/source-src/js/ayer.js","hash":"a3d349fb8af029e710d064c15373163680da2d39","modified":1705839988583},{"_id":"themes/ayer/source-src/js/share.js","hash":"7c105c427d472d84bee2ef3f0a61efa4ac6d564f","modified":1705839988584},{"_id":"themes/ayer/layout/_partial/post/author.ejs","hash":"0e6c2862d75e5b21faf28a5cc3310d3515340287","modified":1705839988537},{"_id":"themes/ayer/layout/_partial/post/albums.ejs","hash":"f4cfbabca9f59a9e5aa457a6f2a9cf6f56cd22b3","modified":1705839988536},{"_id":"themes/ayer/layout/_partial/post/busuanzi.ejs","hash":"895293405b2b3b19fe97d79f4a25e16bea153ae8","modified":1705839988537},{"_id":"themes/ayer/layout/_partial/post/category.ejs","hash":"89cb32e8d98bad81d3ef33377212e9b253699d3d","modified":1705839988538},{"_id":"themes/ayer/layout/_partial/post/date.ejs","hash":"947f513f7a85fbcf085624e46dc2ae6de8185eec","modified":1705839988539},{"_id":"themes/ayer/layout/_partial/post/clipboard.ejs","hash":"55f2fafe9c6a151eeee39d1a2556742ebe89b2a2","modified":1705839988538},{"_id":"themes/ayer/layout/_partial/post/gallery.ejs","hash":"6f78a49edc91f230b0a838c77630e9671d8d6089","modified":1705839988539},{"_id":"themes/ayer/source-src/css/style.styl","hash":"dd5f5d0fef358ea1eba3f782458f72e13f764bba","modified":1705839988582},{"_id":"themes/ayer/layout/_partial/post/gitalk.ejs","hash":"9f0250bc192a59a8577ea3048c8f5eef91ac10ef","modified":1705839988540},{"_id":"themes/ayer/layout/_partial/post/justifiedGallery.ejs","hash":"a313df6a014a0f2ba6b869dabc56bacb8ff6324d","modified":1705839988540},{"_id":"themes/ayer/source-src/css/_variables.styl","hash":"2fdb4425b6213fed28921f53179e825aee0500cf","modified":1705839988581},{"_id":"themes/ayer/layout/_partial/post/search.ejs","hash":"47c818c236b063d6ce0c41e0824f9f10a3521414","modified":1705839988541},{"_id":"themes/ayer/layout/_partial/post/nav.ejs","hash":"a73010cbbc463089a1376889850fb0890143c988","modified":1705839988541},{"_id":"themes/ayer/layout/_partial/post/share.ejs","hash":"9a978d55358878c97186ed010e536e1b314adb35","modified":1705839988542},{"_id":"themes/ayer/layout/_partial/post/tag.ejs","hash":"694b5101bcc44c9f9c1cc62e5ad2fdfb4b7c7a07","modified":1705839988542},{"_id":"themes/ayer/layout/_partial/post/title.ejs","hash":"e55c57b8cb8c8acf0ed998ea31c2fbc1d6256027","modified":1705839988543},{"_id":"themes/ayer/layout/_partial/post/topping.ejs","hash":"de2c50fb5b7a816287c6d048a2a22ae9c29abcdd","modified":1705839988544},{"_id":"themes/ayer/layout/_partial/post/tocbot.ejs","hash":"17ac504f2a6d561765046a0ba19dcce504104517","modified":1705839988543},{"_id":"themes/ayer/layout/_partial/post/twikoo.ejs","hash":"1e591e7b71880ca0a1dd9ab9913aa67fdd91633a","modified":1705839988544},{"_id":"themes/ayer/layout/_partial/post/word.ejs","hash":"5b785368a0a6f3b5538aa1b9e7574daa8dfb0df6","modified":1705839988545},{"_id":"themes/ayer/layout/_partial/post/valine.ejs","hash":"d5b568a3554f0d6572e7b232b8a0ab3ea81a1845","modified":1705839988545},{"_id":"themes/ayer/scripts/events/lib/merge-configs.js","hash":"734aac9a53cf168ee51482b02b75954a2a3df150","modified":1705839988559},{"_id":"themes/ayer/scripts/events/lib/hello.js","hash":"058c73fa3900d143affb9cc7ea0b2105d3925915","modified":1705839988559},{"_id":"themes/ayer/source-src/css/_partial/ads.styl","hash":"e3e533ac5b9b6c5ef7d3829c890aff42dc29cfc1","modified":1705839988568},{"_id":"themes/ayer/source-src/css/_partial/albums.styl","hash":"5802253789028a4d9dac474168fc7132045e72ff","modified":1705839988568},{"_id":"themes/ayer/source-src/css/_partial/archive.styl","hash":"9dbb04cf0ae07b50acd6f343e673df215a3c868e","modified":1705839988569},{"_id":"themes/ayer/source-src/css/_partial/apple.styl","hash":"333f9e59dc6625c4dee126a1c1a9c25ce9292655","modified":1705839988569},{"_id":"themes/ayer/source-src/css/_partial/articles.styl","hash":"ddbe833939180afdc832659c5cdad08f77ef4f46","modified":1705839988570},{"_id":"themes/ayer/source-src/css/_partial/float.styl","hash":"b1abfdfd05e74745484f7e6d043ef2842b3f6b41","modified":1705839988572},{"_id":"themes/ayer/source-src/css/_partial/article.styl","hash":"659a35544b321a101f7cf114f0c9fdf2cc125625","modified":1705839988570},{"_id":"themes/ayer/source-src/css/_partial/ayer.styl","hash":"38187e5c88eaf1ea099f2ded56f1f60194c95ec4","modified":1705839988571},{"_id":"themes/ayer/source-src/css/_partial/gitalk.styl","hash":"0678e8b330daea56fa30d14e97de73289a7d6f22","modified":1705839988574},{"_id":"themes/ayer/source-src/css/_partial/categories.styl","hash":"cb3b1667c83182d6309e6d066f53f2771723729e","modified":1705839988571},{"_id":"themes/ayer/source-src/css/_partial/gallery.styl","hash":"f5eae1b0030cfd97f1646844c9d3f692dbb38946","modified":1705839988573},{"_id":"themes/ayer/source-src/css/_partial/footer.styl","hash":"ae22e9d1525f267be368359ed0096f26791b809e","modified":1705839988572},{"_id":"themes/ayer/source-src/css/_partial/friends.styl","hash":"10332c63736e4ce31353b7605012caf744a8286a","modified":1705839988573},{"_id":"themes/ayer/source-src/css/_partial/highlight.styl","hash":"1210f704aae34ef653e3a458cccb700b05353ea1","modified":1705839988574},{"_id":"themes/ayer/source-src/css/_partial/lists.styl","hash":"dc45f8b1a5942d4d979fb0859bc47a86f73fe0a9","modified":1705839988576},{"_id":"themes/ayer/source-src/css/_partial/mobile.styl","hash":"ba8ab5a0280b953aa97435ff8946cbcbb2755a27","modified":1705839988576},{"_id":"themes/ayer/source-src/css/_partial/justifiedGallery.styl","hash":"9828c78fb59c3ea3de7cce2569313d12c4b1a6ff","modified":1705839988575},{"_id":"themes/ayer/source-src/css/_partial/layout.styl","hash":"d4613f176636cae6a4af6124863a176c32ea6471","modified":1705839988575},{"_id":"themes/ayer/source-src/css/_partial/pace.styl","hash":"bbda18c692fc66ae99e45347ff52c14e44a08e3b","modified":1705839988577},{"_id":"themes/ayer/source-src/css/_partial/navbar.styl","hash":"266df43ec4041226f1801719e873265b75fe6515","modified":1705839988576},{"_id":"themes/ayer/source-src/css/_partial/search.styl","hash":"3f2c7bd1371f6f25aec7c581dbae7b52f95ec4c6","modified":1705839988578},{"_id":"themes/ayer/source-src/css/_partial/reward.styl","hash":"924114f723a22dbb8970d023bc2e033141b3438d","modified":1705839988577},{"_id":"themes/ayer/source-src/css/_partial/sidebar.styl","hash":"cdc7bea47a768b18991decde0d38c554399621ee","modified":1705839988579},{"_id":"themes/ayer/source-src/css/_partial/share.styl","hash":"4a6e6ac9156553dd5cee1eeee8fdc6f1f8a5d117","modified":1705839988578},{"_id":"themes/ayer/source-src/css/_partial/tag.styl","hash":"6072aa6bd16e0a1e75f0258d7b20587cab56fff8","modified":1705839988579},{"_id":"themes/ayer/source-src/css/_partial/totop.styl","hash":"b6010788be1d99a345abcf0cf9cdf0a564b90d3c","modified":1705839988580},{"_id":"themes/ayer/source-src/css/_partial/tocbot.styl","hash":"130e29937aa750e63e8cf216934dbdd4ea95969f","modified":1705839988580},{"_id":"themes/ayer/source/images/alipay.jpg","hash":"8f5409e29764fca573f1d274003910aa3c919de1","modified":1705839988604},{"_id":"themes/ayer/source/images/cover2.jpg","hash":"f61dd08c95327468c5f6bc5175eff68d00f05b46","modified":1705839988612},{"_id":"themes/ayer/source/images/wechat.jpg","hash":"93a362574a8498e75dca469b7bceb0b321fda387","modified":1705839988630},{"_id":"themes/ayer/source/js/jquery-3.6.0.min.js","hash":"4cd5ddc413b3024d7b56331c0d0d0b2bd933f27f","modified":1705839988635},{"_id":"themes/ayer/source/css/fonts/remixicon.css","hash":"8b54eed3270fae6d5bde5b0a6b522a32b5bd39a0","modified":1705839988588},{"_id":"themes/ayer/source/css/fonts/remixicon.woff2","hash":"d83e667e2d8583bcd2d97b4ebe13ff1f147b947c","modified":1705839988599},{"_id":"themes/ayer/source/css/fonts/remixicon.woff","hash":"8d6a423fd373c0a1f45b927d37f8f932aaea21ec","modified":1705839988598},{"_id":"themes/ayer/source/images/cover6.jpg","hash":"a5b8a5dddff2607fee5fccf5fdef3b214a8468cc","modified":1705839988624},{"_id":"themes/ayer/screenshots/hexo-theme-ayer.png","hash":"4111670e622ce09837b6b9cc641782af75805079","modified":1705839988556},{"_id":"themes/ayer/source/images/cover1.jpg","hash":"e019fbed6158ae3e4ec3d255b41bddc1afcbfa90","modified":1705839988610},{"_id":"themes/ayer/source/images/cover3.jpg","hash":"7b4e7c9ce19ce5d5c1588b2567e88ecbb04370af","modified":1705839988614},{"_id":"themes/ayer/source/css/fonts/remixicon.ttf","hash":"7eba83fb4482a63f3b338ccb6dca312e8e95db7f","modified":1705839988597},{"_id":"themes/ayer/source/css/fonts/remixicon.eot","hash":"7e929b884b2201250fc49e8e79c3aba6cd9e4482","modified":1705839988591},{"_id":"themes/ayer/source/images/cover4.jpg","hash":"77040e609d2f1c60e00a8e47cb95b25bf7ff5b9c","modified":1705839988618},{"_id":"themes/ayer/source/images/cover5.jpg","hash":"1a2d6182d94b015a45fe4bf8e8a239dfcc0ef776","modified":1705839988623},{"_id":"themes/ayer/source/css/fonts/remixicon.svg","hash":"d5ab3ec2fd85b327b8c806228d2cd84b6d6b24c8","modified":1705839988595},{"_id":"themes/ayer/source/images/cover8.jpeg","hash":"80309e9fed99c14206c95e1b4f85a28c58de9390","modified":1705907086839},{"_id":"public/atom.xml","hash":"3059361e012478255fc57fd1dc11609c4daba763","modified":1755751700096},{"_id":"public/search.xml","hash":"6170b00aabda98b77228cb5a8f717f7672325276","modified":1755751700096},{"_id":"public/categories/index.html","hash":"321e42ea1ae40f151bfa9d2b6059d391e1c36f57","modified":1755751700096},{"_id":"public/friends/index.html","hash":"394fa9102ad902e2a7c3842a38579913984e5ddd","modified":1755751700096},{"_id":"public/tags/index.html","hash":"d49634a2484e57610bb6ee6882f2f1480cde4567","modified":1755751700096},{"_id":"public/archives/index.html","hash":"cfc82da64120cb05586d7ce7884befc453ec355f","modified":1755751700096},{"_id":"public/archives/2024/index.html","hash":"f55fe9937465a4fc5223f97f10a52363aeaf92f3","modified":1755751700096},{"_id":"public/archives/2024/01/index.html","hash":"ff930c2776485f696dd6e69a39070b093fa0af10","modified":1755751700096},{"_id":"public/categories/neuroscience/index.html","hash":"e99ef5292ac1ef60b18e6b522e4ea7ed6a48066c","modified":1755751700096},{"_id":"public/tags/vision/index.html","hash":"a3b955737b54a62c6d4a98cd0e0db75dd8b1fa5c","modified":1755751700096},{"_id":"public/archives/2024/02/index.html","hash":"596e98abd1792e637ea721843d5775c74164af87","modified":1755751700096},{"_id":"public/tags/mantis-shrimp/index.html","hash":"f898fdb731ad2ac96cedeed39884c7f8215014e1","modified":1755751700096},{"_id":"public/tags/neuroscience/index.html","hash":"6ce2b49810fa7099558b9d70c4a32a32b77b5043","modified":1755751700096},{"_id":"public/tags/note/index.html","hash":"f78f926dfd33effafbec42ab109fc5df82eae38b","modified":1755751700096},{"_id":"public/2024/02/16/Notes-on-Stomatopod-s-visual-ability-3/index.html","hash":"bb02d780b8fdf331878a687c37e556db5dcfffc6","modified":1755751700096},{"_id":"public/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/index.html","hash":"633fcbcc11738a6fb12c2b36fe5d48f382b92f81","modified":1755751700096},{"_id":"public/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/index.html","hash":"3ffe87f9b3376c571a687e2bc03e965ad652aeb6","modified":1755751700096},{"_id":"public/2024/01/21/hello-world/index.html","hash":"5775c9f9efd8dfa94e554494bae66df8ea7207be","modified":1755751700096},{"_id":"public/index.html","hash":"8c151e97705915bfe0bb26a5feb21c2d8d06f53d","modified":1755751700096},{"_id":"public/favicon.ico","hash":"ffb419b079e5d5f9c085cb3ba106d37495b7ce52","modified":1708061091346},{"_id":"public/favicon.#ico","hash":"473ba682e828a7e34f24fae320e77b6bed4260c7","modified":1708061091346},{"_id":"public/images/404.jpg","hash":"4f36a8d378712427cded03f5166949f5e0ba754c","modified":1708061091346},{"_id":"public/images/ayer-side.svg","hash":"ad004ce7a873de0f91774f3d5923e010396a07bd","modified":1708061091346},{"_id":"public/images/ayer.png","hash":"0466c05244273f645d239cd27513bfa3c50308aa","modified":1708061091346},{"_id":"public/404.html","hash":"155c674062d18ab392fa47ac837dd7afe77f8a56","modified":1708061091346},{"_id":"public/images/ayer.svg","hash":"379c3307f97c364718a1dbc1e52fb14de12eb11a","modified":1708061091346},{"_id":"public/images/beian.png","hash":"29c400bc3b89f6085766dac4e0330ded5cb73d52","modified":1708061091346},{"_id":"public/images/cover7.jpg","hash":"573bff6899d2d9c5bcba0dc9c60cd1ec9eb8b029","modified":1708061091346},{"_id":"public/images/forkme.png","hash":"99c3e21a169421e4f249befb428396c729863a75","modified":1708061091346},{"_id":"public/images/gitee.png","hash":"250da578e0bd1393f22737f58d0fbae95119e527","modified":1708061091346},{"_id":"public/images/logo.svg","hash":"3b535068b581235af361be0299ea7ca3b5af4676","modified":1708061091346},{"_id":"public/images/hexo-tag-chart.png","hash":"6db432aae30556d151c2fd2c1d11015d9309ba81","modified":1708061091346},{"_id":"public/images/github.png","hash":"4853ff37f9d859e7faa77675632a73f8ef089a15","modified":1708061091346},{"_id":"public/images/hexo.png","hash":"6b0315fba8a8f496491079b361e2fb5253e19a04","modified":1708061091346},{"_id":"public/images/mouse.cur","hash":"c1ffe93a6ba0d25ef06bb3d097560762e4807593","modified":1708061091346},{"_id":"public/images/logo1.svg","hash":"bfb26bf3aee6cd401abbd5f4d12a6d301fe59eff","modified":1708061091346},{"_id":"public/images/sponsor.jpg","hash":"5b5e4498177b369a7eca7ab2b1d0710b8690e21d","modified":1708061091346},{"_id":"public/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image1.jpg","hash":"7aaf3634dff1307994d7adb40f9164ac0a9137c5","modified":1708061091346},{"_id":"public/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image3.png","hash":"3edec46b001637d60179428a9c5a40c7a5276fa5","modified":1708061091346},{"_id":"public/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/filters.svg","hash":"cf643da287bf7b3f37b5ac0017473455f836930d","modified":1708061091346},{"_id":"public/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/midband ommatidia.svg","hash":"237c037ad0a6935973093bb7bd9859c379ae5f38","modified":1708061091346},{"_id":"public/images/alipay.jpg","hash":"8f5409e29764fca573f1d274003910aa3c919de1","modified":1708061091346},{"_id":"public/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/ommatidia1.svg","hash":"f1de3f13ed1991355a5a6416d1732ee70aec79ba","modified":1708061091346},{"_id":"public/css/clipboard.css","hash":"7990b92ffeda1b06b94b50140d9c95dac21bd418","modified":1708061091346},{"_id":"public/dist/main.js","hash":"436093b4310b4656fb1e60ae946d04b85d6b1fa5","modified":1708061091346},{"_id":"public/css/custom.css","hash":"58950a4f4cd82465f85428ec17b3bc05f8153b56","modified":1708061091346},{"_id":"public/js/clickBoom1.js","hash":"afd4a981d3a56c40898248152009d478a3cd0d1e","modified":1708061091346},{"_id":"public/js/dz.js","hash":"079ae73e2e396c2e00919a50a6fe0d064f99303a","modified":1708061091346},{"_id":"public/js/busuanzi-2.3.pure.min.js","hash":"6e41f31100ae7eb3a6f23f2c168f6dd56e7f7a9a","modified":1708061091346},{"_id":"public/js/lazyload.min.js","hash":"b801b3946fb9b72e03512c0663458e140e1fa77b","modified":1708061091346},{"_id":"public/js/clickBoom2.js","hash":"d3fe9e8c7046bec9745628f61d61e4102171ac2b","modified":1708061091346},{"_id":"public/js/clickLove.js","hash":"9e8e79d69ad8338761272f86fe5cad0ad5e503cc","modified":1708061091346},{"_id":"public/js/tocbot.min.js","hash":"bae97e8a24a05a99335f8e725641c8ca9c50502a","modified":1708061091346},{"_id":"public/js/search.js","hash":"118be0e0918532ac1225f62e1a0a6f0673e0b173","modified":1708061091346},{"_id":"public/dist/main.css","hash":"1f49cde949291ed86277d30721a7e728a4f8671a","modified":1708061091346},{"_id":"public/js/jquery-3.6.0.min.js","hash":"b82d238d4e31fdf618bae8ac11a6c812c03dd0d4","modified":1708061091346},{"_id":"public/css/fonts/remixicon.css","hash":"be1956502b9cf5081091ff78d7f11cd7ea733be8","modified":1708061091346},{"_id":"public/images/cover2.jpg","hash":"f61dd08c95327468c5f6bc5175eff68d00f05b46","modified":1708061091346},{"_id":"public/images/wechat.jpg","hash":"93a362574a8498e75dca469b7bceb0b321fda387","modified":1708061091346},{"_id":"public/css/fonts/remixicon.woff2","hash":"d83e667e2d8583bcd2d97b4ebe13ff1f147b947c","modified":1708061091346},{"_id":"public/css/fonts/remixicon.woff","hash":"8d6a423fd373c0a1f45b927d37f8f932aaea21ec","modified":1708061091346},{"_id":"public/images/cover6.jpg","hash":"a5b8a5dddff2607fee5fccf5fdef3b214a8468cc","modified":1708061091346},{"_id":"public/images/cover3.jpg","hash":"7b4e7c9ce19ce5d5c1588b2567e88ecbb04370af","modified":1708061091346},{"_id":"public/images/cover1.jpg","hash":"e019fbed6158ae3e4ec3d255b41bddc1afcbfa90","modified":1708061091346},{"_id":"public/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image2.png","hash":"ff4763739573afcfa96cb0fdf3d2bde2c53f6c3d","modified":1708061091346},{"_id":"public/css/fonts/remixicon.eot","hash":"7e929b884b2201250fc49e8e79c3aba6cd9e4482","modified":1708061091346},{"_id":"public/css/fonts/remixicon.ttf","hash":"7eba83fb4482a63f3b338ccb6dca312e8e95db7f","modified":1708061091346},{"_id":"public/images/cover4.jpg","hash":"77040e609d2f1c60e00a8e47cb95b25bf7ff5b9c","modified":1708061091346},{"_id":"public/images/cover5.jpg","hash":"1a2d6182d94b015a45fe4bf8e8a239dfcc0ef776","modified":1708061091346},{"_id":"public/css/fonts/remixicon.svg","hash":"d5ab3ec2fd85b327b8c806228d2cd84b6d6b24c8","modified":1708061091346},{"_id":"public/images/cover8.jpeg","hash":"80309e9fed99c14206c95e1b4f85a28c58de9390","modified":1708061091346},{"_id":"source/_posts/Note _ PyRosetta Basic Initiation.md","hash":"9e64bcb8889ddaaa7931f6cdf2407ef50b58f706","modified":1755751519644},{"_id":"source/_posts/Note _ PyRosetta Basics (4)_ Rosetta Scripts Parser.md","hash":"3659c67567f7b905909e7f2cf7833d740c111165","modified":1755751534084},{"_id":"source/_posts/Note _ PyRosetta Basics (2)_ PyMOL Mover.md","hash":"c903c02883018d26e44d09080076554131f86a84","modified":1755751509292},{"_id":"source/_posts/Note _ PyRosetta Basics (1)_ Pose.md","hash":"7097bf3dc318db76c061bf78f8c2b7b99afe841c","modified":1755751478432},{"_id":"source/_posts/Note _ PyRosetta Basics (3)_ Viewer.md","hash":"e58a2dd16abbe12c622e16ccfcba142f01478b4a","modified":1755751499170},{"_id":"source/_posts/Note _ PyRosetta Basics (5)_ Score Function.md","hash":"6d99c4147d0c658833fa81c3d103d8b9de140f8a","modified":1755751021309},{"_id":"source/_posts/Note _ PyRosetta Basics (7)_ Movers for Side Chain Packing and Design.md","hash":"4bfd0c2d981466424a23f20d37dede3f099e756b","modified":1755751612945},{"_id":"source/_posts/Note _ PyRosetta Basics (6)_ Movers for Backbone Folding.md","hash":"d830c56b0a5697a51b30a68252f8c00932bc6ae9","modified":1755751554022},{"_id":"source/_posts/Note _ Pyrosetta Resources.md","hash":"ec95cbe442e386541ba4acd5754e5bc8322a4757","modified":1755751646283},{"_id":"source/_posts/Note _ PyRosetta Basics (8)_ Relax Protocols.md","hash":"7b2dcfc2865385281c8baad83457508ccc0e7121","modified":1755751526364},{"_id":"public/2025/08/21/Note _ Pyrosetta Resources/index.html","hash":"34946235bf7ca1e44c0c9f47d691542976cf0732","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (3)_ Viewer/index.html","hash":"b6912c82e976a77ec6fe791580382f6ef298e521","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (1)_ Pose/index.html","hash":"a7e314a05bdd8126a2771e7b8728b8929306f31e","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (2)_ PyMOL Mover/index.html","hash":"a9db0d55220317aab76dbd93e978cd4503a80a95","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basic Initiation/index.html","hash":"6181b319a3b6efc983d54b966419d325e3e17c8e","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (8)_ Relax Protocols/index.html","hash":"ddbda9e4c4a14098ec2c6b06296460ae272fb27b","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (7)_ Movers for Side Chain Packing and Design/index.html","hash":"3d46a78b93385a9ca8dd1a200180f4480ebee60b","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (6)_ Movers for Backbone Folding/index.html","hash":"e47d19420a8e1f972f3136d7a1c33b323b716efd","modified":1755751700096},{"_id":"public/2025/08/21/Note _ PyRosetta Basics (4)_ Rosetta Scripts Parser/index.html","hash":"b21d89da306d23a523387767f7055d7b8dfb1544","modified":1755751700096},{"_id":"public/archives/page/2/index.html","hash":"7934890cd5aec8d2a6e51554436e214035517a94","modified":1755751700096},{"_id":"public/archives/2025/index.html","hash":"ede24cee03c0c12a123a00ec2663a79517d83d20","modified":1755751700096},{"_id":"public/archives/2025/08/index.html","hash":"739800d5f23e3902966df34219edcf06971d13a3","modified":1755751700096},{"_id":"public/categories/protein-design/index.html","hash":"27cf4dc416f41ae9a84422f1f12d09c8243a6d62","modified":1755751700096},{"_id":"public/page/2/index.html","hash":"16f356810bf3d9bf37739095f47fe2caccb28e15","modified":1755751700096},{"_id":"public/tags/note/page/2/index.html","hash":"02d88599ba1673cc66b7cdd59300fcbae8a2f3b3","modified":1755751700096},{"_id":"public/tags/PyRosetta/index.html","hash":"08df59156091742cd2ba0cd73b34f96187e1d8c0","modified":1755751700096},{"_id":"public/tags/biochemistry/index.html","hash":"cae2dd500d553848559014da6592f5c1c15a1c8f","modified":1755751700096},{"_id":"public/tags/protein/index.html","hash":"bb2eef0002042ca2b713ceb9e9154b7aa9434c94","modified":1755751700096},{"_id":"public/tags/protein-design/index.html","hash":"116fcf0f3433acd0389c65f3ef3f0cb92bbc9494","modified":1755751700096}],"Category":[{"name":"neuroscience","_id":"clso7h26x0004sguj8btpcete"},{"name":"protein design","_id":"cmekx8a7p0041cgu6esfn1cr9"}],"Data":[],"Page":[{"title":"categories","type":"categories","layout":"categories","_content":"\n# Categories\n","source":"categories/index.md","raw":"---\ntitle: categories\ntype: \"categories\"\nlayout: \"categories\"\n---\n\n# Categories\n","date":"2024-01-28T07:03:32.160Z","updated":"2024-01-28T07:03:32.160Z","path":"categories/index.html","comments":1,"_id":"clso7h26q0000sguj05ab6c6g","content":"<h1 id=\"Categories\"><a href=\"#Categories\" class=\"headerlink\" title=\"Categories\"></a>Categories</h1>","excerpt":"","more":"<h1 id=\"Categories\"><a href=\"#Categories\" class=\"headerlink\" title=\"Categories\"></a>Categories</h1>"},{"title":"tags","type":"tags","layout":"tags","_content":"","source":"tags/index.md","raw":"---\ntitle: tags\ntype: \"tags\"\nlayout: \"tags\"\n---\n","date":"2024-02-16T05:20:32.187Z","updated":"2024-02-16T05:20:32.187Z","path":"tags/index.html","comments":1,"_id":"clso7h26v0002sgujhcg5bu2w","content":"","excerpt":"","more":""},{"title":"friends","type":"friends","layout":"friends","_content":"\n# Friends\n","source":"friends/index.md","raw":"---\ntitle: friends\ntype: friends\nlayout: \"friends\"\n---\n\n# Friends\n","date":"2024-01-28T07:03:40.551Z","updated":"2024-01-28T07:03:40.551Z","path":"friends/index.html","comments":1,"_id":"clso7h26z0006sguj4cyh80sv","content":"<h1 id=\"Friends\"><a href=\"#Friends\" class=\"headerlink\" title=\"Friends\"></a>Friends</h1>","excerpt":"","more":"<h1 id=\"Friends\"><a href=\"#Friends\" class=\"headerlink\" title=\"Friends\"></a>Friends</h1>"}],"Post":[{"title":" Notes on Stomatopod's visual ability: 1 ","date":"2024-01-28T09:57:02.000Z","_content":"\n# Notes on Stomatopod's visual ability: 1\n\n## Research subject\n\nThe research subject is the Stomatopod, which is commonly known as the mantis shrimp.\n\nThe Stomatopods have the greatest diversity of color receptor types known for any animal, and have a diverse set of photoreceptors that visualize polarized light. The review will focus on the features of the Stomatopod's ability to visualize color and polarized light .\n\nIn this field, the term \"Stomatopod\" is usually restricted to Gonodactyloidea and Lysiosquilloidea species.\n\n*Odontodactylus scyllarus*, a gonodactyloid stomatopod, is a commonly used model organism.\n\n\n\n*Odontodactylus havanensis*, (Cronin, 2006) *Copyright © 2006 Elsevier Ltd. All rights reserved.*, License Number 5716910107274\n\n## Morphological description of the compound eye of Stomatopods\n\nThe apposition compound eyes of an *Odontodactylus scyllarus* is morphologically divided in to three parts, namely (a) the dorsal hemisphere, (b) the **midband**, and (c) the ventral hemisphere. The basic units of vision of the compound eye is termed as \"**ommatidia**\".\n\nThe midband has 6 rows of ommatidia with bigger cornea compared with other ommatidia. This suggest that the midband and hemispherical ommatidia have different function. The dorsal hemisphere and a ventral hemisphere is spatially divided up by the midband.(Marshall, 1988)\n\n(The compond eye of *Lysiosquilla tredecimdentata* has larger dorsal and ventral hemispheres, but still has the midband consisting of 6 rows of ommatidia. The compond eye of Oratosquilla solicitans\\*, from another superfamily, only has 2 midbands.) (Marshall et al., 2007)\n\n\n\nEye of *Odontodactylus scyllarus*, (a) Frontal view, Scale 500 mm. (b) Dorsal view, showing the dorsal hemisphere and eye stalk. Scale 500 mm. (c) Sagittal section through *O. scyllarus* eye. From right to left: cornea, crystalline cones, distal retinal pigment (white line), retina (black crescent), and the first optic neuropil, the lamina ganglionaris (white region). Scale 400 mm. (Marshall et al., 2007) *Copyright © 1988, Springer Nature Limited*\n\n## General anatomical description of the ommatidia of Stomatopods\n\nThe 6 rows of the midband ommatidia are structurally different from one another. There are 16 anatomically different photoreceptors in the compond eye of Stomatopod.\n\nA ommatidium, from the distal end to the proximal end, roughly consists of 4 main parts, namely (a) cornea(lenses), (b) crystalline cones, (c) distal pigment, (d) rhabdom and sensory cells. At the proximal end, the ommatidia are connected to the nerve fiber by axons. (Marshall, 1988)\n\n\n\n## References\n\nCronin, T. W. (2006). Stomatopods. *Current Biology*, *16*(7), R235-R236. <https://doi.org/10.1016/j.cub.2006.03.014>\n\nMarshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. *Arthropod Struct Dev*, *36*(4), 420-448. <https://doi.org/10.1016/j.asd.2007.01.006>\n\nMarshall, N. J. (1988). A Unique Color and Polarization Vision System in Mantis Shrimps. *Nature*, *333*(6173), 557-560. <https://doi.org/DOI> 10.1038/333557a0\n","source":"_posts/Notes-on-Stomatopod-s-visual-ability-1.md","raw":"---\ntitle: ' Notes on Stomatopod''s visual ability: 1 '\ndate: 2024-01-28 17:57:02\ntags:\n - mantis shrimp\n - vision\n - neuroscience\n - note\ncategories:\n neuroscience\n---\n\n# Notes on Stomatopod's visual ability: 1\n\n## Research subject\n\nThe research subject is the Stomatopod, which is commonly known as the mantis shrimp.\n\nThe Stomatopods have the greatest diversity of color receptor types known for any animal, and have a diverse set of photoreceptors that visualize polarized light. The review will focus on the features of the Stomatopod's ability to visualize color and polarized light .\n\nIn this field, the term \"Stomatopod\" is usually restricted to Gonodactyloidea and Lysiosquilloidea species.\n\n*Odontodactylus scyllarus*, a gonodactyloid stomatopod, is a commonly used model organism.\n\n\n\n*Odontodactylus havanensis*, (Cronin, 2006) *Copyright © 2006 Elsevier Ltd. All rights reserved.*, License Number 5716910107274\n\n## Morphological description of the compound eye of Stomatopods\n\nThe apposition compound eyes of an *Odontodactylus scyllarus* is morphologically divided in to three parts, namely (a) the dorsal hemisphere, (b) the **midband**, and (c) the ventral hemisphere. The basic units of vision of the compound eye is termed as \"**ommatidia**\".\n\nThe midband has 6 rows of ommatidia with bigger cornea compared with other ommatidia. This suggest that the midband and hemispherical ommatidia have different function. The dorsal hemisphere and a ventral hemisphere is spatially divided up by the midband.(Marshall, 1988)\n\n(The compond eye of *Lysiosquilla tredecimdentata* has larger dorsal and ventral hemispheres, but still has the midband consisting of 6 rows of ommatidia. The compond eye of Oratosquilla solicitans\\*, from another superfamily, only has 2 midbands.) (Marshall et al., 2007)\n\n\n\nEye of *Odontodactylus scyllarus*, (a) Frontal view, Scale 500 mm. (b) Dorsal view, showing the dorsal hemisphere and eye stalk. Scale 500 mm. (c) Sagittal section through *O. scyllarus* eye. From right to left: cornea, crystalline cones, distal retinal pigment (white line), retina (black crescent), and the first optic neuropil, the lamina ganglionaris (white region). Scale 400 mm. (Marshall et al., 2007) *Copyright © 1988, Springer Nature Limited*\n\n## General anatomical description of the ommatidia of Stomatopods\n\nThe 6 rows of the midband ommatidia are structurally different from one another. There are 16 anatomically different photoreceptors in the compond eye of Stomatopod.\n\nA ommatidium, from the distal end to the proximal end, roughly consists of 4 main parts, namely (a) cornea(lenses), (b) crystalline cones, (c) distal pigment, (d) rhabdom and sensory cells. At the proximal end, the ommatidia are connected to the nerve fiber by axons. (Marshall, 1988)\n\n\n\n## References\n\nCronin, T. W. (2006). Stomatopods. *Current Biology*, *16*(7), R235-R236. <https://doi.org/10.1016/j.cub.2006.03.014>\n\nMarshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. *Arthropod Struct Dev*, *36*(4), 420-448. <https://doi.org/10.1016/j.asd.2007.01.006>\n\nMarshall, N. J. (1988). A Unique Color and Polarization Vision System in Mantis Shrimps. *Nature*, *333*(6173), 557-560. <https://doi.org/DOI> 10.1038/333557a0\n","slug":"Notes-on-Stomatopod-s-visual-ability-1","published":1,"updated":"2024-02-16T05:30:44.640Z","_id":"clso7h26s0001sguj5ypcd8po","comments":1,"layout":"post","photos":[],"content":"<h1 id=\"Notes-on-Stomatopod’s-visual-ability-1\"><a href=\"#Notes-on-Stomatopod’s-visual-ability-1\" class=\"headerlink\" title=\"Notes on Stomatopod’s visual ability: 1\"></a>Notes on Stomatopod’s visual ability: 1</h1><h2 id=\"Research-subject\"><a href=\"#Research-subject\" class=\"headerlink\" title=\"Research subject\"></a>Research subject</h2><p>The research subject is the Stomatopod, which is commonly known as the mantis shrimp.</p>\n<p>The Stomatopods have the greatest diversity of color receptor types known for any animal, and have a diverse set of photoreceptors that visualize polarized light. The review will focus on the features of the Stomatopod’s ability to visualize color and polarized light .</p>\n<p>In this field, the term “Stomatopod” is usually restricted to Gonodactyloidea and Lysiosquilloidea species.</p>\n<p><em>Odontodactylus scyllarus</em>, a gonodactyloid stomatopod, is a commonly used model organism.</p>\n<p><img src=\"/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image1.jpg\" alt=\""Odontodactylus havanensis"\"></p>\n<p><em>Odontodactylus havanensis</em>, (Cronin, 2006) <em>Copyright © 2006 Elsevier Ltd. All rights reserved.</em>, License Number 5716910107274</p>\n<h2 id=\"Morphological-description-of-the-compound-eye-of-Stomatopods\"><a href=\"#Morphological-description-of-the-compound-eye-of-Stomatopods\" class=\"headerlink\" title=\"Morphological description of the compound eye of Stomatopods\"></a>Morphological description of the compound eye of Stomatopods</h2><p>The apposition compound eyes of an <em>Odontodactylus scyllarus</em> is morphologically divided in to three parts, namely (a) the dorsal hemisphere, (b) the <strong>midband</strong>, and (c) the ventral hemisphere. The basic units of vision of the compound eye is termed as “<strong>ommatidia</strong>“.</p>\n<p>The midband has 6 rows of ommatidia with bigger cornea compared with other ommatidia. This suggest that the midband and hemispherical ommatidia have different function. The dorsal hemisphere and a ventral hemisphere is spatially divided up by the midband.(Marshall, 1988)</p>\n<p>(The compond eye of <em>Lysiosquilla tredecimdentata</em> has larger dorsal and ventral hemispheres, but still has the midband consisting of 6 rows of ommatidia. The compond eye of Oratosquilla solicitans*, from another superfamily, only has 2 midbands.) (Marshall et al., 2007)</p>\n<p><img src=\"/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image2.png\" alt=\"Eye\"></p>\n<p>Eye of <em>Odontodactylus scyllarus</em>, (a) Frontal view, Scale 500 mm. (b) Dorsal view, showing the dorsal hemisphere and eye stalk. Scale 500 mm. (c) Sagittal section through <em>O. scyllarus</em> eye. From right to left: cornea, crystalline cones, distal retinal pigment (white line), retina (black crescent), and the first optic neuropil, the lamina ganglionaris (white region). Scale 400 mm. (Marshall et al., 2007) <em>Copyright © 1988, Springer Nature Limited</em></p>\n<h2 id=\"General-anatomical-description-of-the-ommatidia-of-Stomatopods\"><a href=\"#General-anatomical-description-of-the-ommatidia-of-Stomatopods\" class=\"headerlink\" title=\"General anatomical description of the ommatidia of Stomatopods\"></a>General anatomical description of the ommatidia of Stomatopods</h2><p>The 6 rows of the midband ommatidia are structurally different from one another. There are 16 anatomically different photoreceptors in the compond eye of Stomatopod.</p>\n<p>A ommatidium, from the distal end to the proximal end, roughly consists of 4 main parts, namely (a) cornea(lenses), (b) crystalline cones, (c) distal pigment, (d) rhabdom and sensory cells. At the proximal end, the ommatidia are connected to the nerve fiber by axons. (Marshall, 1988)</p>\n<p><img src=\"/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image3.png\" alt=\"ommatidia\"></p>\n<h2 id=\"References\"><a href=\"#References\" class=\"headerlink\" title=\"References\"></a>References</h2><p>Cronin, T. W. (2006). Stomatopods. <em>Current Biology</em>, <em>16</em>(7), R235-R236. <a href=\"https://doi.org/10.1016/j.cub.2006.03.014\">https://doi.org/10.1016/j.cub.2006.03.014</a></p>\n<p>Marshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. <em>Arthropod Struct Dev</em>, <em>36</em>(4), 420-448. <a href=\"https://doi.org/10.1016/j.asd.2007.01.006\">https://doi.org/10.1016/j.asd.2007.01.006</a></p>\n<p>Marshall, N. J. (1988). A Unique Color and Polarization Vision System in Mantis Shrimps. <em>Nature</em>, <em>333</em>(6173), 557-560. <a href=\"https://doi.org/DOI\">https://doi.org/DOI</a> 10.1038/333557a0</p>\n","excerpt":"","more":"<h1 id=\"Notes-on-Stomatopod’s-visual-ability-1\"><a href=\"#Notes-on-Stomatopod’s-visual-ability-1\" class=\"headerlink\" title=\"Notes on Stomatopod’s visual ability: 1\"></a>Notes on Stomatopod’s visual ability: 1</h1><h2 id=\"Research-subject\"><a href=\"#Research-subject\" class=\"headerlink\" title=\"Research subject\"></a>Research subject</h2><p>The research subject is the Stomatopod, which is commonly known as the mantis shrimp.</p>\n<p>The Stomatopods have the greatest diversity of color receptor types known for any animal, and have a diverse set of photoreceptors that visualize polarized light. The review will focus on the features of the Stomatopod’s ability to visualize color and polarized light .</p>\n<p>In this field, the term “Stomatopod” is usually restricted to Gonodactyloidea and Lysiosquilloidea species.</p>\n<p><em>Odontodactylus scyllarus</em>, a gonodactyloid stomatopod, is a commonly used model organism.</p>\n<p><img src=\"/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image1.jpg\" alt=\""Odontodactylus havanensis"\"></p>\n<p><em>Odontodactylus havanensis</em>, (Cronin, 2006) <em>Copyright © 2006 Elsevier Ltd. All rights reserved.</em>, License Number 5716910107274</p>\n<h2 id=\"Morphological-description-of-the-compound-eye-of-Stomatopods\"><a href=\"#Morphological-description-of-the-compound-eye-of-Stomatopods\" class=\"headerlink\" title=\"Morphological description of the compound eye of Stomatopods\"></a>Morphological description of the compound eye of Stomatopods</h2><p>The apposition compound eyes of an <em>Odontodactylus scyllarus</em> is morphologically divided in to three parts, namely (a) the dorsal hemisphere, (b) the <strong>midband</strong>, and (c) the ventral hemisphere. The basic units of vision of the compound eye is termed as “<strong>ommatidia</strong>“.</p>\n<p>The midband has 6 rows of ommatidia with bigger cornea compared with other ommatidia. This suggest that the midband and hemispherical ommatidia have different function. The dorsal hemisphere and a ventral hemisphere is spatially divided up by the midband.(Marshall, 1988)</p>\n<p>(The compond eye of <em>Lysiosquilla tredecimdentata</em> has larger dorsal and ventral hemispheres, but still has the midband consisting of 6 rows of ommatidia. The compond eye of Oratosquilla solicitans*, from another superfamily, only has 2 midbands.) (Marshall et al., 2007)</p>\n<p><img src=\"/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image2.png\" alt=\"Eye\"></p>\n<p>Eye of <em>Odontodactylus scyllarus</em>, (a) Frontal view, Scale 500 mm. (b) Dorsal view, showing the dorsal hemisphere and eye stalk. Scale 500 mm. (c) Sagittal section through <em>O. scyllarus</em> eye. From right to left: cornea, crystalline cones, distal retinal pigment (white line), retina (black crescent), and the first optic neuropil, the lamina ganglionaris (white region). Scale 400 mm. (Marshall et al., 2007) <em>Copyright © 1988, Springer Nature Limited</em></p>\n<h2 id=\"General-anatomical-description-of-the-ommatidia-of-Stomatopods\"><a href=\"#General-anatomical-description-of-the-ommatidia-of-Stomatopods\" class=\"headerlink\" title=\"General anatomical description of the ommatidia of Stomatopods\"></a>General anatomical description of the ommatidia of Stomatopods</h2><p>The 6 rows of the midband ommatidia are structurally different from one another. There are 16 anatomically different photoreceptors in the compond eye of Stomatopod.</p>\n<p>A ommatidium, from the distal end to the proximal end, roughly consists of 4 main parts, namely (a) cornea(lenses), (b) crystalline cones, (c) distal pigment, (d) rhabdom and sensory cells. At the proximal end, the ommatidia are connected to the nerve fiber by axons. (Marshall, 1988)</p>\n<p><img src=\"/2024/01/28/Notes-on-Stomatopod-s-visual-ability-1/image3.png\" alt=\"ommatidia\"></p>\n<h2 id=\"References\"><a href=\"#References\" class=\"headerlink\" title=\"References\"></a>References</h2><p>Cronin, T. W. (2006). Stomatopods. <em>Current Biology</em>, <em>16</em>(7), R235-R236. <a href=\"https://doi.org/10.1016/j.cub.2006.03.014\">https://doi.org/10.1016/j.cub.2006.03.014</a></p>\n<p>Marshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. <em>Arthropod Struct Dev</em>, <em>36</em>(4), 420-448. <a href=\"https://doi.org/10.1016/j.asd.2007.01.006\">https://doi.org/10.1016/j.asd.2007.01.006</a></p>\n<p>Marshall, N. J. (1988). A Unique Color and Polarization Vision System in Mantis Shrimps. <em>Nature</em>, <em>333</em>(6173), 557-560. <a href=\"https://doi.org/DOI\">https://doi.org/DOI</a> 10.1038/333557a0</p>\n"},{"title":"Notes on Stomatopod's visual ability: 2","date":"2024-02-03T09:21:49.000Z","_content":"\n# Notes on Stomatopod's visual ability: 2\n\n## Terms and abbreviations\n\n| Abbreviation | Term | Description | Notes |\n| ------------ | --------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |\n| MO[x] | mid-band ommatidia(中带复眼) | Basic units of a mid-band. | There are 6 **rows** of midband eyes, designated as MO[1-6]. Each ommatidium in MO[1-4] has 3 tiers of rhabdom. Each ommatidium in MO[5,6] has 2 tiers of rhabdom. A hemispherical ommatidium has 2 tiers of rhabdom. |\n| R[x] | Rhabdomeres(感杆) | The elongated rod-like portion of the retinular cells, the subunit of the rhabdom, containing closely spaced and longitudinal rows of microvilli and pigment granules. | There are 8 **types** of rhabdomeres, designated as R[1-8]. R8 cells consist the most distal tier of rhabdom in all types (midband and hemispherical) of ommatidium. |\n| DR[x] | Distally placed rhabdomeres(远端感杆) | Rhabdomeres that consist the distally placed rhabdom in **MO[1-4]**, which is placed between the R[8] rhabdom and the PR rhabdom. | There are 7 **types** of DR, which are R[1-7]. They are specially designated as DR[1-7]. |\n| PR[x] | Proximal placed rhabdomeres(近端感杆) | Rhabdomeres that consist the proximally placed rhabdom in **MO[1-4]**, which is placed at the proximal end, that is, close to the basement menbrane. | There are 7 **types** of PR, which are R[1-7]. They are specially designated as PR[1-7]. |\n| F[x] | Filter(滤光体) | Specialized, coloured intra-rhabdomal structures in **MO[2,3]**, function as the filter of light in a specific wavelength band. | There are 2 **layers** of filters, designated as F[1], F[2]. F[1] is relatively distal and F[2] is relatively proximal. |\n\n## General structures of hemispherical ommatidia\n\n\n\n## General structures of mid-band ommatidia\n\n### General Structure of MO[1-4]\n\n\n\n### Special structures of MO[2,3] - Filters\n\n\n\n### General Structure of MO[5,6]\n\nThe General structure of MO[5,6] is similar to that of hemispherical ommatidia. However, the arrangement of microvillar in MO[5,6] are modified.\n\n- Very thin layering with precise orthogonal arrangements in R[1-7];\n- Unidirectionally arranged microvili in R[8];\n- Elongated R[8] rhabdomere;\n- A secondary orthogonality of the microvilli between MO[5,6].\n","source":"_posts/Notes-on-Stomatopod-s-visual-ability-2.md","raw":"---\ntitle: 'Notes on Stomatopod''s visual ability: 2'\ndate: 2024-02-03 17:21:49\ntags:\n - mantis shrimp\n - vision\n - neuroscience\n - note\ncategories:\n neuroscience\n---\n\n# Notes on Stomatopod's visual ability: 2\n\n## Terms and abbreviations\n\n| Abbreviation | Term | Description | Notes |\n| ------------ | --------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |\n| MO[x] | mid-band ommatidia(中带复眼) | Basic units of a mid-band. | There are 6 **rows** of midband eyes, designated as MO[1-6]. Each ommatidium in MO[1-4] has 3 tiers of rhabdom. Each ommatidium in MO[5,6] has 2 tiers of rhabdom. A hemispherical ommatidium has 2 tiers of rhabdom. |\n| R[x] | Rhabdomeres(感杆) | The elongated rod-like portion of the retinular cells, the subunit of the rhabdom, containing closely spaced and longitudinal rows of microvilli and pigment granules. | There are 8 **types** of rhabdomeres, designated as R[1-8]. R8 cells consist the most distal tier of rhabdom in all types (midband and hemispherical) of ommatidium. |\n| DR[x] | Distally placed rhabdomeres(远端感杆) | Rhabdomeres that consist the distally placed rhabdom in **MO[1-4]**, which is placed between the R[8] rhabdom and the PR rhabdom. | There are 7 **types** of DR, which are R[1-7]. They are specially designated as DR[1-7]. |\n| PR[x] | Proximal placed rhabdomeres(近端感杆) | Rhabdomeres that consist the proximally placed rhabdom in **MO[1-4]**, which is placed at the proximal end, that is, close to the basement menbrane. | There are 7 **types** of PR, which are R[1-7]. They are specially designated as PR[1-7]. |\n| F[x] | Filter(滤光体) | Specialized, coloured intra-rhabdomal structures in **MO[2,3]**, function as the filter of light in a specific wavelength band. | There are 2 **layers** of filters, designated as F[1], F[2]. F[1] is relatively distal and F[2] is relatively proximal. |\n\n## General structures of hemispherical ommatidia\n\n\n\n## General structures of mid-band ommatidia\n\n### General Structure of MO[1-4]\n\n\n\n### Special structures of MO[2,3] - Filters\n\n\n\n### General Structure of MO[5,6]\n\nThe General structure of MO[5,6] is similar to that of hemispherical ommatidia. However, the arrangement of microvillar in MO[5,6] are modified.\n\n- Very thin layering with precise orthogonal arrangements in R[1-7];\n- Unidirectionally arranged microvili in R[8];\n- Elongated R[8] rhabdomere;\n- A secondary orthogonality of the microvilli between MO[5,6].\n","slug":"Notes-on-Stomatopod-s-visual-ability-2","published":1,"updated":"2024-02-03T09:25:41.592Z","comments":1,"layout":"post","photos":[],"_id":"clso7h26v0003sguj8zlu8dqf","content":"<h1 id=\"Notes-on-Stomatopod’s-visual-ability-2\"><a href=\"#Notes-on-Stomatopod’s-visual-ability-2\" class=\"headerlink\" title=\"Notes on Stomatopod’s visual ability: 2\"></a>Notes on Stomatopod’s visual ability: 2</h1><h2 id=\"Terms-and-abbreviations\"><a href=\"#Terms-and-abbreviations\" class=\"headerlink\" title=\"Terms and abbreviations\"></a>Terms and abbreviations</h2><table>\n<thead>\n<tr>\n<th>Abbreviation</th>\n<th>Term</th>\n<th>Description</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>MO[x]</td>\n<td>mid-band ommatidia(中带复眼)</td>\n<td>Basic units of a mid-band.</td>\n<td>There are 6 <strong>rows</strong> of midband eyes, designated as MO[1-6]. Each ommatidium in MO[1-4] has 3 tiers of rhabdom. Each ommatidium in MO[5,6] has 2 tiers of rhabdom. A hemispherical ommatidium has 2 tiers of rhabdom.</td>\n</tr>\n<tr>\n<td>R[x]</td>\n<td>Rhabdomeres(感杆)</td>\n<td>The elongated rod-like portion of the retinular cells, the subunit of the rhabdom, containing closely spaced and longitudinal rows of microvilli and pigment granules.</td>\n<td>There are 8 <strong>types</strong> of rhabdomeres, designated as R[1-8]. R8 cells consist the most distal tier of rhabdom in all types (midband and hemispherical) of ommatidium.</td>\n</tr>\n<tr>\n<td>DR[x]</td>\n<td>Distally placed rhabdomeres(远端感杆)</td>\n<td>Rhabdomeres that consist the distally placed rhabdom in <strong>MO[1-4]</strong>, which is placed between the R[8] rhabdom and the PR rhabdom.</td>\n<td>There are 7 <strong>types</strong> of DR, which are R[1-7]. They are specially designated as DR[1-7].</td>\n</tr>\n<tr>\n<td>PR[x]</td>\n<td>Proximal placed rhabdomeres(近端感杆)</td>\n<td>Rhabdomeres that consist the proximally placed rhabdom in <strong>MO[1-4]</strong>, which is placed at the proximal end, that is, close to the basement menbrane.</td>\n<td>There are 7 <strong>types</strong> of PR, which are R[1-7]. They are specially designated as PR[1-7].</td>\n</tr>\n<tr>\n<td>F[x]</td>\n<td>Filter(滤光体)</td>\n<td>Specialized, coloured intra-rhabdomal structures in <strong>MO[2,3]</strong>, function as the filter of light in a specific wavelength band.</td>\n<td>There are 2 <strong>layers</strong> of filters, designated as F[1], F[2]. F[1] is relatively distal and F[2] is relatively proximal.</td>\n</tr>\n</tbody></table>\n<h2 id=\"General-structures-of-hemispherical-ommatidia\"><a href=\"#General-structures-of-hemispherical-ommatidia\" class=\"headerlink\" title=\"General structures of hemispherical ommatidia\"></a>General structures of hemispherical ommatidia</h2><p><img src=\"/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/ommatidia1.svg\" alt=\"Structure of hemispherical ommatidia\"></p>\n<h2 id=\"General-structures-of-mid-band-ommatidia\"><a href=\"#General-structures-of-mid-band-ommatidia\" class=\"headerlink\" title=\"General structures of mid-band ommatidia\"></a>General structures of mid-band ommatidia</h2><h3 id=\"General-Structure-of-MO-1-4\"><a href=\"#General-Structure-of-MO-1-4\" class=\"headerlink\" title=\"General Structure of MO[1-4]\"></a>General Structure of MO[1-4]</h3><p></p>\n<h3 id=\"Special-structures-of-MO-2-3-Filters\"><a href=\"#Special-structures-of-MO-2-3-Filters\" class=\"headerlink\" title=\"Special structures of MO[2,3] - Filters\"></a>Special structures of MO[2,3] - Filters</h3><p><img src=\"/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/filters.svg\" alt=\"filters\"></p>\n<h3 id=\"General-Structure-of-MO-5-6\"><a href=\"#General-Structure-of-MO-5-6\" class=\"headerlink\" title=\"General Structure of MO[5,6]\"></a>General Structure of MO[5,6]</h3><p>The General structure of MO[5,6] is similar to that of hemispherical ommatidia. However, the arrangement of microvillar in MO[5,6] are modified.</p>\n<ul>\n<li>Very thin layering with precise orthogonal arrangements in R[1-7];</li>\n<li>Unidirectionally arranged microvili in R[8];</li>\n<li>Elongated R[8] rhabdomere;</li>\n<li>A secondary orthogonality of the microvilli between MO[5,6].</li>\n</ul>\n","excerpt":"","more":"<h1 id=\"Notes-on-Stomatopod’s-visual-ability-2\"><a href=\"#Notes-on-Stomatopod’s-visual-ability-2\" class=\"headerlink\" title=\"Notes on Stomatopod’s visual ability: 2\"></a>Notes on Stomatopod’s visual ability: 2</h1><h2 id=\"Terms-and-abbreviations\"><a href=\"#Terms-and-abbreviations\" class=\"headerlink\" title=\"Terms and abbreviations\"></a>Terms and abbreviations</h2><table>\n<thead>\n<tr>\n<th>Abbreviation</th>\n<th>Term</th>\n<th>Description</th>\n<th>Notes</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>MO[x]</td>\n<td>mid-band ommatidia(中带复眼)</td>\n<td>Basic units of a mid-band.</td>\n<td>There are 6 <strong>rows</strong> of midband eyes, designated as MO[1-6]. Each ommatidium in MO[1-4] has 3 tiers of rhabdom. Each ommatidium in MO[5,6] has 2 tiers of rhabdom. A hemispherical ommatidium has 2 tiers of rhabdom.</td>\n</tr>\n<tr>\n<td>R[x]</td>\n<td>Rhabdomeres(感杆)</td>\n<td>The elongated rod-like portion of the retinular cells, the subunit of the rhabdom, containing closely spaced and longitudinal rows of microvilli and pigment granules.</td>\n<td>There are 8 <strong>types</strong> of rhabdomeres, designated as R[1-8]. R8 cells consist the most distal tier of rhabdom in all types (midband and hemispherical) of ommatidium.</td>\n</tr>\n<tr>\n<td>DR[x]</td>\n<td>Distally placed rhabdomeres(远端感杆)</td>\n<td>Rhabdomeres that consist the distally placed rhabdom in <strong>MO[1-4]</strong>, which is placed between the R[8] rhabdom and the PR rhabdom.</td>\n<td>There are 7 <strong>types</strong> of DR, which are R[1-7]. They are specially designated as DR[1-7].</td>\n</tr>\n<tr>\n<td>PR[x]</td>\n<td>Proximal placed rhabdomeres(近端感杆)</td>\n<td>Rhabdomeres that consist the proximally placed rhabdom in <strong>MO[1-4]</strong>, which is placed at the proximal end, that is, close to the basement menbrane.</td>\n<td>There are 7 <strong>types</strong> of PR, which are R[1-7]. They are specially designated as PR[1-7].</td>\n</tr>\n<tr>\n<td>F[x]</td>\n<td>Filter(滤光体)</td>\n<td>Specialized, coloured intra-rhabdomal structures in <strong>MO[2,3]</strong>, function as the filter of light in a specific wavelength band.</td>\n<td>There are 2 <strong>layers</strong> of filters, designated as F[1], F[2]. F[1] is relatively distal and F[2] is relatively proximal.</td>\n</tr>\n</tbody></table>\n<h2 id=\"General-structures-of-hemispherical-ommatidia\"><a href=\"#General-structures-of-hemispherical-ommatidia\" class=\"headerlink\" title=\"General structures of hemispherical ommatidia\"></a>General structures of hemispherical ommatidia</h2><p><img src=\"/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/ommatidia1.svg\" alt=\"Structure of hemispherical ommatidia\"></p>\n<h2 id=\"General-structures-of-mid-band-ommatidia\"><a href=\"#General-structures-of-mid-band-ommatidia\" class=\"headerlink\" title=\"General structures of mid-band ommatidia\"></a>General structures of mid-band ommatidia</h2><h3 id=\"General-Structure-of-MO-1-4\"><a href=\"#General-Structure-of-MO-1-4\" class=\"headerlink\" title=\"General Structure of MO[1-4]\"></a>General Structure of MO[1-4]</h3><p></p>\n<h3 id=\"Special-structures-of-MO-2-3-Filters\"><a href=\"#Special-structures-of-MO-2-3-Filters\" class=\"headerlink\" title=\"Special structures of MO[2,3] - Filters\"></a>Special structures of MO[2,3] - Filters</h3><p><img src=\"/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/filters.svg\" alt=\"filters\"></p>\n<h3 id=\"General-Structure-of-MO-5-6\"><a href=\"#General-Structure-of-MO-5-6\" class=\"headerlink\" title=\"General Structure of MO[5,6]\"></a>General Structure of MO[5,6]</h3><p>The General structure of MO[5,6] is similar to that of hemispherical ommatidia. However, the arrangement of microvillar in MO[5,6] are modified.</p>\n<ul>\n<li>Very thin layering with precise orthogonal arrangements in R[1-7];</li>\n<li>Unidirectionally arranged microvili in R[8];</li>\n<li>Elongated R[8] rhabdomere;</li>\n<li>A secondary orthogonality of the microvilli between MO[5,6].</li>\n</ul>\n"},{"title":"Hello World","_content":"Welcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).\n\n## Quick Start\n\n### Create a new post\n\n``` bash\n$ hexo new \"My New Post\"\n```\n\nMore info: [Writing](https://hexo.io/docs/writing.html)\n\n### Run server\n\n``` bash\n$ hexo server\n```\n\nMore info: [Server](https://hexo.io/docs/server.html)\n\n### Generate static files\n\n``` bash\n$ hexo generate\n```\n\nMore info: [Generating](https://hexo.io/docs/generating.html)\n\n### Deploy to remote sites\n\n``` bash\n$ hexo deploy\n```\n\nMore info: [Deployment](https://hexo.io/docs/one-command-deployment.html)\n","source":"_posts/hello-world.md","raw":"---\ntitle: Hello World\n---\nWelcome to [Hexo](https://hexo.io/)! This is your very first post. Check [documentation](https://hexo.io/docs/) for more info. If you get any problems when using Hexo, you can find the answer in [troubleshooting](https://hexo.io/docs/troubleshooting.html) or you can ask me on [GitHub](https://github.com/hexojs/hexo/issues).\n\n## Quick Start\n\n### Create a new post\n\n``` bash\n$ hexo new \"My New Post\"\n```\n\nMore info: [Writing](https://hexo.io/docs/writing.html)\n\n### Run server\n\n``` bash\n$ hexo server\n```\n\nMore info: [Server](https://hexo.io/docs/server.html)\n\n### Generate static files\n\n``` bash\n$ hexo generate\n```\n\nMore info: [Generating](https://hexo.io/docs/generating.html)\n\n### Deploy to remote sites\n\n``` bash\n$ hexo deploy\n```\n\nMore info: [Deployment](https://hexo.io/docs/one-command-deployment.html)\n","slug":"hello-world","published":1,"date":"2024-01-21T08:07:08.080Z","updated":"2024-01-21T08:07:08.080Z","comments":1,"layout":"post","photos":[],"_id":"clso7h26z0007sgujbcso9gki","content":"<p>Welcome to <a href=\"https://hexo.io/\">Hexo</a>! This is your very first post. Check <a href=\"https://hexo.io/docs/\">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href=\"https://hexo.io/docs/troubleshooting.html\">troubleshooting</a> or you can ask me on <a href=\"https://github.com/hexojs/hexo/issues\">GitHub</a>.</p>\n<h2 id=\"Quick-Start\"><a href=\"#Quick-Start\" class=\"headerlink\" title=\"Quick Start\"></a>Quick Start</h2><h3 id=\"Create-a-new-post\"><a href=\"#Create-a-new-post\" class=\"headerlink\" title=\"Create a new post\"></a>Create a new post</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo new <span class=\"string\">"My New Post"</span></span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/writing.html\">Writing</a></p>\n<h3 id=\"Run-server\"><a href=\"#Run-server\" class=\"headerlink\" title=\"Run server\"></a>Run server</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo server</span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/server.html\">Server</a></p>\n<h3 id=\"Generate-static-files\"><a href=\"#Generate-static-files\" class=\"headerlink\" title=\"Generate static files\"></a>Generate static files</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo generate</span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/generating.html\">Generating</a></p>\n<h3 id=\"Deploy-to-remote-sites\"><a href=\"#Deploy-to-remote-sites\" class=\"headerlink\" title=\"Deploy to remote sites\"></a>Deploy to remote sites</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo deploy</span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/one-command-deployment.html\">Deployment</a></p>\n","excerpt":"","more":"<p>Welcome to <a href=\"https://hexo.io/\">Hexo</a>! This is your very first post. Check <a href=\"https://hexo.io/docs/\">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href=\"https://hexo.io/docs/troubleshooting.html\">troubleshooting</a> or you can ask me on <a href=\"https://github.com/hexojs/hexo/issues\">GitHub</a>.</p>\n<h2 id=\"Quick-Start\"><a href=\"#Quick-Start\" class=\"headerlink\" title=\"Quick Start\"></a>Quick Start</h2><h3 id=\"Create-a-new-post\"><a href=\"#Create-a-new-post\" class=\"headerlink\" title=\"Create a new post\"></a>Create a new post</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo new <span class=\"string\">"My New Post"</span></span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/writing.html\">Writing</a></p>\n<h3 id=\"Run-server\"><a href=\"#Run-server\" class=\"headerlink\" title=\"Run server\"></a>Run server</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo server</span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/server.html\">Server</a></p>\n<h3 id=\"Generate-static-files\"><a href=\"#Generate-static-files\" class=\"headerlink\" title=\"Generate static files\"></a>Generate static files</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo generate</span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/generating.html\">Generating</a></p>\n<h3 id=\"Deploy-to-remote-sites\"><a href=\"#Deploy-to-remote-sites\" class=\"headerlink\" title=\"Deploy to remote sites\"></a>Deploy to remote sites</h3><figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">$ hexo deploy</span><br></pre></td></tr></table></figure>\n\n<p>More info: <a href=\"https://hexo.io/docs/one-command-deployment.html\">Deployment</a></p>\n"},{"title":"Notes on Stomatopod's visual ability 3","date":"2024-02-16T05:00:51.000Z","_content":"\n# Notes on Stomatopod's visual ability: 3\n\n## Summary of the structure of Stomatopod's eye\n\n### 1\n\nThe compound eye of a Stomatopod is a hemispherical structure connected to an eye stalk.\n\nThe compound eye consists of many ommatidia.\n\nEach ommatidia is mainly consists of\n\n- a cornea (facet) on the surface,\n\n- a crystalline cone underneath the cornea,\n\n- distal pigment cells surrounding the crystalline cones,\n\n- retinular cells (photoreceptor cells) underneath the crystalline cone.\n\n(Assume that the distal - proximal axis of an ommatidia is vertical, as is illustrated in [Notes on Stomatopod's visual ability: 2](https://michaellaw2003.github.io/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/) .)\n\n6 rows of special ommatidia divides the hemispherical compound eye into two parts, namely dorsal and ventral hemispheres (DH & VH).\n\nThese 6 rows of special ommatidia has larger cornea (facet), and are termed as mid-band ommatidia, designated as MO\\[1-6\\].\n\nThe cell membranes of retinular cells extend and form rhabdomeres, and the rhabdomeres form a bundle structure termed rhabdom. The rhabdom functions as a light guide.\n\nThe retinular cells are simply described as \"rhabdom\" in some documents.\n\n### 2\n\nThere are 8 retinular cells in an ommatidia, whose shape and location are different to each other, designated as R\\[1-8\\].\n\nDH & VH retinular cells are divided into two layers (based on the shape of the cross section imaging), namely distal end layer and proximal end layer. All the 8 retinular cells in an ommatidia are present at each layer (tier) .\n\nThe distal end layer mainly consists of a single R\\[8\\] cell. The proximal end layer consists of R\\[1-7\\] cells, which form a flower-like ring structure, with the rhabdomeres at the center of the ring.\n\nThe retinular cells of MO\\[1-4\\] are three layered, with a distal end layer similar to that of DH & VH ommatidia, but the proximal end layer are divided into two sub-layers.\n\nAll the R\\[1-7\\] cells are present in the two sub-layers at the proximal end. In MO\\[1,3,4\\], the R\\[1,4,5\\] cells are above the R\\[2,3,6,7\\], while in MO\\[2\\], the R\\[2,3,6,7\\] cells are above the R\\[1,4,5\\] cells.\n\nAll the R\\[1-8\\] cells construct the retinula with both small distal projections (microvilli) in the rhabdom, and the axons connected to the optic nerve centers.\n\nThe retinula of all the ommatidia consist retina.\n\n## Notes on connectivity of optic neuropils\n\n**Lamina ganglionaris** (lamina) and **medulla externa** (ME), **medulla interna**(MI), **medulla terminalis**(NT) in the eye rod are optic neuropils in Stomatopods.(Marshall et al., 2007)\n\nAll optic neuropils have **subdivisions** reflecting subdivisions of the retina - DH, midband, VH.(Marshall et al., 2007)\n\nThe axons of the photorecepters project to the lamina, forming synapses with lamina monopolar cells LMCs.(This conclusion is from a paper introducing butterfly, and thus may be inaccurate for mantis shrimps.) (Matsushita et al., 2022)\n\nOn the way from basement membrane to the lamina, axons form **fasicles**, in which the arrangement of the axons twists 180°. The collection of axons and **LMCs** consists of a structure termed as the **cartridge**.(Marshall et al., 2007)\n\nIn the image of the section at the level of the lamina, the lamina cartridge of MO\\[5,6\\] are ovoid in shape, the MO\\[1-4\\] rectangular, and DH/VH hexagonal.(Marshall et al., 2007)\n\n## References\n\nMarshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. *Arthropod Struct Dev*, *36*(4), 420-448. <https://doi.org/10.1016/j.asd.2007.01.006>\n\nMatsushita, A., Stewart, F., Ilić, M., Chen, P.-J., Wakita, D., Miyazaki, N., Murata, K., Kinoshita, M., Belušič, G., & Arikawa, K. (2022). Connectome of the lamina reveals the circuit for early color processing in the visual pathway of a butterfly. *Current Biology*, *32*(10), 2291-2299.e2293. <https://doi.org/10.1016/j.cub.2022.03.066> (Current Biology)\n","source":"_posts/Notes-on-Stomatopod-s-visual-ability-3.md","raw":"---\ntitle: Notes on Stomatopod's visual ability 3\ndate: 2024-02-16 13:00:51\ntags:\n - mantis shrimp\n - vision\n - neuroscience\n - note\ncategories:\n neuroscience\n---\n\n# Notes on Stomatopod's visual ability: 3\n\n## Summary of the structure of Stomatopod's eye\n\n### 1\n\nThe compound eye of a Stomatopod is a hemispherical structure connected to an eye stalk.\n\nThe compound eye consists of many ommatidia.\n\nEach ommatidia is mainly consists of\n\n- a cornea (facet) on the surface,\n\n- a crystalline cone underneath the cornea,\n\n- distal pigment cells surrounding the crystalline cones,\n\n- retinular cells (photoreceptor cells) underneath the crystalline cone.\n\n(Assume that the distal - proximal axis of an ommatidia is vertical, as is illustrated in [Notes on Stomatopod's visual ability: 2](https://michaellaw2003.github.io/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/) .)\n\n6 rows of special ommatidia divides the hemispherical compound eye into two parts, namely dorsal and ventral hemispheres (DH & VH).\n\nThese 6 rows of special ommatidia has larger cornea (facet), and are termed as mid-band ommatidia, designated as MO\\[1-6\\].\n\nThe cell membranes of retinular cells extend and form rhabdomeres, and the rhabdomeres form a bundle structure termed rhabdom. The rhabdom functions as a light guide.\n\nThe retinular cells are simply described as \"rhabdom\" in some documents.\n\n### 2\n\nThere are 8 retinular cells in an ommatidia, whose shape and location are different to each other, designated as R\\[1-8\\].\n\nDH & VH retinular cells are divided into two layers (based on the shape of the cross section imaging), namely distal end layer and proximal end layer. All the 8 retinular cells in an ommatidia are present at each layer (tier) .\n\nThe distal end layer mainly consists of a single R\\[8\\] cell. The proximal end layer consists of R\\[1-7\\] cells, which form a flower-like ring structure, with the rhabdomeres at the center of the ring.\n\nThe retinular cells of MO\\[1-4\\] are three layered, with a distal end layer similar to that of DH & VH ommatidia, but the proximal end layer are divided into two sub-layers.\n\nAll the R\\[1-7\\] cells are present in the two sub-layers at the proximal end. In MO\\[1,3,4\\], the R\\[1,4,5\\] cells are above the R\\[2,3,6,7\\], while in MO\\[2\\], the R\\[2,3,6,7\\] cells are above the R\\[1,4,5\\] cells.\n\nAll the R\\[1-8\\] cells construct the retinula with both small distal projections (microvilli) in the rhabdom, and the axons connected to the optic nerve centers.\n\nThe retinula of all the ommatidia consist retina.\n\n## Notes on connectivity of optic neuropils\n\n**Lamina ganglionaris** (lamina) and **medulla externa** (ME), **medulla interna**(MI), **medulla terminalis**(NT) in the eye rod are optic neuropils in Stomatopods.(Marshall et al., 2007)\n\nAll optic neuropils have **subdivisions** reflecting subdivisions of the retina - DH, midband, VH.(Marshall et al., 2007)\n\nThe axons of the photorecepters project to the lamina, forming synapses with lamina monopolar cells LMCs.(This conclusion is from a paper introducing butterfly, and thus may be inaccurate for mantis shrimps.) (Matsushita et al., 2022)\n\nOn the way from basement membrane to the lamina, axons form **fasicles**, in which the arrangement of the axons twists 180°. The collection of axons and **LMCs** consists of a structure termed as the **cartridge**.(Marshall et al., 2007)\n\nIn the image of the section at the level of the lamina, the lamina cartridge of MO\\[5,6\\] are ovoid in shape, the MO\\[1-4\\] rectangular, and DH/VH hexagonal.(Marshall et al., 2007)\n\n## References\n\nMarshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. *Arthropod Struct Dev*, *36*(4), 420-448. <https://doi.org/10.1016/j.asd.2007.01.006>\n\nMatsushita, A., Stewart, F., Ilić, M., Chen, P.-J., Wakita, D., Miyazaki, N., Murata, K., Kinoshita, M., Belušič, G., & Arikawa, K. (2022). Connectome of the lamina reveals the circuit for early color processing in the visual pathway of a butterfly. *Current Biology*, *32*(10), 2291-2299.e2293. <https://doi.org/10.1016/j.cub.2022.03.066> (Current Biology)\n","slug":"Notes-on-Stomatopod-s-visual-ability-3","published":1,"updated":"2024-02-16T05:09:18.874Z","comments":1,"layout":"post","photos":[],"_id":"clso7h2700008sguj0ghua3aj","content":"<h1 id=\"Notes-on-Stomatopod’s-visual-ability-3\"><a href=\"#Notes-on-Stomatopod’s-visual-ability-3\" class=\"headerlink\" title=\"Notes on Stomatopod’s visual ability: 3\"></a>Notes on Stomatopod’s visual ability: 3</h1><h2 id=\"Summary-of-the-structure-of-Stomatopod’s-eye\"><a href=\"#Summary-of-the-structure-of-Stomatopod’s-eye\" class=\"headerlink\" title=\"Summary of the structure of Stomatopod’s eye\"></a>Summary of the structure of Stomatopod’s eye</h2><h3 id=\"1\"><a href=\"#1\" class=\"headerlink\" title=\"1\"></a>1</h3><p>The compound eye of a Stomatopod is a hemispherical structure connected to an eye stalk.</p>\n<p>The compound eye consists of many ommatidia.</p>\n<p>Each ommatidia is mainly consists of</p>\n<ul>\n<li><p>a cornea (facet) on the surface,</p>\n</li>\n<li><p>a crystalline cone underneath the cornea,</p>\n</li>\n<li><p>distal pigment cells surrounding the crystalline cones,</p>\n</li>\n<li><p>retinular cells (photoreceptor cells) underneath the crystalline cone.</p>\n</li>\n</ul>\n<p>(Assume that the distal - proximal axis of an ommatidia is vertical, as is illustrated in <a href=\"https://michaellaw2003.github.io/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/\">Notes on Stomatopod’s visual ability: 2</a> .)</p>\n<p>6 rows of special ommatidia divides the hemispherical compound eye into two parts, namely dorsal and ventral hemispheres (DH & VH).</p>\n<p>These 6 rows of special ommatidia has larger cornea (facet), and are termed as mid-band ommatidia, designated as MO[1-6].</p>\n<p>The cell membranes of retinular cells extend and form rhabdomeres, and the rhabdomeres form a bundle structure termed rhabdom. The rhabdom functions as a light guide.</p>\n<p>The retinular cells are simply described as “rhabdom” in some documents.</p>\n<h3 id=\"2\"><a href=\"#2\" class=\"headerlink\" title=\"2\"></a>2</h3><p>There are 8 retinular cells in an ommatidia, whose shape and location are different to each other, designated as R[1-8].</p>\n<p>DH & VH retinular cells are divided into two layers (based on the shape of the cross section imaging), namely distal end layer and proximal end layer. All the 8 retinular cells in an ommatidia are present at each layer (tier) .</p>\n<p>The distal end layer mainly consists of a single R[8] cell. The proximal end layer consists of R[1-7] cells, which form a flower-like ring structure, with the rhabdomeres at the center of the ring.</p>\n<p>The retinular cells of MO[1-4] are three layered, with a distal end layer similar to that of DH & VH ommatidia, but the proximal end layer are divided into two sub-layers.</p>\n<p>All the R[1-7] cells are present in the two sub-layers at the proximal end. In MO[1,3,4], the R[1,4,5] cells are above the R[2,3,6,7], while in MO[2], the R[2,3,6,7] cells are above the R[1,4,5] cells.</p>\n<p>All the R[1-8] cells construct the retinula with both small distal projections (microvilli) in the rhabdom, and the axons connected to the optic nerve centers.</p>\n<p>The retinula of all the ommatidia consist retina.</p>\n<h2 id=\"Notes-on-connectivity-of-optic-neuropils\"><a href=\"#Notes-on-connectivity-of-optic-neuropils\" class=\"headerlink\" title=\"Notes on connectivity of optic neuropils\"></a>Notes on connectivity of optic neuropils</h2><p><strong>Lamina ganglionaris</strong> (lamina) and <strong>medulla externa</strong> (ME), <strong>medulla interna</strong>(MI), <strong>medulla terminalis</strong>(NT) in the eye rod are optic neuropils in Stomatopods.(Marshall et al., 2007)</p>\n<p>All optic neuropils have <strong>subdivisions</strong> reflecting subdivisions of the retina - DH, midband, VH.(Marshall et al., 2007)</p>\n<p>The axons of the photorecepters project to the lamina, forming synapses with lamina monopolar cells LMCs.(This conclusion is from a paper introducing butterfly, and thus may be inaccurate for mantis shrimps.) (Matsushita et al., 2022)</p>\n<p>On the way from basement membrane to the lamina, axons form <strong>fasicles</strong>, in which the arrangement of the axons twists 180°. The collection of axons and <strong>LMCs</strong> consists of a structure termed as the <strong>cartridge</strong>.(Marshall et al., 2007)</p>\n<p>In the image of the section at the level of the lamina, the lamina cartridge of MO[5,6] are ovoid in shape, the MO[1-4] rectangular, and DH/VH hexagonal.(Marshall et al., 2007)</p>\n<h2 id=\"References\"><a href=\"#References\" class=\"headerlink\" title=\"References\"></a>References</h2><p>Marshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. <em>Arthropod Struct Dev</em>, <em>36</em>(4), 420-448. <a href=\"https://doi.org/10.1016/j.asd.2007.01.006\">https://doi.org/10.1016/j.asd.2007.01.006</a></p>\n<p>Matsushita, A., Stewart, F., Ilić, M., Chen, P.-J., Wakita, D., Miyazaki, N., Murata, K., Kinoshita, M., Belušič, G., & Arikawa, K. (2022). Connectome of the lamina reveals the circuit for early color processing in the visual pathway of a butterfly. <em>Current Biology</em>, <em>32</em>(10), 2291-2299.e2293. <a href=\"https://doi.org/10.1016/j.cub.2022.03.066\">https://doi.org/10.1016/j.cub.2022.03.066</a> (Current Biology)</p>\n","excerpt":"","more":"<h1 id=\"Notes-on-Stomatopod’s-visual-ability-3\"><a href=\"#Notes-on-Stomatopod’s-visual-ability-3\" class=\"headerlink\" title=\"Notes on Stomatopod’s visual ability: 3\"></a>Notes on Stomatopod’s visual ability: 3</h1><h2 id=\"Summary-of-the-structure-of-Stomatopod’s-eye\"><a href=\"#Summary-of-the-structure-of-Stomatopod’s-eye\" class=\"headerlink\" title=\"Summary of the structure of Stomatopod’s eye\"></a>Summary of the structure of Stomatopod’s eye</h2><h3 id=\"1\"><a href=\"#1\" class=\"headerlink\" title=\"1\"></a>1</h3><p>The compound eye of a Stomatopod is a hemispherical structure connected to an eye stalk.</p>\n<p>The compound eye consists of many ommatidia.</p>\n<p>Each ommatidia is mainly consists of</p>\n<ul>\n<li><p>a cornea (facet) on the surface,</p>\n</li>\n<li><p>a crystalline cone underneath the cornea,</p>\n</li>\n<li><p>distal pigment cells surrounding the crystalline cones,</p>\n</li>\n<li><p>retinular cells (photoreceptor cells) underneath the crystalline cone.</p>\n</li>\n</ul>\n<p>(Assume that the distal - proximal axis of an ommatidia is vertical, as is illustrated in <a href=\"https://michaellaw2003.github.io/2024/02/03/Notes-on-Stomatopod-s-visual-ability-2/\">Notes on Stomatopod’s visual ability: 2</a> .)</p>\n<p>6 rows of special ommatidia divides the hemispherical compound eye into two parts, namely dorsal and ventral hemispheres (DH & VH).</p>\n<p>These 6 rows of special ommatidia has larger cornea (facet), and are termed as mid-band ommatidia, designated as MO[1-6].</p>\n<p>The cell membranes of retinular cells extend and form rhabdomeres, and the rhabdomeres form a bundle structure termed rhabdom. The rhabdom functions as a light guide.</p>\n<p>The retinular cells are simply described as “rhabdom” in some documents.</p>\n<h3 id=\"2\"><a href=\"#2\" class=\"headerlink\" title=\"2\"></a>2</h3><p>There are 8 retinular cells in an ommatidia, whose shape and location are different to each other, designated as R[1-8].</p>\n<p>DH & VH retinular cells are divided into two layers (based on the shape of the cross section imaging), namely distal end layer and proximal end layer. All the 8 retinular cells in an ommatidia are present at each layer (tier) .</p>\n<p>The distal end layer mainly consists of a single R[8] cell. The proximal end layer consists of R[1-7] cells, which form a flower-like ring structure, with the rhabdomeres at the center of the ring.</p>\n<p>The retinular cells of MO[1-4] are three layered, with a distal end layer similar to that of DH & VH ommatidia, but the proximal end layer are divided into two sub-layers.</p>\n<p>All the R[1-7] cells are present in the two sub-layers at the proximal end. In MO[1,3,4], the R[1,4,5] cells are above the R[2,3,6,7], while in MO[2], the R[2,3,6,7] cells are above the R[1,4,5] cells.</p>\n<p>All the R[1-8] cells construct the retinula with both small distal projections (microvilli) in the rhabdom, and the axons connected to the optic nerve centers.</p>\n<p>The retinula of all the ommatidia consist retina.</p>\n<h2 id=\"Notes-on-connectivity-of-optic-neuropils\"><a href=\"#Notes-on-connectivity-of-optic-neuropils\" class=\"headerlink\" title=\"Notes on connectivity of optic neuropils\"></a>Notes on connectivity of optic neuropils</h2><p><strong>Lamina ganglionaris</strong> (lamina) and <strong>medulla externa</strong> (ME), <strong>medulla interna</strong>(MI), <strong>medulla terminalis</strong>(NT) in the eye rod are optic neuropils in Stomatopods.(Marshall et al., 2007)</p>\n<p>All optic neuropils have <strong>subdivisions</strong> reflecting subdivisions of the retina - DH, midband, VH.(Marshall et al., 2007)</p>\n<p>The axons of the photorecepters project to the lamina, forming synapses with lamina monopolar cells LMCs.(This conclusion is from a paper introducing butterfly, and thus may be inaccurate for mantis shrimps.) (Matsushita et al., 2022)</p>\n<p>On the way from basement membrane to the lamina, axons form <strong>fasicles</strong>, in which the arrangement of the axons twists 180°. The collection of axons and <strong>LMCs</strong> consists of a structure termed as the <strong>cartridge</strong>.(Marshall et al., 2007)</p>\n<p>In the image of the section at the level of the lamina, the lamina cartridge of MO[5,6] are ovoid in shape, the MO[1-4] rectangular, and DH/VH hexagonal.(Marshall et al., 2007)</p>\n<h2 id=\"References\"><a href=\"#References\" class=\"headerlink\" title=\"References\"></a>References</h2><p>Marshall, J., Cronin, T. W., & Kleinlogel, S. (2007). Stomatopod eye structure and function: a review. <em>Arthropod Struct Dev</em>, <em>36</em>(4), 420-448. <a href=\"https://doi.org/10.1016/j.asd.2007.01.006\">https://doi.org/10.1016/j.asd.2007.01.006</a></p>\n<p>Matsushita, A., Stewart, F., Ilić, M., Chen, P.-J., Wakita, D., Miyazaki, N., Murata, K., Kinoshita, M., Belušič, G., & Arikawa, K. (2022). Connectome of the lamina reveals the circuit for early color processing in the visual pathway of a butterfly. <em>Current Biology</em>, <em>32</em>(10), 2291-2299.e2293. <a href=\"https://doi.org/10.1016/j.cub.2022.03.066\">https://doi.org/10.1016/j.cub.2022.03.066</a> (Current Biology)</p>\n"},{"title":"PyRosetta Default Initiation","date":"2025-08-21T04:41:03.000Z","updated":"2025-08-21T04:41:06.000Z","_content":"# PyRosetta Default Initiation\n```python\nfrom pyrosetta import *\ninit() # pyrosetta.rosetta.init() # We can pass in Rosetta commandlines here\n#import pyrosetta\n#pyrosetta.init()\n```\n\n","source":"_posts/Note _ PyRosetta Basic Initiation.md","raw":"title: PyRosetta Default Initiation\ndate: '2025-08-21 12:41:03'\nupdated: '2025-08-21 12:41:06'\ntags:\n - PyRosetta\n - biochemistry\n - protein\n - protein design\n - note\ncategories:\n - protein design\n---\n# PyRosetta Default Initiation\n```python\nfrom pyrosetta import *\ninit() # pyrosetta.rosetta.init() # We can pass in Rosetta commandlines here\n#import pyrosetta\n#pyrosetta.init()\n```\n\n","slug":"Note _ PyRosetta Basic Initiation","published":1,"comments":1,"layout":"post","photos":[],"_id":"cmekx8a7i003zcgu67fw1eqyu","content":"<h1 id=\"PyRosetta-Default-Initiation\"><a href=\"#PyRosetta-Default-Initiation\" class=\"headerlink\" title=\"PyRosetta Default Initiation\"></a>PyRosetta Default Initiation</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init() <span class=\"comment\"># pyrosetta.rosetta.init() # We can pass in Rosetta commandlines here</span></span><br><span class=\"line\"><span class=\"comment\">#import pyrosetta</span></span><br><span class=\"line\"><span class=\"comment\">#pyrosetta.init()</span></span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyRosetta-Default-Initiation\"><a href=\"#PyRosetta-Default-Initiation\" class=\"headerlink\" title=\"PyRosetta Default Initiation\"></a>PyRosetta Default Initiation</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init() <span class=\"comment\"># pyrosetta.rosetta.init() # We can pass in Rosetta commandlines here</span></span><br><span class=\"line\"><span class=\"comment\">#import pyrosetta</span></span><br><span class=\"line\"><span class=\"comment\">#pyrosetta.init()</span></span><br></pre></td></tr></table></figure>\n\n"},{"title":"PyRosetta Basics (2): PyMOL Mover","date":"2025-08-21T04:41:34.000Z","updated":"2025-08-21T04:41:37.000Z","_content":"# PyMOL Mover\n```python\nfrom pyrosetta import *\ninit()\n#import pyrosetta\n#pyrosetta.init()\n```\n\n```python\nmy_pose = pose_from_pdb(\"inputs/5tj3.pdb\")\n```\n\n## Resource\n[https://www.pyrosetta.org/documentation/pymol_mover-tutorial](https://www.pyrosetta.org/documentation/pymol_mover-tutorial)\n\n## `PyMOLMover` class\nThe PyMOLMover class will let us send information from PyRosetta to PyMOL for quick visualization. \n\n### Setup PyMOL\n#### Get Configuration file: `<font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py</font>`(in Linux)\n<font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py</font><font style=\"color:rgb(33, 33, 33);\"> is found in the main directory of PyRosetta.</font>\n\n<font style=\"color:rgb(33, 33, 33);\">The path to PyRosetta can be discovered in the init information.</font>\n\n<font style=\"color:rgb(33, 33, 33);\">For example:</font>\n\n```bash\nRequirement already satisfied: pyrosettacolabsetup in /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages (1.0.9)\n┌──────────────────────────────────────────────────────────────────────────────┐\n│ PyRosetta-4 │\n│ Created in JHU by Sergey Lyskov and PyRosetta Team │\n│ (C) Copyright Rosetta Commons Member Institutions │\n│ │\n│ NOTE: USE OF PyRosetta FOR COMMERCIAL PURPOSES REQUIRE PURCHASE OF A LICENSE │\n│ See LICENSE.PyRosetta.md or email license@uw.edu for details │\n└──────────────────────────────────────────────────────────────────────────────┘\nPyRosetta-4 2025 [Rosetta PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release 2025.24+release.8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 2025-06-06T09:20:57] retrieved from: http://www.pyrosetta.org\ncore.init: Checking for fconfig files in pwd and ./rosetta/flags\ncore.init: Rosetta version: PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release r403 2025.24+release.8e1e5e54f0 8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 http://www.pyrosetta.org 2025-06-06T09:20:57\ncore.init: Rosetta extras: [cxx11thread, serialization]\ncore.init: command: PyRosetta -ex1 -ex2aro -database /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/database\nbasic.random.init_random_generator: 'RNG device' seed mode, using '/dev/urandom', seed=-481462242 seed_offset=0 real_seed=-481462242 thread_index=0\nbasic.random.init_random_generator: RandomGenerator:init: Normal mode, seed=-481462242 RG_type=mt19937\n```\n\nIn this example, path to PyRosetta is:\n\n`/home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/`\n\n#### Copy & edit the configuration file (in Windows)\nI'm using PyMol on Windows, and pyRosetta on WSL Ubuntu.\n\nTherefore, I have to edit the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font>file to appoint a correct IP address.\n\n[https://learn.microsoft.com/en-us/windows/wsl/networking](https://learn.microsoft.com/en-us/windows/wsl/networking)\n\n> <font style=\"color:rgb(22, 22, 22);\">A program running inside a Linux distribution via WSL2 (instance) wants to know the Windows host's IP address, so that a Linux program can connect to a Windows host server program.</font>\n>\n\n```bash\nip route show | grep -i default | awk '{ print $3}'\n```\n\nAnd a typical output might look like:\n\n```powershell\n>>> 172.24.112.1\n```\n\nCopy the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> from Linux to Windows (to D:).</font>\n\n```bash\ncp <Path-to-PyRosetta>/PyMOLPyRosettaServer.py /mnt/d/\n```\n\nAnd edit the file according to the comments within it. (The IP configuration is in the last few lines.) Appoint the right remote IP, and appoint an available port (e.g. `65000`).\n\n#### Apply the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> to PyMOL (in Windows)</font>\na. Drag the file to PyMOL window.\n\nb. Or, run the following commands in the PyMOL command line.\n\n```powershell\ncd D: #Because I save PyMOLRosettaServer.py there.\nrun PyMOLRosettaServer.py\n```\n\nc. Or, save the commands above to `pymolrc.pml`; thus it runs automatically each time pyMOL launches \n(The `pymolrc.pml`file can be found from GUI menu: `File` >> `Edit pymolrc`)\n\n### Instantiation of `PyMOLMover`\n```python\npmm = PyMOLMover(\"172.24.112.1\", 65000)\n```\n\n\n\n### `PyMOLMover`methods\n#### Keep history\nThe method `keep_history`, if set to True, allows you to load in structures with the same name into states of the same object in PyMOL. \n\nThis is the starting point for creating a PyMOL movie of your structure.\n\n```python\npmm.keep_history(True) # This keeps history of all poses sent to PyMOL\n```\n\n#### Send a `pose` object to PyMOL\n```python\npmm.apply(my_pose)\n# After running this, my_pose is expected to show up in the PyMOL window\n```\n\nSee `AddPyMOLObserver`class for information about automatic updating the _pose_ during _move._\n\n#### Send energy (energy across every residue) of a `pose`object to PyMOL\n```python\n# assume that `pmm` is an instance of `PyMOLMover`\n# assume that `my_pose` is an instance of `Pose`\npmm.send_energy(my_pose) # visualize the distribution of energy across the structure\npmm.send_energy(my_pose, fa_sol) # visualize the distribution of solvation energy (of full atom energy landscape) across the structure\n```\n\n#### Send properties of the `pose`object to PyMOL\n```python\n# if you have scored the pose first, you can:\npmm.send_hbonds(my_pose) #show all hydrogen bonds in PyMOL\n```\n\n## `AddPyMOLObserver`class\n<font style=\"color:rgba(0, 0, 0, 0.87);\">The observer is configured to execute a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">PyMOLMover.apply()</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> every time a change is observed in the pose coordinates. The </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">True</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> is a flag to ensure that PyMOL keeps a history of the moves.</font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">The observer should be added before excuting the </font>_<font style=\"color:rgba(0, 0, 0, 0.87);\">move(s).</font>_\n\n```python\nobserver = pyrosetta.rosetta.protocols.moves.AddPyMOLObserver(my_pose, True)\nmy_mover.apply(my_pose)\n```\n\n","source":"_posts/Note _ PyRosetta Basics (2)_ PyMOL Mover.md","raw":"title: 'PyRosetta Basics (2): PyMOL Mover'\ndate: '2025-08-21 12:41:34'\nupdated: '2025-08-21 12:41:37'\ntags:\n - PyRosetta\n - biochemistry\n - protein design\n - protein\n - note\ncategories:\n - protein design\n---\n# PyMOL Mover\n```python\nfrom pyrosetta import *\ninit()\n#import pyrosetta\n#pyrosetta.init()\n```\n\n```python\nmy_pose = pose_from_pdb(\"inputs/5tj3.pdb\")\n```\n\n## Resource\n[https://www.pyrosetta.org/documentation/pymol_mover-tutorial](https://www.pyrosetta.org/documentation/pymol_mover-tutorial)\n\n## `PyMOLMover` class\nThe PyMOLMover class will let us send information from PyRosetta to PyMOL for quick visualization. \n\n### Setup PyMOL\n#### Get Configuration file: `<font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py</font>`(in Linux)\n<font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py</font><font style=\"color:rgb(33, 33, 33);\"> is found in the main directory of PyRosetta.</font>\n\n<font style=\"color:rgb(33, 33, 33);\">The path to PyRosetta can be discovered in the init information.</font>\n\n<font style=\"color:rgb(33, 33, 33);\">For example:</font>\n\n```bash\nRequirement already satisfied: pyrosettacolabsetup in /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages (1.0.9)\n┌──────────────────────────────────────────────────────────────────────────────┐\n│ PyRosetta-4 │\n│ Created in JHU by Sergey Lyskov and PyRosetta Team │\n│ (C) Copyright Rosetta Commons Member Institutions │\n│ │\n│ NOTE: USE OF PyRosetta FOR COMMERCIAL PURPOSES REQUIRE PURCHASE OF A LICENSE │\n│ See LICENSE.PyRosetta.md or email license@uw.edu for details │\n└──────────────────────────────────────────────────────────────────────────────┘\nPyRosetta-4 2025 [Rosetta PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release 2025.24+release.8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 2025-06-06T09:20:57] retrieved from: http://www.pyrosetta.org\ncore.init: Checking for fconfig files in pwd and ./rosetta/flags\ncore.init: Rosetta version: PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release r403 2025.24+release.8e1e5e54f0 8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 http://www.pyrosetta.org 2025-06-06T09:20:57\ncore.init: Rosetta extras: [cxx11thread, serialization]\ncore.init: command: PyRosetta -ex1 -ex2aro -database /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/database\nbasic.random.init_random_generator: 'RNG device' seed mode, using '/dev/urandom', seed=-481462242 seed_offset=0 real_seed=-481462242 thread_index=0\nbasic.random.init_random_generator: RandomGenerator:init: Normal mode, seed=-481462242 RG_type=mt19937\n```\n\nIn this example, path to PyRosetta is:\n\n`/home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/`\n\n#### Copy & edit the configuration file (in Windows)\nI'm using PyMol on Windows, and pyRosetta on WSL Ubuntu.\n\nTherefore, I have to edit the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font>file to appoint a correct IP address.\n\n[https://learn.microsoft.com/en-us/windows/wsl/networking](https://learn.microsoft.com/en-us/windows/wsl/networking)\n\n> <font style=\"color:rgb(22, 22, 22);\">A program running inside a Linux distribution via WSL2 (instance) wants to know the Windows host's IP address, so that a Linux program can connect to a Windows host server program.</font>\n>\n\n```bash\nip route show | grep -i default | awk '{ print $3}'\n```\n\nAnd a typical output might look like:\n\n```powershell\n>>> 172.24.112.1\n```\n\nCopy the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> from Linux to Windows (to D:).</font>\n\n```bash\ncp <Path-to-PyRosetta>/PyMOLPyRosettaServer.py /mnt/d/\n```\n\nAnd edit the file according to the comments within it. (The IP configuration is in the last few lines.) Appoint the right remote IP, and appoint an available port (e.g. `65000`).\n\n#### Apply the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> to PyMOL (in Windows)</font>\na. Drag the file to PyMOL window.\n\nb. Or, run the following commands in the PyMOL command line.\n\n```powershell\ncd D: #Because I save PyMOLRosettaServer.py there.\nrun PyMOLRosettaServer.py\n```\n\nc. Or, save the commands above to `pymolrc.pml`; thus it runs automatically each time pyMOL launches \n(The `pymolrc.pml`file can be found from GUI menu: `File` >> `Edit pymolrc`)\n\n### Instantiation of `PyMOLMover`\n```python\npmm = PyMOLMover(\"172.24.112.1\", 65000)\n```\n\n\n\n### `PyMOLMover`methods\n#### Keep history\nThe method `keep_history`, if set to True, allows you to load in structures with the same name into states of the same object in PyMOL. \n\nThis is the starting point for creating a PyMOL movie of your structure.\n\n```python\npmm.keep_history(True) # This keeps history of all poses sent to PyMOL\n```\n\n#### Send a `pose` object to PyMOL\n```python\npmm.apply(my_pose)\n# After running this, my_pose is expected to show up in the PyMOL window\n```\n\nSee `AddPyMOLObserver`class for information about automatic updating the _pose_ during _move._\n\n#### Send energy (energy across every residue) of a `pose`object to PyMOL\n```python\n# assume that `pmm` is an instance of `PyMOLMover`\n# assume that `my_pose` is an instance of `Pose`\npmm.send_energy(my_pose) # visualize the distribution of energy across the structure\npmm.send_energy(my_pose, fa_sol) # visualize the distribution of solvation energy (of full atom energy landscape) across the structure\n```\n\n#### Send properties of the `pose`object to PyMOL\n```python\n# if you have scored the pose first, you can:\npmm.send_hbonds(my_pose) #show all hydrogen bonds in PyMOL\n```\n\n## `AddPyMOLObserver`class\n<font style=\"color:rgba(0, 0, 0, 0.87);\">The observer is configured to execute a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">PyMOLMover.apply()</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> every time a change is observed in the pose coordinates. The </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">True</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> is a flag to ensure that PyMOL keeps a history of the moves.</font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">The observer should be added before excuting the </font>_<font style=\"color:rgba(0, 0, 0, 0.87);\">move(s).</font>_\n\n```python\nobserver = pyrosetta.rosetta.protocols.moves.AddPyMOLObserver(my_pose, True)\nmy_mover.apply(my_pose)\n```\n\n","slug":"Note _ PyRosetta Basics (2)_ PyMOL Mover","published":1,"comments":1,"layout":"post","photos":[],"_id":"cmekx8a7l0040cgu6bl89942f","content":"<h1 id=\"PyMOL-Mover\"><a href=\"#PyMOL-Mover\" class=\"headerlink\" title=\"PyMOL Mover\"></a>PyMOL Mover</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init()</span><br><span class=\"line\"><span class=\"comment\">#import pyrosetta</span></span><br><span class=\"line\"><span class=\"comment\">#pyrosetta.init()</span></span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose = pose_from_pdb(<span class=\"string\">"inputs/5tj3.pdb"</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Resource\"><a href=\"#Resource\" class=\"headerlink\" title=\"Resource\"></a>Resource</h2><p><a href=\"https://www.pyrosetta.org/documentation/pymol_mover-tutorial\">https://www.pyrosetta.org/documentation/pymol_mover-tutorial</a></p>\n<h2 id=\"PyMOLMover-class\"><a href=\"#PyMOLMover-class\" class=\"headerlink\" title=\"PyMOLMover class\"></a><code>PyMOLMover</code> class</h2><p>The PyMOLMover class will let us send information from PyRosetta to PyMOL for quick visualization. </p>\n<h3 id=\"Setup-PyMOL\"><a href=\"#Setup-PyMOL\" class=\"headerlink\" title=\"Setup PyMOL\"></a>Setup PyMOL</h3><h4 id=\"Get-Configuration-file-PyMOLPyRosettaServer-py-in-Linux\"><a href=\"#Get-Configuration-file-PyMOLPyRosettaServer-py-in-Linux\" class=\"headerlink\" title=\"Get Configuration file: <font style="color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);">PyMOLPyRosettaServer.py</font>(in Linux)\"></a>Get Configuration file: <code><font style="color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);">PyMOLPyRosettaServer.py</font></code>(in Linux)</h4><p><font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py</font><font style=\"color:rgb(33, 33, 33);\"> is found in the main directory of PyRosetta.</font></p>\n<p><font style=\"color:rgb(33, 33, 33);\">The path to PyRosetta can be discovered in the init information.</font></p>\n<p><font style=\"color:rgb(33, 33, 33);\">For example:</font></p>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Requirement already satisfied: pyrosettacolabsetup <span class=\"keyword\">in</span> /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages (1.0.9)</span><br><span class=\"line\">┌──────────────────────────────────────────────────────────────────────────────┐</span><br><span class=\"line\">│ PyRosetta-4 │</span><br><span class=\"line\">│ Created <span class=\"keyword\">in</span> JHU by Sergey Lyskov and PyRosetta Team │</span><br><span class=\"line\">│ (C) Copyright Rosetta Commons Member Institutions │</span><br><span class=\"line\">│ │</span><br><span class=\"line\">│ NOTE: USE OF PyRosetta FOR COMMERCIAL PURPOSES REQUIRE PURCHASE OF A LICENSE │</span><br><span class=\"line\">│ See LICENSE.PyRosetta.md or email license@uw.edu <span class=\"keyword\">for</span> details │</span><br><span class=\"line\">└──────────────────────────────────────────────────────────────────────────────┘</span><br><span class=\"line\">PyRosetta-4 2025 [Rosetta PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release 2025.24+release.8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 2025-06-06T09:20:57] retrieved from: http://www.pyrosetta.org</span><br><span class=\"line\">core.init: Checking <span class=\"keyword\">for</span> fconfig files <span class=\"keyword\">in</span> <span class=\"built_in\">pwd</span> and ./rosetta/flags</span><br><span class=\"line\">core.init: Rosetta version: PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release r403 2025.24+release.8e1e5e54f0 8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 http://www.pyrosetta.org 2025-06-06T09:20:57</span><br><span class=\"line\">core.init: Rosetta extras: [cxx11thread, serialization]</span><br><span class=\"line\">core.init: <span class=\"built_in\">command</span>: PyRosetta -ex1 -ex2aro -database /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/database</span><br><span class=\"line\">basic.random.init_random_generator: <span class=\"string\">'RNG device'</span> seed mode, using <span class=\"string\">'/dev/urandom'</span>, seed=-481462242 seed_offset=0 real_seed=-481462242 thread_index=0</span><br><span class=\"line\">basic.random.init_random_generator: RandomGenerator:init: Normal mode, seed=-481462242 RG_type=mt19937</span><br></pre></td></tr></table></figure>\n\n<p>In this example, path to PyRosetta is:</p>\n<p><code>/home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/</code></p>\n<h4 id=\"Copy-edit-the-configuration-file-in-Windows\"><a href=\"#Copy-edit-the-configuration-file-in-Windows\" class=\"headerlink\" title=\"Copy & edit the configuration file (in Windows)\"></a>Copy & edit the configuration file (in Windows)</h4><p>I’m using PyMol on Windows, and pyRosetta on WSL Ubuntu.</p>\n<p>Therefore, I have to edit the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font>file to appoint a correct IP address.</p>\n<p><a href=\"https://learn.microsoft.com/en-us/windows/wsl/networking\">https://learn.microsoft.com/en-us/windows/wsl/networking</a></p>\n<blockquote>\n<p><font style=\"color:rgb(22, 22, 22);\">A program running inside a Linux distribution via WSL2 (instance) wants to know the Windows host’s IP address, so that a Linux program can connect to a Windows host server program.</font></p>\n</blockquote>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">ip route show | grep -i default | awk <span class=\"string\">'{ print $3}'</span></span><br></pre></td></tr></table></figure>\n\n<p>And a typical output might look like:</p>\n<figure class=\"highlight powershell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">>>> <span class=\"number\">172.24</span>.<span class=\"number\">112.1</span></span><br></pre></td></tr></table></figure>\n\n<p>Copy the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> from Linux to Windows (to D:).</font></p>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">cp</span> <Path-to-PyRosetta>/PyMOLPyRosettaServer.py /mnt/d/</span><br></pre></td></tr></table></figure>\n\n<p>And edit the file according to the comments within it. (The IP configuration is in the last few lines.) Appoint the right remote IP, and appoint an available port (e.g. <code>65000</code>).</p>\n<h4 id=\"Apply-the-PyMOLPyRosettaServer-py-to-PyMOL-in-Windows\"><a href=\"#Apply-the-PyMOLPyRosettaServer-py-to-PyMOL-in-Windows\" class=\"headerlink\" title=\"Apply the PyMOLPyRosettaServer.py to PyMOL (in Windows)\"></a>Apply the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> to PyMOL (in Windows)</font></h4><p>a. Drag the file to PyMOL window.</p>\n<p>b. Or, run the following commands in the PyMOL command line.</p>\n<figure class=\"highlight powershell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">cd</span> D: <span class=\"comment\">#Because I save PyMOLRosettaServer.py there.</span></span><br><span class=\"line\">run PyMOLRosettaServer.py</span><br></pre></td></tr></table></figure>\n\n<p>c. Or, save the commands above to <code>pymolrc.pml</code>; thus it runs automatically each time pyMOL launches<br>(The <code>pymolrc.pml</code>file can be found from GUI menu: <code>File</code> >> <code>Edit pymolrc</code>)</p>\n<h3 id=\"Instantiation-of-PyMOLMover\"><a href=\"#Instantiation-of-PyMOLMover\" class=\"headerlink\" title=\"Instantiation of PyMOLMover\"></a>Instantiation of <code>PyMOLMover</code></h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pmm = PyMOLMover(<span class=\"string\">"172.24.112.1"</span>, <span class=\"number\">65000</span>)</span><br></pre></td></tr></table></figure>\n\n\n\n<h3 id=\"PyMOLMovermethods\"><a href=\"#PyMOLMovermethods\" class=\"headerlink\" title=\"PyMOLMovermethods\"></a><code>PyMOLMover</code>methods</h3><h4 id=\"Keep-history\"><a href=\"#Keep-history\" class=\"headerlink\" title=\"Keep history\"></a>Keep history</h4><p>The method <code>keep_history</code>, if set to True, allows you to load in structures with the same name into states of the same object in PyMOL. </p>\n<p>This is the starting point for creating a PyMOL movie of your structure.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pmm.keep_history(<span class=\"literal\">True</span>) <span class=\"comment\"># This keeps history of all poses sent to PyMOL</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Send-a-pose-object-to-PyMOL\"><a href=\"#Send-a-pose-object-to-PyMOL\" class=\"headerlink\" title=\"Send a pose object to PyMOL\"></a>Send a <code>pose</code> object to PyMOL</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pmm.apply(my_pose)</span><br><span class=\"line\"><span class=\"comment\"># After running this, my_pose is expected to show up in the PyMOL window</span></span><br></pre></td></tr></table></figure>\n\n<p>See <code>AddPyMOLObserver</code>class for information about automatic updating the <em>pose</em> during <em>move.</em></p>\n<h4 id=\"Send-energy-energy-across-every-residue-of-a-poseobject-to-PyMOL\"><a href=\"#Send-energy-energy-across-every-residue-of-a-poseobject-to-PyMOL\" class=\"headerlink\" title=\"Send energy (energy across every residue) of a poseobject to PyMOL\"></a>Send energy (energy across every residue) of a <code>pose</code>object to PyMOL</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># assume that `pmm` is an instance of `PyMOLMover`</span></span><br><span class=\"line\"><span class=\"comment\"># assume that `my_pose` is an instance of `Pose`</span></span><br><span class=\"line\">pmm.send_energy(my_pose) <span class=\"comment\"># visualize the distribution of energy across the structure</span></span><br><span class=\"line\">pmm.send_energy(my_pose, fa_sol) <span class=\"comment\"># visualize the distribution of solvation energy (of full atom energy landscape) across the structure</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Send-properties-of-the-poseobject-to-PyMOL\"><a href=\"#Send-properties-of-the-poseobject-to-PyMOL\" class=\"headerlink\" title=\"Send properties of the poseobject to PyMOL\"></a>Send properties of the <code>pose</code>object to PyMOL</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># if you have scored the pose first, you can:</span></span><br><span class=\"line\">pmm.send_hbonds(my_pose) <span class=\"comment\">#show all hydrogen bonds in PyMOL</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"AddPyMOLObserverclass\"><a href=\"#AddPyMOLObserverclass\" class=\"headerlink\" title=\"AddPyMOLObserverclass\"></a><code>AddPyMOLObserver</code>class</h2><p><font style=\"color:rgba(0, 0, 0, 0.87);\">The observer is configured to execute a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">PyMOLMover.apply()</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> every time a change is observed in the pose coordinates. The </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">True</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> is a flag to ensure that PyMOL keeps a history of the moves.</font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">The observer should be added before excuting the </font><em><font style=\"color:rgba(0, 0, 0, 0.87);\">move(s).</font></em></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">observer = pyrosetta.rosetta.protocols.moves.AddPyMOLObserver(my_pose, <span class=\"literal\">True</span>)</span><br><span class=\"line\">my_mover.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyMOL-Mover\"><a href=\"#PyMOL-Mover\" class=\"headerlink\" title=\"PyMOL Mover\"></a>PyMOL Mover</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init()</span><br><span class=\"line\"><span class=\"comment\">#import pyrosetta</span></span><br><span class=\"line\"><span class=\"comment\">#pyrosetta.init()</span></span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose = pose_from_pdb(<span class=\"string\">"inputs/5tj3.pdb"</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Resource\"><a href=\"#Resource\" class=\"headerlink\" title=\"Resource\"></a>Resource</h2><p><a href=\"https://www.pyrosetta.org/documentation/pymol_mover-tutorial\">https://www.pyrosetta.org/documentation/pymol_mover-tutorial</a></p>\n<h2 id=\"PyMOLMover-class\"><a href=\"#PyMOLMover-class\" class=\"headerlink\" title=\"PyMOLMover class\"></a><code>PyMOLMover</code> class</h2><p>The PyMOLMover class will let us send information from PyRosetta to PyMOL for quick visualization. </p>\n<h3 id=\"Setup-PyMOL\"><a href=\"#Setup-PyMOL\" class=\"headerlink\" title=\"Setup PyMOL\"></a>Setup PyMOL</h3><h4 id=\"Get-Configuration-file-PyMOLPyRosettaServer-py-in-Linux\"><a href=\"#Get-Configuration-file-PyMOLPyRosettaServer-py-in-Linux\" class=\"headerlink\" title=\"Get Configuration file: <font style="color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);">PyMOLPyRosettaServer.py</font>(in Linux)\"></a>Get Configuration file: <code><font style="color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);">PyMOLPyRosettaServer.py</font></code>(in Linux)</h4><p><font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py</font><font style=\"color:rgb(33, 33, 33);\"> is found in the main directory of PyRosetta.</font></p>\n<p><font style=\"color:rgb(33, 33, 33);\">The path to PyRosetta can be discovered in the init information.</font></p>\n<p><font style=\"color:rgb(33, 33, 33);\">For example:</font></p>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">Requirement already satisfied: pyrosettacolabsetup <span class=\"keyword\">in</span> /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages (1.0.9)</span><br><span class=\"line\">┌──────────────────────────────────────────────────────────────────────────────┐</span><br><span class=\"line\">│ PyRosetta-4 │</span><br><span class=\"line\">│ Created <span class=\"keyword\">in</span> JHU by Sergey Lyskov and PyRosetta Team │</span><br><span class=\"line\">│ (C) Copyright Rosetta Commons Member Institutions │</span><br><span class=\"line\">│ │</span><br><span class=\"line\">│ NOTE: USE OF PyRosetta FOR COMMERCIAL PURPOSES REQUIRE PURCHASE OF A LICENSE │</span><br><span class=\"line\">│ See LICENSE.PyRosetta.md or email license@uw.edu <span class=\"keyword\">for</span> details │</span><br><span class=\"line\">└──────────────────────────────────────────────────────────────────────────────┘</span><br><span class=\"line\">PyRosetta-4 2025 [Rosetta PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release 2025.24+release.8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 2025-06-06T09:20:57] retrieved from: http://www.pyrosetta.org</span><br><span class=\"line\">core.init: Checking <span class=\"keyword\">for</span> fconfig files <span class=\"keyword\">in</span> <span class=\"built_in\">pwd</span> and ./rosetta/flags</span><br><span class=\"line\">core.init: Rosetta version: PyRosetta4.conda.ubuntu.cxx11thread.serialization.Ubuntu.python39.Release r403 2025.24+release.8e1e5e54f0 8e1e5e54f047b0833dcf760a5cd5d3ce94d63938 http://www.pyrosetta.org 2025-06-06T09:20:57</span><br><span class=\"line\">core.init: Rosetta extras: [cxx11thread, serialization]</span><br><span class=\"line\">core.init: <span class=\"built_in\">command</span>: PyRosetta -ex1 -ex2aro -database /home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/database</span><br><span class=\"line\">basic.random.init_random_generator: <span class=\"string\">'RNG device'</span> seed mode, using <span class=\"string\">'/dev/urandom'</span>, seed=-481462242 seed_offset=0 real_seed=-481462242 thread_index=0</span><br><span class=\"line\">basic.random.init_random_generator: RandomGenerator:init: Normal mode, seed=-481462242 RG_type=mt19937</span><br></pre></td></tr></table></figure>\n\n<p>In this example, path to PyRosetta is:</p>\n<p><code>/home/michael2003/anaconda3/envs/DESIGN_PROTEIN/lib/python3.9/site-packages/pyrosetta/</code></p>\n<h4 id=\"Copy-edit-the-configuration-file-in-Windows\"><a href=\"#Copy-edit-the-configuration-file-in-Windows\" class=\"headerlink\" title=\"Copy & edit the configuration file (in Windows)\"></a>Copy & edit the configuration file (in Windows)</h4><p>I’m using PyMol on Windows, and pyRosetta on WSL Ubuntu.</p>\n<p>Therefore, I have to edit the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font>file to appoint a correct IP address.</p>\n<p><a href=\"https://learn.microsoft.com/en-us/windows/wsl/networking\">https://learn.microsoft.com/en-us/windows/wsl/networking</a></p>\n<blockquote>\n<p><font style=\"color:rgb(22, 22, 22);\">A program running inside a Linux distribution via WSL2 (instance) wants to know the Windows host’s IP address, so that a Linux program can connect to a Windows host server program.</font></p>\n</blockquote>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">ip route show | grep -i default | awk <span class=\"string\">'{ print $3}'</span></span><br></pre></td></tr></table></figure>\n\n<p>And a typical output might look like:</p>\n<figure class=\"highlight powershell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">>>> <span class=\"number\">172.24</span>.<span class=\"number\">112.1</span></span><br></pre></td></tr></table></figure>\n\n<p>Copy the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> from Linux to Windows (to D:).</font></p>\n<figure class=\"highlight bash\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">cp</span> <Path-to-PyRosetta>/PyMOLPyRosettaServer.py /mnt/d/</span><br></pre></td></tr></table></figure>\n\n<p>And edit the file according to the comments within it. (The IP configuration is in the last few lines.) Appoint the right remote IP, and appoint an available port (e.g. <code>65000</code>).</p>\n<h4 id=\"Apply-the-PyMOLPyRosettaServer-py-to-PyMOL-in-Windows\"><a href=\"#Apply-the-PyMOLPyRosettaServer-py-to-PyMOL-in-Windows\" class=\"headerlink\" title=\"Apply the PyMOLPyRosettaServer.py to PyMOL (in Windows)\"></a>Apply the <font style=\"color:rgb(33, 33, 33);background-color:rgba(0, 0, 0, 0.06);\">PyMOLPyRosettaServer.py </font><font style=\"color:rgb(33, 33, 33);\"> to PyMOL (in Windows)</font></h4><p>a. Drag the file to PyMOL window.</p>\n<p>b. Or, run the following commands in the PyMOL command line.</p>\n<figure class=\"highlight powershell\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"built_in\">cd</span> D: <span class=\"comment\">#Because I save PyMOLRosettaServer.py there.</span></span><br><span class=\"line\">run PyMOLRosettaServer.py</span><br></pre></td></tr></table></figure>\n\n<p>c. Or, save the commands above to <code>pymolrc.pml</code>; thus it runs automatically each time pyMOL launches<br>(The <code>pymolrc.pml</code>file can be found from GUI menu: <code>File</code> >> <code>Edit pymolrc</code>)</p>\n<h3 id=\"Instantiation-of-PyMOLMover\"><a href=\"#Instantiation-of-PyMOLMover\" class=\"headerlink\" title=\"Instantiation of PyMOLMover\"></a>Instantiation of <code>PyMOLMover</code></h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pmm = PyMOLMover(<span class=\"string\">"172.24.112.1"</span>, <span class=\"number\">65000</span>)</span><br></pre></td></tr></table></figure>\n\n\n\n<h3 id=\"PyMOLMovermethods\"><a href=\"#PyMOLMovermethods\" class=\"headerlink\" title=\"PyMOLMovermethods\"></a><code>PyMOLMover</code>methods</h3><h4 id=\"Keep-history\"><a href=\"#Keep-history\" class=\"headerlink\" title=\"Keep history\"></a>Keep history</h4><p>The method <code>keep_history</code>, if set to True, allows you to load in structures with the same name into states of the same object in PyMOL. </p>\n<p>This is the starting point for creating a PyMOL movie of your structure.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pmm.keep_history(<span class=\"literal\">True</span>) <span class=\"comment\"># This keeps history of all poses sent to PyMOL</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Send-a-pose-object-to-PyMOL\"><a href=\"#Send-a-pose-object-to-PyMOL\" class=\"headerlink\" title=\"Send a pose object to PyMOL\"></a>Send a <code>pose</code> object to PyMOL</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pmm.apply(my_pose)</span><br><span class=\"line\"><span class=\"comment\"># After running this, my_pose is expected to show up in the PyMOL window</span></span><br></pre></td></tr></table></figure>\n\n<p>See <code>AddPyMOLObserver</code>class for information about automatic updating the <em>pose</em> during <em>move.</em></p>\n<h4 id=\"Send-energy-energy-across-every-residue-of-a-poseobject-to-PyMOL\"><a href=\"#Send-energy-energy-across-every-residue-of-a-poseobject-to-PyMOL\" class=\"headerlink\" title=\"Send energy (energy across every residue) of a poseobject to PyMOL\"></a>Send energy (energy across every residue) of a <code>pose</code>object to PyMOL</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># assume that `pmm` is an instance of `PyMOLMover`</span></span><br><span class=\"line\"><span class=\"comment\"># assume that `my_pose` is an instance of `Pose`</span></span><br><span class=\"line\">pmm.send_energy(my_pose) <span class=\"comment\"># visualize the distribution of energy across the structure</span></span><br><span class=\"line\">pmm.send_energy(my_pose, fa_sol) <span class=\"comment\"># visualize the distribution of solvation energy (of full atom energy landscape) across the structure</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Send-properties-of-the-poseobject-to-PyMOL\"><a href=\"#Send-properties-of-the-poseobject-to-PyMOL\" class=\"headerlink\" title=\"Send properties of the poseobject to PyMOL\"></a>Send properties of the <code>pose</code>object to PyMOL</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># if you have scored the pose first, you can:</span></span><br><span class=\"line\">pmm.send_hbonds(my_pose) <span class=\"comment\">#show all hydrogen bonds in PyMOL</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"AddPyMOLObserverclass\"><a href=\"#AddPyMOLObserverclass\" class=\"headerlink\" title=\"AddPyMOLObserverclass\"></a><code>AddPyMOLObserver</code>class</h2><p><font style=\"color:rgba(0, 0, 0, 0.87);\">The observer is configured to execute a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">PyMOLMover.apply()</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> every time a change is observed in the pose coordinates. The </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">True</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> is a flag to ensure that PyMOL keeps a history of the moves.</font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">The observer should be added before excuting the </font><em><font style=\"color:rgba(0, 0, 0, 0.87);\">move(s).</font></em></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">observer = pyrosetta.rosetta.protocols.moves.AddPyMOLObserver(my_pose, <span class=\"literal\">True</span>)</span><br><span class=\"line\">my_mover.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n"},{"title":"PyRosetta Basics (4): Rosetta Scripts Parser","_content":"# PyRosetta Basics (4): Rosetta Scripts Parser\n```python\n!pip install pyrosettacolabsetup\nimport pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\nimport pyrosetta; pyrosetta.init()\n```\n\n```python\nfrom pyrosetta import *\nfrom rosetta.protocols.rosetta_scripts import *\n\ninit('-no_fconfig @inputs/rabd/common')\n```\n\n## Introduction\n`rosetta.protocols.rosetta_scripts.RosettaScriptsParser`parses a Rosetta Script so that it can be called in PyRosetta.\n\nRosetta Scripts are in XML format.\n\n```xml\n<ROSETTASCRIPTS>\n <SCOREFXNS>\n </SCOREFXNS>\n <RESIDUE_SELECTORS>\n </RESIDUE_SELECTORS>\n <TASKOPERATIONS>\n </TASKOPERATIONS>\n <SIMPLE_METRICS>\n </SIMPLE_METRICS>\n <FILTERS>\n </FILTERS>\n <MOVERS>\n </MOVERS>\n <PROTOCOLS>\n </PROTOCOLS>\n <OUTPUT />\n</ROSETTASCRIPTS>\n```\n\nRosetta will carry out the order of operations specified in `<PROTOCOLS></PROTOCOLS>`. \n\nSimpleMetrics (`<SIMPLE_METRICS></SIMPLE_METRICS>`) and Filters (`<FILTERS></FILTERS>`) do not change the sequence or conformation of the structure.\n\nThe movers (`<MOVERS></MOVERS>`) do change the pose, and the output file will be the result of sequentially applying the movers in the protocols section. \n\nThe standard scores of the output will be carried over from any protocol doing scoring, unless the OUTPUT tag (`<OUTPUT></OUTPUT>`) is specified, in which case the corresponding score function from the `<SCOREFXNS></SCOREFXNS>` block will be used. \n\n## Instantiation\n```python\nmy_parser = RosettaScriptsParser()\n# my_parser is an instanse of `RosettaScriptsParser`\nmy_pose = pose_from_pdb(\"inputs/rabd/my_ab.pdb\")\n# my_pose is an instance of `Pose`; it is generated by calling `pyrosetta.pose_from_pdb`\nmy_pose_clone = my_pose.clone()\n# Always clone a copy as an archive before editing\n```\n\n## Load a protocol\n### Load from file\n```python\n# load from file\nmy_protocol = parser.generate_mover(\"inputs/min_L1.xml\")\n```\n\n### Load from string (construct a `XML` object)\n```python\nmin_L1 = \"<ROSETTASCRIPTS>...</ROSETTASCRIPTS>\" # min_L1 is a string that is in XML format\nxml = XmlObjects.create_from_string(min_L1)\nmy_protocol = xml.get_mover(\"ParsedProtocol\")\n```\n\n## Apply a protocol\n```python\nmy_protocol.apply(my_pose)\n```\n\n","source":"_posts/Note _ PyRosetta Basics (4)_ Rosetta Scripts Parser.md","raw":"title: 'PyRosetta Basics (4): Rosetta Scripts Parser'\ntags:\n - PyRosetta\n - biochemistry\n - protein\n - protein design\n - note\ncategories:\n - protein design\n---\n# PyRosetta Basics (4): Rosetta Scripts Parser\n```python\n!pip install pyrosettacolabsetup\nimport pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\nimport pyrosetta; pyrosetta.init()\n```\n\n```python\nfrom pyrosetta import *\nfrom rosetta.protocols.rosetta_scripts import *\n\ninit('-no_fconfig @inputs/rabd/common')\n```\n\n## Introduction\n`rosetta.protocols.rosetta_scripts.RosettaScriptsParser`parses a Rosetta Script so that it can be called in PyRosetta.\n\nRosetta Scripts are in XML format.\n\n```xml\n<ROSETTASCRIPTS>\n <SCOREFXNS>\n </SCOREFXNS>\n <RESIDUE_SELECTORS>\n </RESIDUE_SELECTORS>\n <TASKOPERATIONS>\n </TASKOPERATIONS>\n <SIMPLE_METRICS>\n </SIMPLE_METRICS>\n <FILTERS>\n </FILTERS>\n <MOVERS>\n </MOVERS>\n <PROTOCOLS>\n </PROTOCOLS>\n <OUTPUT />\n</ROSETTASCRIPTS>\n```\n\nRosetta will carry out the order of operations specified in `<PROTOCOLS></PROTOCOLS>`. \n\nSimpleMetrics (`<SIMPLE_METRICS></SIMPLE_METRICS>`) and Filters (`<FILTERS></FILTERS>`) do not change the sequence or conformation of the structure.\n\nThe movers (`<MOVERS></MOVERS>`) do change the pose, and the output file will be the result of sequentially applying the movers in the protocols section. \n\nThe standard scores of the output will be carried over from any protocol doing scoring, unless the OUTPUT tag (`<OUTPUT></OUTPUT>`) is specified, in which case the corresponding score function from the `<SCOREFXNS></SCOREFXNS>` block will be used. \n\n## Instantiation\n```python\nmy_parser = RosettaScriptsParser()\n# my_parser is an instanse of `RosettaScriptsParser`\nmy_pose = pose_from_pdb(\"inputs/rabd/my_ab.pdb\")\n# my_pose is an instance of `Pose`; it is generated by calling `pyrosetta.pose_from_pdb`\nmy_pose_clone = my_pose.clone()\n# Always clone a copy as an archive before editing\n```\n\n## Load a protocol\n### Load from file\n```python\n# load from file\nmy_protocol = parser.generate_mover(\"inputs/min_L1.xml\")\n```\n\n### Load from string (construct a `XML` object)\n```python\nmin_L1 = \"<ROSETTASCRIPTS>...</ROSETTASCRIPTS>\" # min_L1 is a string that is in XML format\nxml = XmlObjects.create_from_string(min_L1)\nmy_protocol = xml.get_mover(\"ParsedProtocol\")\n```\n\n## Apply a protocol\n```python\nmy_protocol.apply(my_pose)\n```\n\n","slug":"Note _ PyRosetta Basics (4)_ Rosetta Scripts Parser","published":1,"date":"2025-08-21T04:38:22.253Z","updated":"2025-08-21T04:45:34.084Z","comments":1,"layout":"post","photos":[],"_id":"cmekx8a7u004ncgu6e82ggme8","content":"<h1 id=\"PyRosetta-Basics-4-Rosetta-Scripts-Parser\"><a href=\"#PyRosetta-Basics-4-Rosetta-Scripts-Parser\" class=\"headerlink\" title=\"PyRosetta Basics (4): Rosetta Scripts Parser\"></a>PyRosetta Basics (4): Rosetta Scripts Parser</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">!pip install pyrosettacolabsetup</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta; pyrosetta.init()</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> rosetta.protocols.rosetta_scripts <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\">init(<span class=\"string\">'-no_fconfig @inputs/rabd/common'</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h2><p><code>rosetta.protocols.rosetta_scripts.RosettaScriptsParser</code>parses a Rosetta Script so that it can be called in PyRosetta.</p>\n<p>Rosetta Scripts are in XML format.</p>\n<figure class=\"highlight xml\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"tag\"><<span class=\"name\">ROSETTASCRIPTS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">SCOREFXNS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">SCOREFXNS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">RESIDUE_SELECTORS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">RESIDUE_SELECTORS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">TASKOPERATIONS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">TASKOPERATIONS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">SIMPLE_METRICS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">SIMPLE_METRICS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">FILTERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">FILTERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">MOVERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">MOVERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">PROTOCOLS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">PROTOCOLS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">OUTPUT</span> /></span></span><br><span class=\"line\"><span class=\"tag\"></<span class=\"name\">ROSETTASCRIPTS</span>></span></span><br></pre></td></tr></table></figure>\n\n<p>Rosetta will carry out the order of operations specified in <code><PROTOCOLS></PROTOCOLS></code>. </p>\n<p>SimpleMetrics (<code><SIMPLE_METRICS></SIMPLE_METRICS></code>) and Filters (<code><FILTERS></FILTERS></code>) do not change the sequence or conformation of the structure.</p>\n<p>The movers (<code><MOVERS></MOVERS></code>) do change the pose, and the output file will be the result of sequentially applying the movers in the protocols section. </p>\n<p>The standard scores of the output will be carried over from any protocol doing scoring, unless the OUTPUT tag (<code><OUTPUT></OUTPUT></code>) is specified, in which case the corresponding score function from the <code><SCOREFXNS></SCOREFXNS></code> block will be used. </p>\n<h2 id=\"Instantiation\"><a href=\"#Instantiation\" class=\"headerlink\" title=\"Instantiation\"></a>Instantiation</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_parser = RosettaScriptsParser()</span><br><span class=\"line\"><span class=\"comment\"># my_parser is an instanse of `RosettaScriptsParser`</span></span><br><span class=\"line\">my_pose = pose_from_pdb(<span class=\"string\">"inputs/rabd/my_ab.pdb"</span>)</span><br><span class=\"line\"><span class=\"comment\"># my_pose is an instance of `Pose`; it is generated by calling `pyrosetta.pose_from_pdb`</span></span><br><span class=\"line\">my_pose_clone = my_pose.clone()</span><br><span class=\"line\"><span class=\"comment\"># Always clone a copy as an archive before editing</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Load-a-protocol\"><a href=\"#Load-a-protocol\" class=\"headerlink\" title=\"Load a protocol\"></a>Load a protocol</h2><h3 id=\"Load-from-file\"><a href=\"#Load-from-file\" class=\"headerlink\" title=\"Load from file\"></a>Load from file</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># load from file</span></span><br><span class=\"line\">my_protocol = parser.generate_mover(<span class=\"string\">"inputs/min_L1.xml"</span>)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Load-from-string-construct-a-XML-object\"><a href=\"#Load-from-string-construct-a-XML-object\" class=\"headerlink\" title=\"Load from string (construct a XML object)\"></a>Load from string (construct a <code>XML</code> object)</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">min_L1 = <span class=\"string\">"<ROSETTASCRIPTS>...</ROSETTASCRIPTS>"</span> <span class=\"comment\"># min_L1 is a string that is in XML format</span></span><br><span class=\"line\">xml = XmlObjects.create_from_string(min_L1)</span><br><span class=\"line\">my_protocol = xml.get_mover(<span class=\"string\">"ParsedProtocol"</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Apply-a-protocol\"><a href=\"#Apply-a-protocol\" class=\"headerlink\" title=\"Apply a protocol\"></a>Apply a protocol</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_protocol.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyRosetta-Basics-4-Rosetta-Scripts-Parser\"><a href=\"#PyRosetta-Basics-4-Rosetta-Scripts-Parser\" class=\"headerlink\" title=\"PyRosetta Basics (4): Rosetta Scripts Parser\"></a>PyRosetta Basics (4): Rosetta Scripts Parser</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">!pip install pyrosettacolabsetup</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta; pyrosetta.init()</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> rosetta.protocols.rosetta_scripts <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\">init(<span class=\"string\">'-no_fconfig @inputs/rabd/common'</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h2><p><code>rosetta.protocols.rosetta_scripts.RosettaScriptsParser</code>parses a Rosetta Script so that it can be called in PyRosetta.</p>\n<p>Rosetta Scripts are in XML format.</p>\n<figure class=\"highlight xml\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"tag\"><<span class=\"name\">ROSETTASCRIPTS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">SCOREFXNS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">SCOREFXNS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">RESIDUE_SELECTORS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">RESIDUE_SELECTORS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">TASKOPERATIONS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">TASKOPERATIONS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">SIMPLE_METRICS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">SIMPLE_METRICS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">FILTERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">FILTERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">MOVERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">MOVERS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">PROTOCOLS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"></<span class=\"name\">PROTOCOLS</span>></span></span><br><span class=\"line\"> <span class=\"tag\"><<span class=\"name\">OUTPUT</span> /></span></span><br><span class=\"line\"><span class=\"tag\"></<span class=\"name\">ROSETTASCRIPTS</span>></span></span><br></pre></td></tr></table></figure>\n\n<p>Rosetta will carry out the order of operations specified in <code><PROTOCOLS></PROTOCOLS></code>. </p>\n<p>SimpleMetrics (<code><SIMPLE_METRICS></SIMPLE_METRICS></code>) and Filters (<code><FILTERS></FILTERS></code>) do not change the sequence or conformation of the structure.</p>\n<p>The movers (<code><MOVERS></MOVERS></code>) do change the pose, and the output file will be the result of sequentially applying the movers in the protocols section. </p>\n<p>The standard scores of the output will be carried over from any protocol doing scoring, unless the OUTPUT tag (<code><OUTPUT></OUTPUT></code>) is specified, in which case the corresponding score function from the <code><SCOREFXNS></SCOREFXNS></code> block will be used. </p>\n<h2 id=\"Instantiation\"><a href=\"#Instantiation\" class=\"headerlink\" title=\"Instantiation\"></a>Instantiation</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_parser = RosettaScriptsParser()</span><br><span class=\"line\"><span class=\"comment\"># my_parser is an instanse of `RosettaScriptsParser`</span></span><br><span class=\"line\">my_pose = pose_from_pdb(<span class=\"string\">"inputs/rabd/my_ab.pdb"</span>)</span><br><span class=\"line\"><span class=\"comment\"># my_pose is an instance of `Pose`; it is generated by calling `pyrosetta.pose_from_pdb`</span></span><br><span class=\"line\">my_pose_clone = my_pose.clone()</span><br><span class=\"line\"><span class=\"comment\"># Always clone a copy as an archive before editing</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Load-a-protocol\"><a href=\"#Load-a-protocol\" class=\"headerlink\" title=\"Load a protocol\"></a>Load a protocol</h2><h3 id=\"Load-from-file\"><a href=\"#Load-from-file\" class=\"headerlink\" title=\"Load from file\"></a>Load from file</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># load from file</span></span><br><span class=\"line\">my_protocol = parser.generate_mover(<span class=\"string\">"inputs/min_L1.xml"</span>)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Load-from-string-construct-a-XML-object\"><a href=\"#Load-from-string-construct-a-XML-object\" class=\"headerlink\" title=\"Load from string (construct a XML object)\"></a>Load from string (construct a <code>XML</code> object)</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">min_L1 = <span class=\"string\">"<ROSETTASCRIPTS>...</ROSETTASCRIPTS>"</span> <span class=\"comment\"># min_L1 is a string that is in XML format</span></span><br><span class=\"line\">xml = XmlObjects.create_from_string(min_L1)</span><br><span class=\"line\">my_protocol = xml.get_mover(<span class=\"string\">"ParsedProtocol"</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Apply-a-protocol\"><a href=\"#Apply-a-protocol\" class=\"headerlink\" title=\"Apply a protocol\"></a>Apply a protocol</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_protocol.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n"},{"title":"PyRosetta Basics (3): Viewer","date":"2025-08-21T04:43:37.000Z","updated":"2025-08-21T04:43:40.000Z","_content":"# PyRosetta Basics (3): Viewer\n## Introduction\nThe pyrosetta.distributed Viewer quickly renders `.pdb` files, dynamically instantiating Pose objects if required for certain visualization modules (`viewer.set*`). \n\nSo when adding visualization modules to the Viewer or using presets, passing Pose or PackedPose objects to the Viewer is suggested for quicker rendering. \n\nIf a Pose object or list, tuple, or set of Pose objects are provided to the Viewer, the Viewer will dynamically update upon Pose conformational changes by calling the view.show() method or equivalently view(). \n\nThe Viewer applies visualization modules in the same order they are added (from left to right), so layering different styles (and ResidueSelectors) on top of one another becomes possible. \n\n<font style=\"color:#DF2A3F;\">WARNING</font>: `pyrosetta.distributed.viewer`runs in a jupyter notebook.\n\n## Initialization & load\n```python\n!pip install pyrosettacolabsetup\nimport pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\nimport pyrosetta; \npyrosetta.init()\n\nimport glob\nimport logging\nlogging.basicConfig(level=logging.INFO)\nimport numpy as np\nimport os\nimport pyrosetta\nimport pyrosetta.distributed\nimport pyrosetta.distributed.io as io\nimport pyrosetta.distributed.viewer as viewer\nimport sys\n```\n\n```python\nmy_pose = pyrosetta.io.pose_from_file(\"inputs/3EK4.pdb\")\n```\n\n## Configuring `ditributed`for visualizing ligands and non-canonical residues\nThe user must have already initialized PyRosetta providing `.params` for any ligands and non-canonical residues in the input `Pose`objects /`PackedPose`objects/`.pdb` files.\n\nOtherwise `pyrosetta.distributed` automatically initializes PyRosetta with default command line options.\n\nE.g.:\n\n```python\nflags = \"\"\"\n-auto_setup_metals 1\n-detect_disulf 1\n\"\"\"\n# Display metal: True\n# Display disulfide bonds: True\npyrosetta.distributed.init(flags)\n```\n\n## Instantiation of `distributed.viewer`\n```python\nview = viewer.init(pose, window_size=(800, 600))\nview()\n```\n\n## `distributed.viewer`methods\nThe pyrosetta.distributed Viewer quickly renders `.pdb` files, dynamically instantiating Pose objects if required for certain visualization modules (`viewer.set*`). \n\n```python\n# All Available `viewer` objects:\nviewer.__all__\n\n'''\n>>>\n['expand_notebook',\n 'init',\n 'presets',\n 'setBackgroundColor',\n 'setDisulfides',\n 'setHydrogenBonds',\n 'setHydrogens',\n 'setStyle',\n 'setSurface',\n 'setZoom',\n 'setZoomTo']\n \n'''\n```\n\n1. visualization modules: `viewer.set*`\n2. visualization presets: `viewer.presets`\n\n```python\nviewer.presets.__all__\n# >>> ['coreBoundarySurface', 'ligandsAndMetals']\n```\n\n3. `pyrosetta.distributed.viewer.expand_notebook()` expands the Jupyter notebook cell width to fit your internet browser\n\n","source":"_posts/Note _ PyRosetta Basics (3)_ Viewer.md","raw":"title: 'PyRosetta Basics (3): Viewer'\ndate: '2025-08-21 12:43:37'\nupdated: '2025-08-21 12:43:40'\ntags:\n - PyRosetta\n - protein design\n - biochemistry\n - note\n - protein\ncategories:\n - protein design\n---\n# PyRosetta Basics (3): Viewer\n## Introduction\nThe pyrosetta.distributed Viewer quickly renders `.pdb` files, dynamically instantiating Pose objects if required for certain visualization modules (`viewer.set*`). \n\nSo when adding visualization modules to the Viewer or using presets, passing Pose or PackedPose objects to the Viewer is suggested for quicker rendering. \n\nIf a Pose object or list, tuple, or set of Pose objects are provided to the Viewer, the Viewer will dynamically update upon Pose conformational changes by calling the view.show() method or equivalently view(). \n\nThe Viewer applies visualization modules in the same order they are added (from left to right), so layering different styles (and ResidueSelectors) on top of one another becomes possible. \n\n<font style=\"color:#DF2A3F;\">WARNING</font>: `pyrosetta.distributed.viewer`runs in a jupyter notebook.\n\n## Initialization & load\n```python\n!pip install pyrosettacolabsetup\nimport pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\nimport pyrosetta; \npyrosetta.init()\n\nimport glob\nimport logging\nlogging.basicConfig(level=logging.INFO)\nimport numpy as np\nimport os\nimport pyrosetta\nimport pyrosetta.distributed\nimport pyrosetta.distributed.io as io\nimport pyrosetta.distributed.viewer as viewer\nimport sys\n```\n\n```python\nmy_pose = pyrosetta.io.pose_from_file(\"inputs/3EK4.pdb\")\n```\n\n## Configuring `ditributed`for visualizing ligands and non-canonical residues\nThe user must have already initialized PyRosetta providing `.params` for any ligands and non-canonical residues in the input `Pose`objects /`PackedPose`objects/`.pdb` files.\n\nOtherwise `pyrosetta.distributed` automatically initializes PyRosetta with default command line options.\n\nE.g.:\n\n```python\nflags = \"\"\"\n-auto_setup_metals 1\n-detect_disulf 1\n\"\"\"\n# Display metal: True\n# Display disulfide bonds: True\npyrosetta.distributed.init(flags)\n```\n\n## Instantiation of `distributed.viewer`\n```python\nview = viewer.init(pose, window_size=(800, 600))\nview()\n```\n\n## `distributed.viewer`methods\nThe pyrosetta.distributed Viewer quickly renders `.pdb` files, dynamically instantiating Pose objects if required for certain visualization modules (`viewer.set*`). \n\n```python\n# All Available `viewer` objects:\nviewer.__all__\n\n'''\n>>>\n['expand_notebook',\n 'init',\n 'presets',\n 'setBackgroundColor',\n 'setDisulfides',\n 'setHydrogenBonds',\n 'setHydrogens',\n 'setStyle',\n 'setSurface',\n 'setZoom',\n 'setZoomTo']\n \n'''\n```\n\n1. visualization modules: `viewer.set*`\n2. visualization presets: `viewer.presets`\n\n```python\nviewer.presets.__all__\n# >>> ['coreBoundarySurface', 'ligandsAndMetals']\n```\n\n3. `pyrosetta.distributed.viewer.expand_notebook()` expands the Jupyter notebook cell width to fit your internet browser\n\n","slug":"Note _ PyRosetta Basics (3)_ Viewer","published":1,"comments":1,"layout":"post","photos":[],"_id":"cmekx8a7u004ocgu68vm47ter","content":"<h1 id=\"PyRosetta-Basics-3-Viewer\"><a href=\"#PyRosetta-Basics-3-Viewer\" class=\"headerlink\" title=\"PyRosetta Basics (3): Viewer\"></a>PyRosetta Basics (3): Viewer</h1><h2 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h2><p>The pyrosetta.distributed Viewer quickly renders <code>.pdb</code> files, dynamically instantiating Pose objects if required for certain visualization modules (<code>viewer.set*</code>). </p>\n<p>So when adding visualization modules to the Viewer or using presets, passing Pose or PackedPose objects to the Viewer is suggested for quicker rendering. </p>\n<p>If a Pose object or list, tuple, or set of Pose objects are provided to the Viewer, the Viewer will dynamically update upon Pose conformational changes by calling the view.show() method or equivalently view(). </p>\n<p>The Viewer applies visualization modules in the same order they are added (from left to right), so layering different styles (and ResidueSelectors) on top of one another becomes possible. </p>\n<p><font style=\"color:#DF2A3F;\">WARNING</font>: <code>pyrosetta.distributed.viewer</code>runs in a jupyter notebook.</p>\n<h2 id=\"Initialization-load\"><a href=\"#Initialization-load\" class=\"headerlink\" title=\"Initialization & load\"></a>Initialization & load</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">!pip install pyrosettacolabsetup</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta; </span><br><span class=\"line\">pyrosetta.init()</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">import</span> glob</span><br><span class=\"line\"><span class=\"keyword\">import</span> logging</span><br><span class=\"line\">logging.basicConfig(level=logging.INFO)</span><br><span class=\"line\"><span class=\"keyword\">import</span> numpy <span class=\"keyword\">as</span> np</span><br><span class=\"line\"><span class=\"keyword\">import</span> os</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta.distributed</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta.distributed.io <span class=\"keyword\">as</span> io</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta.distributed.viewer <span class=\"keyword\">as</span> viewer</span><br><span class=\"line\"><span class=\"keyword\">import</span> sys</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose = pyrosetta.io.pose_from_file(<span class=\"string\">"inputs/3EK4.pdb"</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Configuring-ditributedfor-visualizing-ligands-and-non-canonical-residues\"><a href=\"#Configuring-ditributedfor-visualizing-ligands-and-non-canonical-residues\" class=\"headerlink\" title=\"Configuring ditributedfor visualizing ligands and non-canonical residues\"></a>Configuring <code>ditributed</code>for visualizing ligands and non-canonical residues</h2><p>The user must have already initialized PyRosetta providing <code>.params</code> for any ligands and non-canonical residues in the input <code>Pose</code>objects /<code>PackedPose</code>objects/<code>.pdb</code> files.</p>\n<p>Otherwise <code>pyrosetta.distributed</code> automatically initializes PyRosetta with default command line options.</p>\n<p>E.g.:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">flags = <span class=\"string\">"""</span></span><br><span class=\"line\"><span class=\"string\">-auto_setup_metals 1</span></span><br><span class=\"line\"><span class=\"string\">-detect_disulf 1</span></span><br><span class=\"line\"><span class=\"string\">"""</span></span><br><span class=\"line\"><span class=\"comment\"># Display metal: True</span></span><br><span class=\"line\"><span class=\"comment\"># Display disulfide bonds: True</span></span><br><span class=\"line\">pyrosetta.distributed.init(flags)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Instantiation-of-distributed-viewer\"><a href=\"#Instantiation-of-distributed-viewer\" class=\"headerlink\" title=\"Instantiation of distributed.viewer\"></a>Instantiation of <code>distributed.viewer</code></h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">view = viewer.init(pose, window_size=(<span class=\"number\">800</span>, <span class=\"number\">600</span>))</span><br><span class=\"line\">view()</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"distributed-viewermethods\"><a href=\"#distributed-viewermethods\" class=\"headerlink\" title=\"distributed.viewermethods\"></a><code>distributed.viewer</code>methods</h2><p>The pyrosetta.distributed Viewer quickly renders <code>.pdb</code> files, dynamically instantiating Pose objects if required for certain visualization modules (<code>viewer.set*</code>). </p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># All Available `viewer` objects:</span></span><br><span class=\"line\">viewer.__all__</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br><span class=\"line\"><span class=\"string\">>>></span></span><br><span class=\"line\"><span class=\"string\">['expand_notebook',</span></span><br><span class=\"line\"><span class=\"string\"> 'init',</span></span><br><span class=\"line\"><span class=\"string\"> 'presets',</span></span><br><span class=\"line\"><span class=\"string\"> 'setBackgroundColor',</span></span><br><span class=\"line\"><span class=\"string\"> 'setDisulfides',</span></span><br><span class=\"line\"><span class=\"string\"> 'setHydrogenBonds',</span></span><br><span class=\"line\"><span class=\"string\"> 'setHydrogens',</span></span><br><span class=\"line\"><span class=\"string\"> 'setStyle',</span></span><br><span class=\"line\"><span class=\"string\"> 'setSurface',</span></span><br><span class=\"line\"><span class=\"string\"> 'setZoom',</span></span><br><span class=\"line\"><span class=\"string\"> 'setZoomTo']</span></span><br><span class=\"line\"><span class=\"string\"> </span></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br></pre></td></tr></table></figure>\n\n<ol>\n<li>visualization modules: <code>viewer.set*</code></li>\n<li>visualization presets: <code>viewer.presets</code></li>\n</ol>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">viewer.presets.__all__</span><br><span class=\"line\"><span class=\"comment\"># >>> ['coreBoundarySurface', 'ligandsAndMetals']</span></span><br></pre></td></tr></table></figure>\n\n<ol start=\"3\">\n<li><code>pyrosetta.distributed.viewer.expand_notebook()</code> expands the Jupyter notebook cell width to fit your internet browser</li>\n</ol>\n","excerpt":"","more":"<h1 id=\"PyRosetta-Basics-3-Viewer\"><a href=\"#PyRosetta-Basics-3-Viewer\" class=\"headerlink\" title=\"PyRosetta Basics (3): Viewer\"></a>PyRosetta Basics (3): Viewer</h1><h2 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h2><p>The pyrosetta.distributed Viewer quickly renders <code>.pdb</code> files, dynamically instantiating Pose objects if required for certain visualization modules (<code>viewer.set*</code>). </p>\n<p>So when adding visualization modules to the Viewer or using presets, passing Pose or PackedPose objects to the Viewer is suggested for quicker rendering. </p>\n<p>If a Pose object or list, tuple, or set of Pose objects are provided to the Viewer, the Viewer will dynamically update upon Pose conformational changes by calling the view.show() method or equivalently view(). </p>\n<p>The Viewer applies visualization modules in the same order they are added (from left to right), so layering different styles (and ResidueSelectors) on top of one another becomes possible. </p>\n<p><font style=\"color:#DF2A3F;\">WARNING</font>: <code>pyrosetta.distributed.viewer</code>runs in a jupyter notebook.</p>\n<h2 id=\"Initialization-load\"><a href=\"#Initialization-load\" class=\"headerlink\" title=\"Initialization & load\"></a>Initialization & load</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">!pip install pyrosettacolabsetup</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta; </span><br><span class=\"line\">pyrosetta.init()</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">import</span> glob</span><br><span class=\"line\"><span class=\"keyword\">import</span> logging</span><br><span class=\"line\">logging.basicConfig(level=logging.INFO)</span><br><span class=\"line\"><span class=\"keyword\">import</span> numpy <span class=\"keyword\">as</span> np</span><br><span class=\"line\"><span class=\"keyword\">import</span> os</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta.distributed</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta.distributed.io <span class=\"keyword\">as</span> io</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta.distributed.viewer <span class=\"keyword\">as</span> viewer</span><br><span class=\"line\"><span class=\"keyword\">import</span> sys</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose = pyrosetta.io.pose_from_file(<span class=\"string\">"inputs/3EK4.pdb"</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Configuring-ditributedfor-visualizing-ligands-and-non-canonical-residues\"><a href=\"#Configuring-ditributedfor-visualizing-ligands-and-non-canonical-residues\" class=\"headerlink\" title=\"Configuring ditributedfor visualizing ligands and non-canonical residues\"></a>Configuring <code>ditributed</code>for visualizing ligands and non-canonical residues</h2><p>The user must have already initialized PyRosetta providing <code>.params</code> for any ligands and non-canonical residues in the input <code>Pose</code>objects /<code>PackedPose</code>objects/<code>.pdb</code> files.</p>\n<p>Otherwise <code>pyrosetta.distributed</code> automatically initializes PyRosetta with default command line options.</p>\n<p>E.g.:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">flags = <span class=\"string\">"""</span></span><br><span class=\"line\"><span class=\"string\">-auto_setup_metals 1</span></span><br><span class=\"line\"><span class=\"string\">-detect_disulf 1</span></span><br><span class=\"line\"><span class=\"string\">"""</span></span><br><span class=\"line\"><span class=\"comment\"># Display metal: True</span></span><br><span class=\"line\"><span class=\"comment\"># Display disulfide bonds: True</span></span><br><span class=\"line\">pyrosetta.distributed.init(flags)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Instantiation-of-distributed-viewer\"><a href=\"#Instantiation-of-distributed-viewer\" class=\"headerlink\" title=\"Instantiation of distributed.viewer\"></a>Instantiation of <code>distributed.viewer</code></h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">view = viewer.init(pose, window_size=(<span class=\"number\">800</span>, <span class=\"number\">600</span>))</span><br><span class=\"line\">view()</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"distributed-viewermethods\"><a href=\"#distributed-viewermethods\" class=\"headerlink\" title=\"distributed.viewermethods\"></a><code>distributed.viewer</code>methods</h2><p>The pyrosetta.distributed Viewer quickly renders <code>.pdb</code> files, dynamically instantiating Pose objects if required for certain visualization modules (<code>viewer.set*</code>). </p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># All Available `viewer` objects:</span></span><br><span class=\"line\">viewer.__all__</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br><span class=\"line\"><span class=\"string\">>>></span></span><br><span class=\"line\"><span class=\"string\">['expand_notebook',</span></span><br><span class=\"line\"><span class=\"string\"> 'init',</span></span><br><span class=\"line\"><span class=\"string\"> 'presets',</span></span><br><span class=\"line\"><span class=\"string\"> 'setBackgroundColor',</span></span><br><span class=\"line\"><span class=\"string\"> 'setDisulfides',</span></span><br><span class=\"line\"><span class=\"string\"> 'setHydrogenBonds',</span></span><br><span class=\"line\"><span class=\"string\"> 'setHydrogens',</span></span><br><span class=\"line\"><span class=\"string\"> 'setStyle',</span></span><br><span class=\"line\"><span class=\"string\"> 'setSurface',</span></span><br><span class=\"line\"><span class=\"string\"> 'setZoom',</span></span><br><span class=\"line\"><span class=\"string\"> 'setZoomTo']</span></span><br><span class=\"line\"><span class=\"string\"> </span></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br></pre></td></tr></table></figure>\n\n<ol>\n<li>visualization modules: <code>viewer.set*</code></li>\n<li>visualization presets: <code>viewer.presets</code></li>\n</ol>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">viewer.presets.__all__</span><br><span class=\"line\"><span class=\"comment\"># >>> ['coreBoundarySurface', 'ligandsAndMetals']</span></span><br></pre></td></tr></table></figure>\n\n<ol start=\"3\">\n<li><code>pyrosetta.distributed.viewer.expand_notebook()</code> expands the Jupyter notebook cell width to fit your internet browser</li>\n</ol>\n"},{"title":"PyRosetta Basics (1): Pose","date":"2025-08-21T04:42:40.000Z","updated":"2025-08-21T04:42:42.000Z","_content":"# PyRosetta Basics (1): Pose\n```python\nfrom pyrosetta import *\ninit()\n#import pyrosetta\n#pyrosetta.init()\n```\n\n## `Pose`class\n### Introduction\n1. Simplified explanation: \n 1. `Pose`(`pyrosetta.Pose`) is defined as a Python class\n 2. `Pose`is the core concept of PyRosetta\n 3. An instance of the`Pose`class is refered to as a \"pose object\".\n 4. A pose object is a protein structure.\n2. Further explanation:\n 1. A pose object may also include informations about related ions, ligand and other molecules.\n 2. A pose object may have more than one protein chains (quaternary protein, or protein complex)\n 3. Like any other Python classes, the`Pose`class has methods and attributes.\n 4. Class methods can be visited from the instances of the class.\n\n### `Pose` instantiation\n#### Initiate an instance of `Pose` from a PDB file\n```python\npose_1 = pose_from_pdb(\"./path_to_pdb/5tj3.pdb\") \n# pyrosetta.pose_from_pdb\n# load '5tj3.pdb' from file\n```\n\n#### Initiate an instance of `Pose` from [https://www.rcsb.org/](https://www.rcsb.org/)\n```python\npose_2 = pose_from_rcsb(\"5TJ3\")\n# pyrosetta.pose_from_rcsb\n# load 5TJ3 from online database\n```\n\n#### Initiate an instance of `Pose`from a string (a sequence)\n```python\npose_3 = pose_from_sequence(\"AAAAAAAAAA\")\n# pyrosetta.pose_from_sequence\n# load a \"poly alanine sequence\" from string\n```\n\n#### Initiate an empty instance of `Pose` (And create a clone of a `pose` object)\n```python\npose_4 = Pose() # Now pose_4 is empty\n\n# we can now use pose_4 to create a deep clone (copy) of pose_1\npose_4.assign(pose_1)\n```\n\n### `Pose`methods\n#### Copy a `pose`object via `Pose.assign`\n```python\n# Assume that we have a Pose instance called `my_pose`\nmy_pose_clone = Pose() # Now my_pose_clone is empty\n\n#create a deep clone (copy) of my_pose\nmy_pose_clone.assign(my_pose)\n\n\n```\n\n<font style=\"color:#DF2A3F;\">WARNING</font>: Avoid writing something like:\n\n```python\nmy_pose_clone = my_pose \n# This is incorrect\n```\n\nBecause in this way, my_pose_clone is pointed to value of my_pose, and modification to my_pose_clone will change my_pose.\n\n#### Copy a `pose`object via `Pose.clone`\n```python\n# assume that we have a `pose` object called `my_pose`\nmy_pose_clone = my_pose.clone()\n```\n\n#### Get sequence\n```python\n# `my_pose` is an instance of Pose\nmy_seq = my_pose.sequence()\n# `my_seq` is a string, storing the sequence of my_pose\n```\n\n#### Get annotated sequence\n```python\nmy_seq_annotated = my_pose.annotated_sequence()\n# `my_seq` is a string, storing the annotated sequence of my_pose\n# annotations are like: '...T[THR:phosphorylated]...'\n```\n\n#### Get total residue count\n```python\nmy_total_residue_count = my_pose.total_residue()\n# `my_total_residue_count` is an integer\n```\n\n#### Get dihedral angles\n```python\n# `residue_id` is the ID (in pose) of a residue, type is integer\nmy_pose.phi(residue_id) # C-CaN-C dihedral\n# >>> −64.8\nmy_pose.psi(residue_id) # N-CaC-N dihedral\n# >>> -41.0\nmy_pose.chi(1, residue_id) # 1st C-C dihedral in side chain\n# >>> -82.8\n```\n\n#### Get an `Energies`object\n```python\nmy_energies = my_pose.energies()\n\nprint(my_energies.show(24)) # Print all energies terms (unweighted) of residue 24\n```\n\n#### Get a`Residue` object\n```python\nresidue_20th = my_pose.residue(20)\n# `residue_20th` is an object that stores the 20th residue of `my_pose`\n```\n\nSee \"Residue objects\" in this note \n\n<font style=\"color:#DF2A3F;\">WARNING</font>: \"the 20th residue in pose\" is not equal to \"the 20th residue in PDB\", because a pdb file may contain more than one chain.\n\n#### Get a`PdbInfo`object\nThis object is a bridge between a `Pose` object and a PDB file:\n\n1. This object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).\n2. Or, this object stores information that can be written into a PDB file.\n\n```python\nmy_pdb_info = my_pose.pdb_info()\n```\n\nSee \"PdbInfo objects\" in this note \n\n#### Get a`Conformation`object\n```python\nmy_conformation = my_pose.conformation() # Get conformation object\n```\n\n#### Set dihedral angles (a basic mover)\n```python\nmy_pose.set_phi(24, -64.8) # set phi of residue #24 to -64.8\nmy_pose.set_psi(24, -41.0) # set psi of residue #24 to -41.0\n```\n\n#### Set foldtree (requires a pre-defined `FoldTree`object)\n```python\n# Assume that we have a `FoldTree` object called `my_ft`\nmy_pose.fold_tree(my_ft)\n```\n\n#### Output (Save) a pose as a PDB file\n```python\nmy_pose.dump_pdb('/outputs/my_pose_arxiv.pdb')\n```\n\n## `Residue` class\n`Residue`is a secondary class of `Pose`.\n\nA `residue`object stores information about a residue.\n\n<font style=\"color:#DF2A3F;\">NOTICE</font>: An ion, or a small molecule ligand, etc. is also seen as a residue.\n\n### Get residue name\n```python\nresidue_20th = my_pose.residue(20)\n# my_pose is a `Pose` object\n# residue_20th is a `Residue` object\nresidue_20th_name = residue_20th.name()\n# residue_20th_name is a string, storing the uppercased 3-letter name\n# e.g. 'ASP'\n```\n\n### Get residue property: `is_xxx`booleans\n```python\nresidue_24th = my_pose.residue(24) # Get #24 residue from my_pose\nresidue_24th_is_charged = residue_24th.is_charged() # Boolean, `True` if it is charged\nresidue_24th_is_aa = residue_24th.is_protein() # Boolean, `True` if it is an amino acid\n```\n\n### Get atom index\n```python\nresidue_24th = my_pose.residue(24) # get #24 residue\ncarbon_alpha_of_residue_24th = residue_24th.atom_index(\"CA\")\n```\n\n`\"N\"`is the nitrogen of main-chain amino group.\n\n`\"CA\"`is the central carbon.\n\n`\"C\"`is the carbon of main-chain carboxyl group.\n\nFor atom nomenclatures, search for \"amino acid structure\".\n\n### Get atom xyz coordinates (for vector-related calculations)\n```python\n# `residue_24th` is a residue in `my_pose`\nN_xyz = residue_24th.xyz(\"N\")\n# N_xyz is a vector (length = 3)\n```\n\n\n\n## `PdbInfo`class\n`PdbInfo`is a secondary class of `Pose`.\n\nThis class is a bridge between a `Pose` object and a PDB file:\n\n1. A `pdb_info`object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).\n2. Or, this object stores information that can be written into a PDB file.\n\n### Convert residue ID (number): `pdb2pose` and `pose2pdb`\nThe ID (number) of a residue starts at #1 in pose.\n\nThe ID of a residue in a `pose`object is different from its ID in a `.pdb`file.\n\n```python\n# In PDB file, a residue of interect is in \"chain A\", and its ID (number) in the PDB file is 24\n# But its ID in the `Pose` object (my_pose) is unknown.\nmy_pdb_info = my_pose.pdb_info()\nmy_residue_id_in_pose = my_pdb_info.pdb2pose('A', 24) # get the residue ID in pose, stored as an integer\nmy_residue = my_pose.residue(my_residue_id_in_pose) # get the `Residue` object by its ID in pose\n\n# alternatively, we can call the methods in a chain: \n# my_residue_id_in_pose = my_pose.pdb_info().pdb2pose('A', 24)\n```\n\n```python\n# On the other hand, we can get the corresponding PDB chain infomation and ID information for a specific residue\n# In a `Pose` object, a residue is at #1 position (its ID is 1), but its location in corresponding PDB file is unknown\nmy_residue_info_in_pdb = my_pdb_info.pose2pdb(1)\n# my_residue_info_in_pdb is a string that looks like '24 A'\n```\n\n### Get chain information & Get number (ID) information\n```python\n# a `Pose` instance called `my_pose`, and a residue of interest whose ID (in pose) is 1\nmy_pose.pdb_info().chain(1)\n# >>> A\n# The #1 residue is in 'chain A'\nmy_pose.pdb_info().number(1)\n# >>> 24\n# The ID of #1 (in pose) residue in corresponding PDB file is 24\n```\n\n### Set `PdbInfo`\n```python\n# assume that my_pose is a `pose` object\nmy_pose.pdb_info().name(\"test\") \n# set the name of this pose in its pdb_info as \"test\"\n# if it is sent to PyMOL, it will be displayed as \"test\" in the object list\n```\n\n## `Conformation`class\n### Get bond length & Get bond angle\n```python\n# given a `residue_id` (ID of a residue):\nresidue_28th = my_pose.residue(residue_id) # Get residue \nN28 = AtomID(residue_28th.atom_index(\"N\"), residue_id) # Construct an `AtomID` object for backbone nitrogen\nCA28 = AtomID(residue_28th.atom_index(\"CA\"), residue_id)\nC28 = AtomID(res_28.atom_index(\"C\"), resid)\n\nmy_conformation = my_pose.conformation() # Get conformation object\n\nN_CA_28_bond_length = my_conformation.bond_length(N28, CA28) # get bond length; type is float\nbb_angle = my_conformation.bond_angle(N28, CA28, C28) # get bond angle; type is float; in degree\n```\n\n","source":"_posts/Note _ PyRosetta Basics (1)_ Pose.md","raw":"title: 'PyRosetta Basics (1): Pose'\ndate: '2025-08-21 12:42:40'\nupdated: '2025-08-21 12:42:42'\ntags:\n - PyRosetta\n - protein design\n - biochemistry\n - protein\n - note\ncategories:\n - protein design\n---\n# PyRosetta Basics (1): Pose\n```python\nfrom pyrosetta import *\ninit()\n#import pyrosetta\n#pyrosetta.init()\n```\n\n## `Pose`class\n### Introduction\n1. Simplified explanation: \n 1. `Pose`(`pyrosetta.Pose`) is defined as a Python class\n 2. `Pose`is the core concept of PyRosetta\n 3. An instance of the`Pose`class is refered to as a \"pose object\".\n 4. A pose object is a protein structure.\n2. Further explanation:\n 1. A pose object may also include informations about related ions, ligand and other molecules.\n 2. A pose object may have more than one protein chains (quaternary protein, or protein complex)\n 3. Like any other Python classes, the`Pose`class has methods and attributes.\n 4. Class methods can be visited from the instances of the class.\n\n### `Pose` instantiation\n#### Initiate an instance of `Pose` from a PDB file\n```python\npose_1 = pose_from_pdb(\"./path_to_pdb/5tj3.pdb\") \n# pyrosetta.pose_from_pdb\n# load '5tj3.pdb' from file\n```\n\n#### Initiate an instance of `Pose` from [https://www.rcsb.org/](https://www.rcsb.org/)\n```python\npose_2 = pose_from_rcsb(\"5TJ3\")\n# pyrosetta.pose_from_rcsb\n# load 5TJ3 from online database\n```\n\n#### Initiate an instance of `Pose`from a string (a sequence)\n```python\npose_3 = pose_from_sequence(\"AAAAAAAAAA\")\n# pyrosetta.pose_from_sequence\n# load a \"poly alanine sequence\" from string\n```\n\n#### Initiate an empty instance of `Pose` (And create a clone of a `pose` object)\n```python\npose_4 = Pose() # Now pose_4 is empty\n\n# we can now use pose_4 to create a deep clone (copy) of pose_1\npose_4.assign(pose_1)\n```\n\n### `Pose`methods\n#### Copy a `pose`object via `Pose.assign`\n```python\n# Assume that we have a Pose instance called `my_pose`\nmy_pose_clone = Pose() # Now my_pose_clone is empty\n\n#create a deep clone (copy) of my_pose\nmy_pose_clone.assign(my_pose)\n\n\n```\n\n<font style=\"color:#DF2A3F;\">WARNING</font>: Avoid writing something like:\n\n```python\nmy_pose_clone = my_pose \n# This is incorrect\n```\n\nBecause in this way, my_pose_clone is pointed to value of my_pose, and modification to my_pose_clone will change my_pose.\n\n#### Copy a `pose`object via `Pose.clone`\n```python\n# assume that we have a `pose` object called `my_pose`\nmy_pose_clone = my_pose.clone()\n```\n\n#### Get sequence\n```python\n# `my_pose` is an instance of Pose\nmy_seq = my_pose.sequence()\n# `my_seq` is a string, storing the sequence of my_pose\n```\n\n#### Get annotated sequence\n```python\nmy_seq_annotated = my_pose.annotated_sequence()\n# `my_seq` is a string, storing the annotated sequence of my_pose\n# annotations are like: '...T[THR:phosphorylated]...'\n```\n\n#### Get total residue count\n```python\nmy_total_residue_count = my_pose.total_residue()\n# `my_total_residue_count` is an integer\n```\n\n#### Get dihedral angles\n```python\n# `residue_id` is the ID (in pose) of a residue, type is integer\nmy_pose.phi(residue_id) # C-CaN-C dihedral\n# >>> −64.8\nmy_pose.psi(residue_id) # N-CaC-N dihedral\n# >>> -41.0\nmy_pose.chi(1, residue_id) # 1st C-C dihedral in side chain\n# >>> -82.8\n```\n\n#### Get an `Energies`object\n```python\nmy_energies = my_pose.energies()\n\nprint(my_energies.show(24)) # Print all energies terms (unweighted) of residue 24\n```\n\n#### Get a`Residue` object\n```python\nresidue_20th = my_pose.residue(20)\n# `residue_20th` is an object that stores the 20th residue of `my_pose`\n```\n\nSee \"Residue objects\" in this note \n\n<font style=\"color:#DF2A3F;\">WARNING</font>: \"the 20th residue in pose\" is not equal to \"the 20th residue in PDB\", because a pdb file may contain more than one chain.\n\n#### Get a`PdbInfo`object\nThis object is a bridge between a `Pose` object and a PDB file:\n\n1. This object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).\n2. Or, this object stores information that can be written into a PDB file.\n\n```python\nmy_pdb_info = my_pose.pdb_info()\n```\n\nSee \"PdbInfo objects\" in this note \n\n#### Get a`Conformation`object\n```python\nmy_conformation = my_pose.conformation() # Get conformation object\n```\n\n#### Set dihedral angles (a basic mover)\n```python\nmy_pose.set_phi(24, -64.8) # set phi of residue #24 to -64.8\nmy_pose.set_psi(24, -41.0) # set psi of residue #24 to -41.0\n```\n\n#### Set foldtree (requires a pre-defined `FoldTree`object)\n```python\n# Assume that we have a `FoldTree` object called `my_ft`\nmy_pose.fold_tree(my_ft)\n```\n\n#### Output (Save) a pose as a PDB file\n```python\nmy_pose.dump_pdb('/outputs/my_pose_arxiv.pdb')\n```\n\n## `Residue` class\n`Residue`is a secondary class of `Pose`.\n\nA `residue`object stores information about a residue.\n\n<font style=\"color:#DF2A3F;\">NOTICE</font>: An ion, or a small molecule ligand, etc. is also seen as a residue.\n\n### Get residue name\n```python\nresidue_20th = my_pose.residue(20)\n# my_pose is a `Pose` object\n# residue_20th is a `Residue` object\nresidue_20th_name = residue_20th.name()\n# residue_20th_name is a string, storing the uppercased 3-letter name\n# e.g. 'ASP'\n```\n\n### Get residue property: `is_xxx`booleans\n```python\nresidue_24th = my_pose.residue(24) # Get #24 residue from my_pose\nresidue_24th_is_charged = residue_24th.is_charged() # Boolean, `True` if it is charged\nresidue_24th_is_aa = residue_24th.is_protein() # Boolean, `True` if it is an amino acid\n```\n\n### Get atom index\n```python\nresidue_24th = my_pose.residue(24) # get #24 residue\ncarbon_alpha_of_residue_24th = residue_24th.atom_index(\"CA\")\n```\n\n`\"N\"`is the nitrogen of main-chain amino group.\n\n`\"CA\"`is the central carbon.\n\n`\"C\"`is the carbon of main-chain carboxyl group.\n\nFor atom nomenclatures, search for \"amino acid structure\".\n\n### Get atom xyz coordinates (for vector-related calculations)\n```python\n# `residue_24th` is a residue in `my_pose`\nN_xyz = residue_24th.xyz(\"N\")\n# N_xyz is a vector (length = 3)\n```\n\n\n\n## `PdbInfo`class\n`PdbInfo`is a secondary class of `Pose`.\n\nThis class is a bridge between a `Pose` object and a PDB file:\n\n1. A `pdb_info`object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).\n2. Or, this object stores information that can be written into a PDB file.\n\n### Convert residue ID (number): `pdb2pose` and `pose2pdb`\nThe ID (number) of a residue starts at #1 in pose.\n\nThe ID of a residue in a `pose`object is different from its ID in a `.pdb`file.\n\n```python\n# In PDB file, a residue of interect is in \"chain A\", and its ID (number) in the PDB file is 24\n# But its ID in the `Pose` object (my_pose) is unknown.\nmy_pdb_info = my_pose.pdb_info()\nmy_residue_id_in_pose = my_pdb_info.pdb2pose('A', 24) # get the residue ID in pose, stored as an integer\nmy_residue = my_pose.residue(my_residue_id_in_pose) # get the `Residue` object by its ID in pose\n\n# alternatively, we can call the methods in a chain: \n# my_residue_id_in_pose = my_pose.pdb_info().pdb2pose('A', 24)\n```\n\n```python\n# On the other hand, we can get the corresponding PDB chain infomation and ID information for a specific residue\n# In a `Pose` object, a residue is at #1 position (its ID is 1), but its location in corresponding PDB file is unknown\nmy_residue_info_in_pdb = my_pdb_info.pose2pdb(1)\n# my_residue_info_in_pdb is a string that looks like '24 A'\n```\n\n### Get chain information & Get number (ID) information\n```python\n# a `Pose` instance called `my_pose`, and a residue of interest whose ID (in pose) is 1\nmy_pose.pdb_info().chain(1)\n# >>> A\n# The #1 residue is in 'chain A'\nmy_pose.pdb_info().number(1)\n# >>> 24\n# The ID of #1 (in pose) residue in corresponding PDB file is 24\n```\n\n### Set `PdbInfo`\n```python\n# assume that my_pose is a `pose` object\nmy_pose.pdb_info().name(\"test\") \n# set the name of this pose in its pdb_info as \"test\"\n# if it is sent to PyMOL, it will be displayed as \"test\" in the object list\n```\n\n## `Conformation`class\n### Get bond length & Get bond angle\n```python\n# given a `residue_id` (ID of a residue):\nresidue_28th = my_pose.residue(residue_id) # Get residue \nN28 = AtomID(residue_28th.atom_index(\"N\"), residue_id) # Construct an `AtomID` object for backbone nitrogen\nCA28 = AtomID(residue_28th.atom_index(\"CA\"), residue_id)\nC28 = AtomID(res_28.atom_index(\"C\"), resid)\n\nmy_conformation = my_pose.conformation() # Get conformation object\n\nN_CA_28_bond_length = my_conformation.bond_length(N28, CA28) # get bond length; type is float\nbb_angle = my_conformation.bond_angle(N28, CA28, C28) # get bond angle; type is float; in degree\n```\n\n","slug":"Note _ PyRosetta Basics (1)_ Pose","published":1,"comments":1,"layout":"post","photos":[],"_id":"cmekx8a7v004qcgu6hfq56d9p","content":"<h1 id=\"PyRosetta-Basics-1-Pose\"><a href=\"#PyRosetta-Basics-1-Pose\" class=\"headerlink\" title=\"PyRosetta Basics (1): Pose\"></a>PyRosetta Basics (1): Pose</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init()</span><br><span class=\"line\"><span class=\"comment\">#import pyrosetta</span></span><br><span class=\"line\"><span class=\"comment\">#pyrosetta.init()</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Poseclass\"><a href=\"#Poseclass\" class=\"headerlink\" title=\"Poseclass\"></a><code>Pose</code>class</h2><h3 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h3><ol>\n<li>Simplified explanation: <ol>\n<li><code>Pose</code>(<code>pyrosetta.Pose</code>) is defined as a Python class</li>\n<li><code>Pose</code>is the core concept of PyRosetta</li>\n<li>An instance of the<code>Pose</code>class is refered to as a “pose object”.</li>\n<li>A pose object is a protein structure.</li>\n</ol>\n</li>\n<li>Further explanation:<ol>\n<li>A pose object may also include informations about related ions, ligand and other molecules.</li>\n<li>A pose object may have more than one protein chains (quaternary protein, or protein complex)</li>\n<li>Like any other Python classes, the<code>Pose</code>class has methods and attributes.</li>\n<li>Class methods can be visited from the instances of the class.</li>\n</ol>\n</li>\n</ol>\n<h3 id=\"Pose-instantiation\"><a href=\"#Pose-instantiation\" class=\"headerlink\" title=\"Pose instantiation\"></a><code>Pose</code> instantiation</h3><h4 id=\"Initiate-an-instance-of-Pose-from-a-PDB-file\"><a href=\"#Initiate-an-instance-of-Pose-from-a-PDB-file\" class=\"headerlink\" title=\"Initiate an instance of Pose from a PDB file\"></a>Initiate an instance of <code>Pose</code> from a PDB file</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_1 = pose_from_pdb(<span class=\"string\">"./path_to_pdb/5tj3.pdb"</span>) </span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.pose_from_pdb</span></span><br><span class=\"line\"><span class=\"comment\"># load '5tj3.pdb' from file</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Initiate-an-instance-of-Pose-from-https-www-rcsb-org\"><a href=\"#Initiate-an-instance-of-Pose-from-https-www-rcsb-org\" class=\"headerlink\" title=\"Initiate an instance of Pose from https://www.rcsb.org/\"></a>Initiate an instance of <code>Pose</code> from <a href=\"https://www.rcsb.org/\">https://www.rcsb.org/</a></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_2 = pose_from_rcsb(<span class=\"string\">"5TJ3"</span>)</span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.pose_from_rcsb</span></span><br><span class=\"line\"><span class=\"comment\"># load 5TJ3 from online database</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Initiate-an-instance-of-Posefrom-a-string-a-sequence\"><a href=\"#Initiate-an-instance-of-Posefrom-a-string-a-sequence\" class=\"headerlink\" title=\"Initiate an instance of Posefrom a string (a sequence)\"></a>Initiate an instance of <code>Pose</code>from a string (a sequence)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_3 = pose_from_sequence(<span class=\"string\">"AAAAAAAAAA"</span>)</span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.pose_from_sequence</span></span><br><span class=\"line\"><span class=\"comment\"># load a "poly alanine sequence" from string</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Initiate-an-empty-instance-of-Pose-And-create-a-clone-of-a-pose-object\"><a href=\"#Initiate-an-empty-instance-of-Pose-And-create-a-clone-of-a-pose-object\" class=\"headerlink\" title=\"Initiate an empty instance of Pose (And create a clone of a pose object)\"></a>Initiate an empty instance of <code>Pose</code> (And create a clone of a <code>pose</code> object)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_4 = Pose() <span class=\"comment\"># Now pose_4 is empty</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># we can now use pose_4 to create a deep clone (copy) of pose_1</span></span><br><span class=\"line\">pose_4.assign(pose_1)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Posemethods\"><a href=\"#Posemethods\" class=\"headerlink\" title=\"Posemethods\"></a><code>Pose</code>methods</h3><h4 id=\"Copy-a-poseobject-via-Pose-assign\"><a href=\"#Copy-a-poseobject-via-Pose-assign\" class=\"headerlink\" title=\"Copy a poseobject via Pose.assign\"></a>Copy a <code>pose</code>object via <code>Pose.assign</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a Pose instance called `my_pose`</span></span><br><span class=\"line\">my_pose_clone = Pose() <span class=\"comment\"># Now my_pose_clone is empty</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#create a deep clone (copy) of my_pose</span></span><br><span class=\"line\">my_pose_clone.assign(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"></span><br></pre></td></tr></table></figure>\n\n<p><font style=\"color:#DF2A3F;\">WARNING</font>: Avoid writing something like:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose_clone = my_pose </span><br><span class=\"line\"><span class=\"comment\"># This is incorrect</span></span><br></pre></td></tr></table></figure>\n\n<p>Because in this way, my_pose_clone is pointed to value of my_pose, and modification to my_pose_clone will change my_pose.</p>\n<h4 id=\"Copy-a-poseobject-via-Pose-clone\"><a href=\"#Copy-a-poseobject-via-Pose-clone\" class=\"headerlink\" title=\"Copy a poseobject via Pose.clone\"></a>Copy a <code>pose</code>object via <code>Pose.clone</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># assume that we have a `pose` object called `my_pose`</span></span><br><span class=\"line\">my_pose_clone = my_pose.clone()</span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-sequence\"><a href=\"#Get-sequence\" class=\"headerlink\" title=\"Get sequence\"></a>Get sequence</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># `my_pose` is an instance of Pose</span></span><br><span class=\"line\">my_seq = my_pose.sequence()</span><br><span class=\"line\"><span class=\"comment\"># `my_seq` is a string, storing the sequence of my_pose</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-annotated-sequence\"><a href=\"#Get-annotated-sequence\" class=\"headerlink\" title=\"Get annotated sequence\"></a>Get annotated sequence</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_seq_annotated = my_pose.annotated_sequence()</span><br><span class=\"line\"><span class=\"comment\"># `my_seq` is a string, storing the annotated sequence of my_pose</span></span><br><span class=\"line\"><span class=\"comment\"># annotations are like: '...T[THR:phosphorylated]...'</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-total-residue-count\"><a href=\"#Get-total-residue-count\" class=\"headerlink\" title=\"Get total residue count\"></a>Get total residue count</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_total_residue_count = my_pose.total_residue()</span><br><span class=\"line\"><span class=\"comment\"># `my_total_residue_count` is an integer</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-dihedral-angles\"><a href=\"#Get-dihedral-angles\" class=\"headerlink\" title=\"Get dihedral angles\"></a>Get dihedral angles</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># `residue_id` is the ID (in pose) of a residue, type is integer</span></span><br><span class=\"line\">my_pose.phi(residue_id) <span class=\"comment\"># C-CaN-C dihedral</span></span><br><span class=\"line\"><span class=\"comment\"># >>> −64.8</span></span><br><span class=\"line\">my_pose.psi(residue_id) <span class=\"comment\"># N-CaC-N dihedral</span></span><br><span class=\"line\"><span class=\"comment\"># >>> -41.0</span></span><br><span class=\"line\">my_pose.chi(<span class=\"number\">1</span>, residue_id) <span class=\"comment\"># 1st C-C dihedral in side chain</span></span><br><span class=\"line\"><span class=\"comment\"># >>> -82.8</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-an-Energiesobject\"><a href=\"#Get-an-Energiesobject\" class=\"headerlink\" title=\"Get an Energiesobject\"></a>Get an <code>Energies</code>object</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_energies = my_pose.energies()</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"built_in\">print</span>(my_energies.show(<span class=\"number\">24</span>)) <span class=\"comment\"># Print all energies terms (unweighted) of residue 24</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-aResidue-object\"><a href=\"#Get-aResidue-object\" class=\"headerlink\" title=\"Get aResidue object\"></a>Get a<code>Residue</code> object</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_20th = my_pose.residue(<span class=\"number\">20</span>)</span><br><span class=\"line\"><span class=\"comment\"># `residue_20th` is an object that stores the 20th residue of `my_pose`</span></span><br></pre></td></tr></table></figure>\n\n<p>See “Residue objects” in this note </p>\n<p><font style=\"color:#DF2A3F;\">WARNING</font>: “the 20th residue in pose” is not equal to “the 20th residue in PDB”, because a pdb file may contain more than one chain.</p>\n<h4 id=\"Get-aPdbInfoobject\"><a href=\"#Get-aPdbInfoobject\" class=\"headerlink\" title=\"Get aPdbInfoobject\"></a>Get a<code>PdbInfo</code>object</h4><p>This object is a bridge between a <code>Pose</code> object and a PDB file:</p>\n<ol>\n<li>This object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).</li>\n<li>Or, this object stores information that can be written into a PDB file.</li>\n</ol>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pdb_info = my_pose.pdb_info()</span><br></pre></td></tr></table></figure>\n\n<p>See “PdbInfo objects” in this note </p>\n<h4 id=\"Get-aConformationobject\"><a href=\"#Get-aConformationobject\" class=\"headerlink\" title=\"Get aConformationobject\"></a>Get a<code>Conformation</code>object</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_conformation = my_pose.conformation() <span class=\"comment\"># Get conformation object</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Set-dihedral-angles-a-basic-mover\"><a href=\"#Set-dihedral-angles-a-basic-mover\" class=\"headerlink\" title=\"Set dihedral angles (a basic mover)\"></a>Set dihedral angles (a basic mover)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose.set_phi(<span class=\"number\">24</span>, -<span class=\"number\">64.8</span>) <span class=\"comment\"># set phi of residue #24 to -64.8</span></span><br><span class=\"line\">my_pose.set_psi(<span class=\"number\">24</span>, -<span class=\"number\">41.0</span>) <span class=\"comment\"># set psi of residue #24 to -41.0</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Set-foldtree-requires-a-pre-defined-FoldTreeobject\"><a href=\"#Set-foldtree-requires-a-pre-defined-FoldTreeobject\" class=\"headerlink\" title=\"Set foldtree (requires a pre-defined FoldTreeobject)\"></a>Set foldtree (requires a pre-defined <code>FoldTree</code>object)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `FoldTree` object called `my_ft`</span></span><br><span class=\"line\">my_pose.fold_tree(my_ft)</span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Output-Save-a-pose-as-a-PDB-file\"><a href=\"#Output-Save-a-pose-as-a-PDB-file\" class=\"headerlink\" title=\"Output (Save) a pose as a PDB file\"></a>Output (Save) a pose as a PDB file</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose.dump_pdb(<span class=\"string\">'/outputs/my_pose_arxiv.pdb'</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Residue-class\"><a href=\"#Residue-class\" class=\"headerlink\" title=\"Residue class\"></a><code>Residue</code> class</h2><p><code>Residue</code>is a secondary class of <code>Pose</code>.</p>\n<p>A <code>residue</code>object stores information about a residue.</p>\n<p><font style=\"color:#DF2A3F;\">NOTICE</font>: An ion, or a small molecule ligand, etc. is also seen as a residue.</p>\n<h3 id=\"Get-residue-name\"><a href=\"#Get-residue-name\" class=\"headerlink\" title=\"Get residue name\"></a>Get residue name</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_20th = my_pose.residue(<span class=\"number\">20</span>)</span><br><span class=\"line\"><span class=\"comment\"># my_pose is a `Pose` object</span></span><br><span class=\"line\"><span class=\"comment\"># residue_20th is a `Residue` object</span></span><br><span class=\"line\">residue_20th_name = residue_20th.name()</span><br><span class=\"line\"><span class=\"comment\"># residue_20th_name is a string, storing the uppercased 3-letter name</span></span><br><span class=\"line\"><span class=\"comment\"># e.g. 'ASP'</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Get-residue-property-is-xxxbooleans\"><a href=\"#Get-residue-property-is-xxxbooleans\" class=\"headerlink\" title=\"Get residue property: is_xxxbooleans\"></a>Get residue property: <code>is_xxx</code>booleans</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_24th = my_pose.residue(<span class=\"number\">24</span>) <span class=\"comment\"># Get #24 residue from my_pose</span></span><br><span class=\"line\">residue_24th_is_charged = residue_24th.is_charged() <span class=\"comment\"># Boolean, `True` if it is charged</span></span><br><span class=\"line\">residue_24th_is_aa = residue_24th.is_protein() <span class=\"comment\"># Boolean, `True` if it is an amino acid</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Get-atom-index\"><a href=\"#Get-atom-index\" class=\"headerlink\" title=\"Get atom index\"></a>Get atom index</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_24th = my_pose.residue(<span class=\"number\">24</span>) <span class=\"comment\"># get #24 residue</span></span><br><span class=\"line\">carbon_alpha_of_residue_24th = residue_24th.atom_index(<span class=\"string\">"CA"</span>)</span><br></pre></td></tr></table></figure>\n\n<p><code>"N"</code>is the nitrogen of main-chain amino group.</p>\n<p><code>"CA"</code>is the central carbon.</p>\n<p><code>"C"</code>is the carbon of main-chain carboxyl group.</p>\n<p>For atom nomenclatures, search for “amino acid structure”.</p>\n<h3 id=\"Get-atom-xyz-coordinates-for-vector-related-calculations\"><a href=\"#Get-atom-xyz-coordinates-for-vector-related-calculations\" class=\"headerlink\" title=\"Get atom xyz coordinates (for vector-related calculations)\"></a>Get atom xyz coordinates (for vector-related calculations)</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># `residue_24th` is a residue in `my_pose`</span></span><br><span class=\"line\">N_xyz = residue_24th.xyz(<span class=\"string\">"N"</span>)</span><br><span class=\"line\"><span class=\"comment\"># N_xyz is a vector (length = 3)</span></span><br></pre></td></tr></table></figure>\n\n\n\n<h2 id=\"PdbInfoclass\"><a href=\"#PdbInfoclass\" class=\"headerlink\" title=\"PdbInfoclass\"></a><code>PdbInfo</code>class</h2><p><code>PdbInfo</code>is a secondary class of <code>Pose</code>.</p>\n<p>This class is a bridge between a <code>Pose</code> object and a PDB file:</p>\n<ol>\n<li>A <code>pdb_info</code>object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).</li>\n<li>Or, this object stores information that can be written into a PDB file.</li>\n</ol>\n<h3 id=\"Convert-residue-ID-number-pdb2pose-and-pose2pdb\"><a href=\"#Convert-residue-ID-number-pdb2pose-and-pose2pdb\" class=\"headerlink\" title=\"Convert residue ID (number): pdb2pose and pose2pdb\"></a>Convert residue ID (number): <code>pdb2pose</code> and <code>pose2pdb</code></h3><p>The ID (number) of a residue starts at #1 in pose.</p>\n<p>The ID of a residue in a <code>pose</code>object is different from its ID in a <code>.pdb</code>file.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># In PDB file, a residue of interect is in "chain A", and its ID (number) in the PDB file is 24</span></span><br><span class=\"line\"><span class=\"comment\"># But its ID in the `Pose` object (my_pose) is unknown.</span></span><br><span class=\"line\">my_pdb_info = my_pose.pdb_info()</span><br><span class=\"line\">my_residue_id_in_pose = my_pdb_info.pdb2pose(<span class=\"string\">'A'</span>, <span class=\"number\">24</span>) <span class=\"comment\"># get the residue ID in pose, stored as an integer</span></span><br><span class=\"line\">my_residue = my_pose.residue(my_residue_id_in_pose) <span class=\"comment\"># get the `Residue` object by its ID in pose</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># alternatively, we can call the methods in a chain: </span></span><br><span class=\"line\"><span class=\"comment\"># my_residue_id_in_pose = my_pose.pdb_info().pdb2pose('A', 24)</span></span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># On the other hand, we can get the corresponding PDB chain infomation and ID information for a specific residue</span></span><br><span class=\"line\"><span class=\"comment\"># In a `Pose` object, a residue is at #1 position (its ID is 1), but its location in corresponding PDB file is unknown</span></span><br><span class=\"line\">my_residue_info_in_pdb = my_pdb_info.pose2pdb(<span class=\"number\">1</span>)</span><br><span class=\"line\"><span class=\"comment\"># my_residue_info_in_pdb is a string that looks like '24 A'</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Get-chain-information-Get-number-ID-information\"><a href=\"#Get-chain-information-Get-number-ID-information\" class=\"headerlink\" title=\"Get chain information & Get number (ID) information\"></a>Get chain information & Get number (ID) information</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># a `Pose` instance called `my_pose`, and a residue of interest whose ID (in pose) is 1</span></span><br><span class=\"line\">my_pose.pdb_info().chain(<span class=\"number\">1</span>)</span><br><span class=\"line\"><span class=\"comment\"># >>> A</span></span><br><span class=\"line\"><span class=\"comment\"># The #1 residue is in 'chain A'</span></span><br><span class=\"line\">my_pose.pdb_info().number(<span class=\"number\">1</span>)</span><br><span class=\"line\"><span class=\"comment\"># >>> 24</span></span><br><span class=\"line\"><span class=\"comment\"># The ID of #1 (in pose) residue in corresponding PDB file is 24</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Set-PdbInfo\"><a href=\"#Set-PdbInfo\" class=\"headerlink\" title=\"Set PdbInfo\"></a>Set <code>PdbInfo</code></h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># assume that my_pose is a `pose` object</span></span><br><span class=\"line\">my_pose.pdb_info().name(<span class=\"string\">"test"</span>) </span><br><span class=\"line\"><span class=\"comment\"># set the name of this pose in its pdb_info as "test"</span></span><br><span class=\"line\"><span class=\"comment\"># if it is sent to PyMOL, it will be displayed as "test" in the object list</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Conformationclass\"><a href=\"#Conformationclass\" class=\"headerlink\" title=\"Conformationclass\"></a><code>Conformation</code>class</h2><h3 id=\"Get-bond-length-Get-bond-angle\"><a href=\"#Get-bond-length-Get-bond-angle\" class=\"headerlink\" title=\"Get bond length & Get bond angle\"></a>Get bond length & Get bond angle</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># given a `residue_id` (ID of a residue):</span></span><br><span class=\"line\">residue_28th = my_pose.residue(residue_id) <span class=\"comment\"># Get residue </span></span><br><span class=\"line\">N28 = AtomID(residue_28th.atom_index(<span class=\"string\">"N"</span>), residue_id) <span class=\"comment\"># Construct an `AtomID` object for backbone nitrogen</span></span><br><span class=\"line\">CA28 = AtomID(residue_28th.atom_index(<span class=\"string\">"CA"</span>), residue_id)</span><br><span class=\"line\">C28 = AtomID(res_28.atom_index(<span class=\"string\">"C"</span>), resid)</span><br><span class=\"line\"></span><br><span class=\"line\">my_conformation = my_pose.conformation() <span class=\"comment\"># Get conformation object</span></span><br><span class=\"line\"></span><br><span class=\"line\">N_CA_28_bond_length = my_conformation.bond_length(N28, CA28) <span class=\"comment\"># get bond length; type is float</span></span><br><span class=\"line\">bb_angle = my_conformation.bond_angle(N28, CA28, C28) <span class=\"comment\"># get bond angle; type is float; in degree</span></span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyRosetta-Basics-1-Pose\"><a href=\"#PyRosetta-Basics-1-Pose\" class=\"headerlink\" title=\"PyRosetta Basics (1): Pose\"></a>PyRosetta Basics (1): Pose</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init()</span><br><span class=\"line\"><span class=\"comment\">#import pyrosetta</span></span><br><span class=\"line\"><span class=\"comment\">#pyrosetta.init()</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Poseclass\"><a href=\"#Poseclass\" class=\"headerlink\" title=\"Poseclass\"></a><code>Pose</code>class</h2><h3 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h3><ol>\n<li>Simplified explanation: <ol>\n<li><code>Pose</code>(<code>pyrosetta.Pose</code>) is defined as a Python class</li>\n<li><code>Pose</code>is the core concept of PyRosetta</li>\n<li>An instance of the<code>Pose</code>class is refered to as a “pose object”.</li>\n<li>A pose object is a protein structure.</li>\n</ol>\n</li>\n<li>Further explanation:<ol>\n<li>A pose object may also include informations about related ions, ligand and other molecules.</li>\n<li>A pose object may have more than one protein chains (quaternary protein, or protein complex)</li>\n<li>Like any other Python classes, the<code>Pose</code>class has methods and attributes.</li>\n<li>Class methods can be visited from the instances of the class.</li>\n</ol>\n</li>\n</ol>\n<h3 id=\"Pose-instantiation\"><a href=\"#Pose-instantiation\" class=\"headerlink\" title=\"Pose instantiation\"></a><code>Pose</code> instantiation</h3><h4 id=\"Initiate-an-instance-of-Pose-from-a-PDB-file\"><a href=\"#Initiate-an-instance-of-Pose-from-a-PDB-file\" class=\"headerlink\" title=\"Initiate an instance of Pose from a PDB file\"></a>Initiate an instance of <code>Pose</code> from a PDB file</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_1 = pose_from_pdb(<span class=\"string\">"./path_to_pdb/5tj3.pdb"</span>) </span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.pose_from_pdb</span></span><br><span class=\"line\"><span class=\"comment\"># load '5tj3.pdb' from file</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Initiate-an-instance-of-Pose-from-https-www-rcsb-org\"><a href=\"#Initiate-an-instance-of-Pose-from-https-www-rcsb-org\" class=\"headerlink\" title=\"Initiate an instance of Pose from https://www.rcsb.org/\"></a>Initiate an instance of <code>Pose</code> from <a href=\"https://www.rcsb.org/\">https://www.rcsb.org/</a></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_2 = pose_from_rcsb(<span class=\"string\">"5TJ3"</span>)</span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.pose_from_rcsb</span></span><br><span class=\"line\"><span class=\"comment\"># load 5TJ3 from online database</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Initiate-an-instance-of-Posefrom-a-string-a-sequence\"><a href=\"#Initiate-an-instance-of-Posefrom-a-string-a-sequence\" class=\"headerlink\" title=\"Initiate an instance of Posefrom a string (a sequence)\"></a>Initiate an instance of <code>Pose</code>from a string (a sequence)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_3 = pose_from_sequence(<span class=\"string\">"AAAAAAAAAA"</span>)</span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.pose_from_sequence</span></span><br><span class=\"line\"><span class=\"comment\"># load a "poly alanine sequence" from string</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Initiate-an-empty-instance-of-Pose-And-create-a-clone-of-a-pose-object\"><a href=\"#Initiate-an-empty-instance-of-Pose-And-create-a-clone-of-a-pose-object\" class=\"headerlink\" title=\"Initiate an empty instance of Pose (And create a clone of a pose object)\"></a>Initiate an empty instance of <code>Pose</code> (And create a clone of a <code>pose</code> object)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pose_4 = Pose() <span class=\"comment\"># Now pose_4 is empty</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># we can now use pose_4 to create a deep clone (copy) of pose_1</span></span><br><span class=\"line\">pose_4.assign(pose_1)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Posemethods\"><a href=\"#Posemethods\" class=\"headerlink\" title=\"Posemethods\"></a><code>Pose</code>methods</h3><h4 id=\"Copy-a-poseobject-via-Pose-assign\"><a href=\"#Copy-a-poseobject-via-Pose-assign\" class=\"headerlink\" title=\"Copy a poseobject via Pose.assign\"></a>Copy a <code>pose</code>object via <code>Pose.assign</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a Pose instance called `my_pose`</span></span><br><span class=\"line\">my_pose_clone = Pose() <span class=\"comment\"># Now my_pose_clone is empty</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#create a deep clone (copy) of my_pose</span></span><br><span class=\"line\">my_pose_clone.assign(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"></span><br></pre></td></tr></table></figure>\n\n<p><font style=\"color:#DF2A3F;\">WARNING</font>: Avoid writing something like:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose_clone = my_pose </span><br><span class=\"line\"><span class=\"comment\"># This is incorrect</span></span><br></pre></td></tr></table></figure>\n\n<p>Because in this way, my_pose_clone is pointed to value of my_pose, and modification to my_pose_clone will change my_pose.</p>\n<h4 id=\"Copy-a-poseobject-via-Pose-clone\"><a href=\"#Copy-a-poseobject-via-Pose-clone\" class=\"headerlink\" title=\"Copy a poseobject via Pose.clone\"></a>Copy a <code>pose</code>object via <code>Pose.clone</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># assume that we have a `pose` object called `my_pose`</span></span><br><span class=\"line\">my_pose_clone = my_pose.clone()</span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-sequence\"><a href=\"#Get-sequence\" class=\"headerlink\" title=\"Get sequence\"></a>Get sequence</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># `my_pose` is an instance of Pose</span></span><br><span class=\"line\">my_seq = my_pose.sequence()</span><br><span class=\"line\"><span class=\"comment\"># `my_seq` is a string, storing the sequence of my_pose</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-annotated-sequence\"><a href=\"#Get-annotated-sequence\" class=\"headerlink\" title=\"Get annotated sequence\"></a>Get annotated sequence</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_seq_annotated = my_pose.annotated_sequence()</span><br><span class=\"line\"><span class=\"comment\"># `my_seq` is a string, storing the annotated sequence of my_pose</span></span><br><span class=\"line\"><span class=\"comment\"># annotations are like: '...T[THR:phosphorylated]...'</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-total-residue-count\"><a href=\"#Get-total-residue-count\" class=\"headerlink\" title=\"Get total residue count\"></a>Get total residue count</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_total_residue_count = my_pose.total_residue()</span><br><span class=\"line\"><span class=\"comment\"># `my_total_residue_count` is an integer</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-dihedral-angles\"><a href=\"#Get-dihedral-angles\" class=\"headerlink\" title=\"Get dihedral angles\"></a>Get dihedral angles</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># `residue_id` is the ID (in pose) of a residue, type is integer</span></span><br><span class=\"line\">my_pose.phi(residue_id) <span class=\"comment\"># C-CaN-C dihedral</span></span><br><span class=\"line\"><span class=\"comment\"># >>> −64.8</span></span><br><span class=\"line\">my_pose.psi(residue_id) <span class=\"comment\"># N-CaC-N dihedral</span></span><br><span class=\"line\"><span class=\"comment\"># >>> -41.0</span></span><br><span class=\"line\">my_pose.chi(<span class=\"number\">1</span>, residue_id) <span class=\"comment\"># 1st C-C dihedral in side chain</span></span><br><span class=\"line\"><span class=\"comment\"># >>> -82.8</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-an-Energiesobject\"><a href=\"#Get-an-Energiesobject\" class=\"headerlink\" title=\"Get an Energiesobject\"></a>Get an <code>Energies</code>object</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_energies = my_pose.energies()</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"built_in\">print</span>(my_energies.show(<span class=\"number\">24</span>)) <span class=\"comment\"># Print all energies terms (unweighted) of residue 24</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Get-aResidue-object\"><a href=\"#Get-aResidue-object\" class=\"headerlink\" title=\"Get aResidue object\"></a>Get a<code>Residue</code> object</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_20th = my_pose.residue(<span class=\"number\">20</span>)</span><br><span class=\"line\"><span class=\"comment\"># `residue_20th` is an object that stores the 20th residue of `my_pose`</span></span><br></pre></td></tr></table></figure>\n\n<p>See “Residue objects” in this note </p>\n<p><font style=\"color:#DF2A3F;\">WARNING</font>: “the 20th residue in pose” is not equal to “the 20th residue in PDB”, because a pdb file may contain more than one chain.</p>\n<h4 id=\"Get-aPdbInfoobject\"><a href=\"#Get-aPdbInfoobject\" class=\"headerlink\" title=\"Get aPdbInfoobject\"></a>Get a<code>PdbInfo</code>object</h4><p>This object is a bridge between a <code>Pose</code> object and a PDB file:</p>\n<ol>\n<li>This object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).</li>\n<li>Or, this object stores information that can be written into a PDB file.</li>\n</ol>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pdb_info = my_pose.pdb_info()</span><br></pre></td></tr></table></figure>\n\n<p>See “PdbInfo objects” in this note </p>\n<h4 id=\"Get-aConformationobject\"><a href=\"#Get-aConformationobject\" class=\"headerlink\" title=\"Get aConformationobject\"></a>Get a<code>Conformation</code>object</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_conformation = my_pose.conformation() <span class=\"comment\"># Get conformation object</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Set-dihedral-angles-a-basic-mover\"><a href=\"#Set-dihedral-angles-a-basic-mover\" class=\"headerlink\" title=\"Set dihedral angles (a basic mover)\"></a>Set dihedral angles (a basic mover)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose.set_phi(<span class=\"number\">24</span>, -<span class=\"number\">64.8</span>) <span class=\"comment\"># set phi of residue #24 to -64.8</span></span><br><span class=\"line\">my_pose.set_psi(<span class=\"number\">24</span>, -<span class=\"number\">41.0</span>) <span class=\"comment\"># set psi of residue #24 to -41.0</span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Set-foldtree-requires-a-pre-defined-FoldTreeobject\"><a href=\"#Set-foldtree-requires-a-pre-defined-FoldTreeobject\" class=\"headerlink\" title=\"Set foldtree (requires a pre-defined FoldTreeobject)\"></a>Set foldtree (requires a pre-defined <code>FoldTree</code>object)</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `FoldTree` object called `my_ft`</span></span><br><span class=\"line\">my_pose.fold_tree(my_ft)</span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Output-Save-a-pose-as-a-PDB-file\"><a href=\"#Output-Save-a-pose-as-a-PDB-file\" class=\"headerlink\" title=\"Output (Save) a pose as a PDB file\"></a>Output (Save) a pose as a PDB file</h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_pose.dump_pdb(<span class=\"string\">'/outputs/my_pose_arxiv.pdb'</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Residue-class\"><a href=\"#Residue-class\" class=\"headerlink\" title=\"Residue class\"></a><code>Residue</code> class</h2><p><code>Residue</code>is a secondary class of <code>Pose</code>.</p>\n<p>A <code>residue</code>object stores information about a residue.</p>\n<p><font style=\"color:#DF2A3F;\">NOTICE</font>: An ion, or a small molecule ligand, etc. is also seen as a residue.</p>\n<h3 id=\"Get-residue-name\"><a href=\"#Get-residue-name\" class=\"headerlink\" title=\"Get residue name\"></a>Get residue name</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_20th = my_pose.residue(<span class=\"number\">20</span>)</span><br><span class=\"line\"><span class=\"comment\"># my_pose is a `Pose` object</span></span><br><span class=\"line\"><span class=\"comment\"># residue_20th is a `Residue` object</span></span><br><span class=\"line\">residue_20th_name = residue_20th.name()</span><br><span class=\"line\"><span class=\"comment\"># residue_20th_name is a string, storing the uppercased 3-letter name</span></span><br><span class=\"line\"><span class=\"comment\"># e.g. 'ASP'</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Get-residue-property-is-xxxbooleans\"><a href=\"#Get-residue-property-is-xxxbooleans\" class=\"headerlink\" title=\"Get residue property: is_xxxbooleans\"></a>Get residue property: <code>is_xxx</code>booleans</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_24th = my_pose.residue(<span class=\"number\">24</span>) <span class=\"comment\"># Get #24 residue from my_pose</span></span><br><span class=\"line\">residue_24th_is_charged = residue_24th.is_charged() <span class=\"comment\"># Boolean, `True` if it is charged</span></span><br><span class=\"line\">residue_24th_is_aa = residue_24th.is_protein() <span class=\"comment\"># Boolean, `True` if it is an amino acid</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Get-atom-index\"><a href=\"#Get-atom-index\" class=\"headerlink\" title=\"Get atom index\"></a>Get atom index</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">residue_24th = my_pose.residue(<span class=\"number\">24</span>) <span class=\"comment\"># get #24 residue</span></span><br><span class=\"line\">carbon_alpha_of_residue_24th = residue_24th.atom_index(<span class=\"string\">"CA"</span>)</span><br></pre></td></tr></table></figure>\n\n<p><code>"N"</code>is the nitrogen of main-chain amino group.</p>\n<p><code>"CA"</code>is the central carbon.</p>\n<p><code>"C"</code>is the carbon of main-chain carboxyl group.</p>\n<p>For atom nomenclatures, search for “amino acid structure”.</p>\n<h3 id=\"Get-atom-xyz-coordinates-for-vector-related-calculations\"><a href=\"#Get-atom-xyz-coordinates-for-vector-related-calculations\" class=\"headerlink\" title=\"Get atom xyz coordinates (for vector-related calculations)\"></a>Get atom xyz coordinates (for vector-related calculations)</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># `residue_24th` is a residue in `my_pose`</span></span><br><span class=\"line\">N_xyz = residue_24th.xyz(<span class=\"string\">"N"</span>)</span><br><span class=\"line\"><span class=\"comment\"># N_xyz is a vector (length = 3)</span></span><br></pre></td></tr></table></figure>\n\n\n\n<h2 id=\"PdbInfoclass\"><a href=\"#PdbInfoclass\" class=\"headerlink\" title=\"PdbInfoclass\"></a><code>PdbInfo</code>class</h2><p><code>PdbInfo</code>is a secondary class of <code>Pose</code>.</p>\n<p>This class is a bridge between a <code>Pose</code> object and a PDB file:</p>\n<ol>\n<li>A <code>pdb_info</code>object stores information from the original PDB file (if the pose is from a pdb file or from the pdb database).</li>\n<li>Or, this object stores information that can be written into a PDB file.</li>\n</ol>\n<h3 id=\"Convert-residue-ID-number-pdb2pose-and-pose2pdb\"><a href=\"#Convert-residue-ID-number-pdb2pose-and-pose2pdb\" class=\"headerlink\" title=\"Convert residue ID (number): pdb2pose and pose2pdb\"></a>Convert residue ID (number): <code>pdb2pose</code> and <code>pose2pdb</code></h3><p>The ID (number) of a residue starts at #1 in pose.</p>\n<p>The ID of a residue in a <code>pose</code>object is different from its ID in a <code>.pdb</code>file.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># In PDB file, a residue of interect is in "chain A", and its ID (number) in the PDB file is 24</span></span><br><span class=\"line\"><span class=\"comment\"># But its ID in the `Pose` object (my_pose) is unknown.</span></span><br><span class=\"line\">my_pdb_info = my_pose.pdb_info()</span><br><span class=\"line\">my_residue_id_in_pose = my_pdb_info.pdb2pose(<span class=\"string\">'A'</span>, <span class=\"number\">24</span>) <span class=\"comment\"># get the residue ID in pose, stored as an integer</span></span><br><span class=\"line\">my_residue = my_pose.residue(my_residue_id_in_pose) <span class=\"comment\"># get the `Residue` object by its ID in pose</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># alternatively, we can call the methods in a chain: </span></span><br><span class=\"line\"><span class=\"comment\"># my_residue_id_in_pose = my_pose.pdb_info().pdb2pose('A', 24)</span></span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># On the other hand, we can get the corresponding PDB chain infomation and ID information for a specific residue</span></span><br><span class=\"line\"><span class=\"comment\"># In a `Pose` object, a residue is at #1 position (its ID is 1), but its location in corresponding PDB file is unknown</span></span><br><span class=\"line\">my_residue_info_in_pdb = my_pdb_info.pose2pdb(<span class=\"number\">1</span>)</span><br><span class=\"line\"><span class=\"comment\"># my_residue_info_in_pdb is a string that looks like '24 A'</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Get-chain-information-Get-number-ID-information\"><a href=\"#Get-chain-information-Get-number-ID-information\" class=\"headerlink\" title=\"Get chain information & Get number (ID) information\"></a>Get chain information & Get number (ID) information</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># a `Pose` instance called `my_pose`, and a residue of interest whose ID (in pose) is 1</span></span><br><span class=\"line\">my_pose.pdb_info().chain(<span class=\"number\">1</span>)</span><br><span class=\"line\"><span class=\"comment\"># >>> A</span></span><br><span class=\"line\"><span class=\"comment\"># The #1 residue is in 'chain A'</span></span><br><span class=\"line\">my_pose.pdb_info().number(<span class=\"number\">1</span>)</span><br><span class=\"line\"><span class=\"comment\"># >>> 24</span></span><br><span class=\"line\"><span class=\"comment\"># The ID of #1 (in pose) residue in corresponding PDB file is 24</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Set-PdbInfo\"><a href=\"#Set-PdbInfo\" class=\"headerlink\" title=\"Set PdbInfo\"></a>Set <code>PdbInfo</code></h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># assume that my_pose is a `pose` object</span></span><br><span class=\"line\">my_pose.pdb_info().name(<span class=\"string\">"test"</span>) </span><br><span class=\"line\"><span class=\"comment\"># set the name of this pose in its pdb_info as "test"</span></span><br><span class=\"line\"><span class=\"comment\"># if it is sent to PyMOL, it will be displayed as "test" in the object list</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Conformationclass\"><a href=\"#Conformationclass\" class=\"headerlink\" title=\"Conformationclass\"></a><code>Conformation</code>class</h2><h3 id=\"Get-bond-length-Get-bond-angle\"><a href=\"#Get-bond-length-Get-bond-angle\" class=\"headerlink\" title=\"Get bond length & Get bond angle\"></a>Get bond length & Get bond angle</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># given a `residue_id` (ID of a residue):</span></span><br><span class=\"line\">residue_28th = my_pose.residue(residue_id) <span class=\"comment\"># Get residue </span></span><br><span class=\"line\">N28 = AtomID(residue_28th.atom_index(<span class=\"string\">"N"</span>), residue_id) <span class=\"comment\"># Construct an `AtomID` object for backbone nitrogen</span></span><br><span class=\"line\">CA28 = AtomID(residue_28th.atom_index(<span class=\"string\">"CA"</span>), residue_id)</span><br><span class=\"line\">C28 = AtomID(res_28.atom_index(<span class=\"string\">"C"</span>), resid)</span><br><span class=\"line\"></span><br><span class=\"line\">my_conformation = my_pose.conformation() <span class=\"comment\"># Get conformation object</span></span><br><span class=\"line\"></span><br><span class=\"line\">N_CA_28_bond_length = my_conformation.bond_length(N28, CA28) <span class=\"comment\"># get bond length; type is float</span></span><br><span class=\"line\">bb_angle = my_conformation.bond_angle(N28, CA28, C28) <span class=\"comment\"># get bond angle; type is float; in degree</span></span><br></pre></td></tr></table></figure>\n\n"},{"title":"PyRosetta Basics (6): Movers for Backbone Folding","_content":"# PyRosetta Basics (6): Movers for Backbone Folding\n```python\n!pip install pyrosettacolabsetup\nimport pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\nimport pyrosetta; pyrosetta.init()\nfrom pyrosetta import *\nfrom pyrosetta.teaching import *\ninit()\n```\n\n## Introduction\nOne of the most basic operations in protein structure and design algorithms is manipulation of the protein conformation. \n\nIn Rosetta, these manipulations are organized into `mover`s. \n\nA `Mover` object simply changes the conformation of a given pose. \n\nIt can be simple, like a single φ or ψ angle change, or complex, like an entire refinement protocol.\n\n[Movers (RosettaScripts)](https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/Movers-RosettaScripts)\n\n## `MoveMap`class\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Most </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">Movers</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> require a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">MoveMap</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object to specify which degrees of freedom are fixed and which are free to change. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Example1:</font>\n\n```python\nmy_movemap = MoveMap()\nmy_movemap.set_bb(True) # Allowing a mover to change the backbone structure\n```\n\nExample2:\n\n```python\nmovemap.set_bb(False) # Prohibit a mover to change the backbone structure\nmovemap.set_bb(50, True) # Allow a mover to chage the backbone structure of residue #50\nmovemap.set_bb(51, True) # Allow a mover to chage the backbone structure of residue #51\n# Only the backbone structure at residue #50 and #51 can be modified by a mover\n```\n\n## Basic Backbone Folding Process\n### <font style=\"color:rgba(0, 0, 0, 0.87);\">Making a trial move</font>\nApply a _move_ (change) to the _pose_ (structure).\n\n### Scoring the move\nCompare the energy scores before and after the move. \n\n(Therefore, the pose should be cloned as a backup before the move.)\n\n\n\nAnd, compare the energy score after the _move_ and the lowest energy score in history. \n\nIf the score after this _move_ is the lowest, store the _pose _after this_ move _as the best pose, and renew the lowest energy score in history.\n\n### Desiding whether or not to accept the move\nFor the** **decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the **Metropolis criterion**. \n\n\n\nThe difference between the energy scores after (t+1) and before (t) a move is $ \\Delta E = E_{t+1} - E_{t} $.\n\nThe Metropolis criterion has a probability of accepting a move as $ P = \\exp( -\\Delta E / kT ) $.\n\nWhen $ ΔE ≥ 0 $, the Metropolis criterion probability of accepting the move is $ P = \\exp( -\\Delta E / kT ) $.\n\nWhen $ ΔE < 0 $, the Metropolis criterion probability of accepting the move is $ P = 1 $. \n\nUse $ kT = 1 \\text{\\ Rosetta \\ Energy \\ Unit \\ (REU)} $ . \n\n\n\n<font style=\"color:#DF2A3F;\">NOTICE</font>: Search \"Boltzmann function\" and \"Simulated annealing\" for more information about $ kT $.\n\nIf the move is accepted, the _pose_ after the _move_ will be used for the next round of trial _move._\n\nIf not, the _pose_ before the _move _will be used for the next round of trial _move_.\n\n### Iterations\nFor each iteration, the 3 steps above are excuted. \n\nThe final output of this program should be the **lowest energy conformation** that is achieved **at any point** during the simulation. \n\n<font style=\"color:#DF2A3F;\">NOTICE</font>: Search \"greedy algorithm\" and \"Monte Carlo\" for more information about the algorithm design. \n\n## Basic backbone movers\n### `SmallMover` & `ShearMover` classes\n| **Mover** | **Description** |\n| --- | --- |\n| `SmallMover` | Makes \"small-move-style\" torsion moves (no propagation minimization) |\n| `ShearMover` | Makes \"shear-style\" torsion moves that **minimize downstream propagation** |\n\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">For convenience, the </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">SmallMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> and </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">ShearMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> can do multiple rounds of perturbation. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">They also check that the new φ/ψ combinations are within an allowable region of the </font>**<font style=\"color:rgba(0, 0, 0, 0.87);\">Ramachandran plot</font>**<font style=\"color:rgba(0, 0, 0, 0.87);\"> by using a </font>**<font style=\"color:rgba(0, 0, 0, 0.87);\">Metropolis acceptance criterion</font>**<font style=\"color:rgba(0, 0, 0, 0.87);\"> based on the rama score component change. (The </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">rama</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> score is a statistical score from Simons et al. 1999, parametrized by bins of φ/ψ space.) </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Because they use the Metropolis criterion, we must also supply </font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">kT</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">.</font>\n\n```python\nkT = 1.0 # temperature\nn_moves = 1 # iterations\n\nmovemap = MoveMap()\nmovemap.set_bb(True)\n\nsmall_mover = SmallMover(movemap, kT, n_moves)\nshear_mover = ShearMover(movemap, kT, n_moves)\n```\n\n### `BackrubMover`\n| **<font style=\"color:rgb(51, 51, 51);\">Mover</font>** | **<font style=\"color:rgb(51, 51, 51);\">Description</font>** |\n| --- | --- |\n| <font style=\"color:#000000;\">BackrubMover</font> | <font style=\"color:rgb(51, 51, 51);\">Makes local rotations around two backbone atoms</font> |\n\n\n### <font style=\"color:rgb(51, 51, 51);\">Minimization Mover </font>`<font style=\"color:rgb(51, 51, 51);\">MinMover</font>`class\nThe `MinMover` carries out a **gradient-based** minimization to find the **nearest local minimum** in the energy function, such as that used in one step of the Monte-Carlo-plus-Minimization algorithm of Li & Scheraga. \n\n```python\nmin_mover = MinMover()\n```\n\n## `MonteCarlo`class\n### Introduction\n<font style=\"color:rgba(0, 0, 0, 0.87);\">The </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">MonteCarlo</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object is an encapsulated object that creates a whole MonteCarlo simulation.</font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">That is, it can decide whether to accept or reject a trial conformation, and it keeps track of the lowest-energy conformation and other statistics about the search. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Having the Monte Carlo operations packaged together is convenient, especially if we want multiple Monte Carlo loops to nest within each other or to operate on different parts of the protein.</font>\n\n```python\n# Assume that we have instantiated a mover `my_mover`\n\n# Instantiate a `MonteCarlo` object `mc`\nmc = MonteCarlo(my_pose, scorefxn, kT)\n# my_pose: a Pose object\n# scorefxn: a ScoreFunction object\n# kT: a parameter - temperature; int or float \n\n# apply the mover\nmy_mover.apply(my_pose) \n\n# deside whether or not to accept the move\nflag = mc.boltzmann(my_pose)\n# flag is boolean\n# True: accept\n# False: reject\n\n# In practice, these 3 steps should be written into a loop.\n```\n\n\n\nA Monte Carlo Simulation process is (in pseudo code):\n\n```python\ndef monte_carlo_sampling(initial_state, kT, N_iteration):\n current_state = initial state\n for i in range(N_iteration):\n new_state = random_move(current_state)\n #fe_delta: delta (difference of) free energies\n fe_delta = free_energy(new_state)-free_energy(current_state) \n if fe_delta < 0 or uniform(1) < exp(-fe_delta / kT): \n # exp(-fe_delta / kT): boltzmann distribution\n current_state = new_state\n```\n\n### `MonteCarlo` Methods\n```python\nmc.boltzmann(my_pose) # See above\nmc.show_scores()\nmc.show_counters()\nmc.show_state()\n```\n\n### `TrialMover`class\n<font style=\"color:rgba(0, 0, 0, 0.87);\">A </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">TrialMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> combines a specified </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">Mover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> with a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">MonteCarlo</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object.</font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Each time a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">TrialMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> is called, it performs a trial move and tests that move' s acceptance with the </font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">MonteCarlo</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">It is designed to test the effects of a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">Mover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">.</font>\n\n```python\ntrial_mover = TrialMover(small_mover, mc)\n\nfor i in range(10):\n trial_mover.apply(test)\n \nprint(trial_mover.num_accepts())\nprint(trial_mover.acceptance_rate())\n\n# After the trial, information about the trial can also be visited by\n# mc.show_state()\n# so that different movers can be compared\n```\n\n\n\n## `<font style=\"color:rgba(0, 0, 0, 0.87);\">SequenceMover</font>`class and `RepeatMover`class\n```python\nseq_mover = SequenceMover()\nseq_mover.add_mover(small_mover)\nseq_mover.add_mover(shear_mover)\nseq_mover.add_mover(min_mover)\n```\n\n```python\nn_repeats = 3\nrepeat_mover = RepeatMover(my_mover, n_repeats)\n```\n\n","source":"_posts/Note _ PyRosetta Basics (6)_ Movers for Backbone Folding.md","raw":"title: 'PyRosetta Basics (6): Movers for Backbone Folding'\ntags:\n - PyRosetta\n - biochemistry\n - protein design\n - note\n - protein\ncategories:\n - protein design\n---\n# PyRosetta Basics (6): Movers for Backbone Folding\n```python\n!pip install pyrosettacolabsetup\nimport pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()\nimport pyrosetta; pyrosetta.init()\nfrom pyrosetta import *\nfrom pyrosetta.teaching import *\ninit()\n```\n\n## Introduction\nOne of the most basic operations in protein structure and design algorithms is manipulation of the protein conformation. \n\nIn Rosetta, these manipulations are organized into `mover`s. \n\nA `Mover` object simply changes the conformation of a given pose. \n\nIt can be simple, like a single φ or ψ angle change, or complex, like an entire refinement protocol.\n\n[Movers (RosettaScripts)](https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/Movers-RosettaScripts)\n\n## `MoveMap`class\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Most </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">Movers</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> require a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">MoveMap</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object to specify which degrees of freedom are fixed and which are free to change. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Example1:</font>\n\n```python\nmy_movemap = MoveMap()\nmy_movemap.set_bb(True) # Allowing a mover to change the backbone structure\n```\n\nExample2:\n\n```python\nmovemap.set_bb(False) # Prohibit a mover to change the backbone structure\nmovemap.set_bb(50, True) # Allow a mover to chage the backbone structure of residue #50\nmovemap.set_bb(51, True) # Allow a mover to chage the backbone structure of residue #51\n# Only the backbone structure at residue #50 and #51 can be modified by a mover\n```\n\n## Basic Backbone Folding Process\n### <font style=\"color:rgba(0, 0, 0, 0.87);\">Making a trial move</font>\nApply a _move_ (change) to the _pose_ (structure).\n\n### Scoring the move\nCompare the energy scores before and after the move. \n\n(Therefore, the pose should be cloned as a backup before the move.)\n\n\n\nAnd, compare the energy score after the _move_ and the lowest energy score in history. \n\nIf the score after this _move_ is the lowest, store the _pose _after this_ move _as the best pose, and renew the lowest energy score in history.\n\n### Desiding whether or not to accept the move\nFor the** **decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the **Metropolis criterion**. \n\n\n\nThe difference between the energy scores after (t+1) and before (t) a move is $ \\Delta E = E_{t+1} - E_{t} $.\n\nThe Metropolis criterion has a probability of accepting a move as $ P = \\exp( -\\Delta E / kT ) $.\n\nWhen $ ΔE ≥ 0 $, the Metropolis criterion probability of accepting the move is $ P = \\exp( -\\Delta E / kT ) $.\n\nWhen $ ΔE < 0 $, the Metropolis criterion probability of accepting the move is $ P = 1 $. \n\nUse $ kT = 1 \\text{\\ Rosetta \\ Energy \\ Unit \\ (REU)} $ . \n\n\n\n<font style=\"color:#DF2A3F;\">NOTICE</font>: Search \"Boltzmann function\" and \"Simulated annealing\" for more information about $ kT $.\n\nIf the move is accepted, the _pose_ after the _move_ will be used for the next round of trial _move._\n\nIf not, the _pose_ before the _move _will be used for the next round of trial _move_.\n\n### Iterations\nFor each iteration, the 3 steps above are excuted. \n\nThe final output of this program should be the **lowest energy conformation** that is achieved **at any point** during the simulation. \n\n<font style=\"color:#DF2A3F;\">NOTICE</font>: Search \"greedy algorithm\" and \"Monte Carlo\" for more information about the algorithm design. \n\n## Basic backbone movers\n### `SmallMover` & `ShearMover` classes\n| **Mover** | **Description** |\n| --- | --- |\n| `SmallMover` | Makes \"small-move-style\" torsion moves (no propagation minimization) |\n| `ShearMover` | Makes \"shear-style\" torsion moves that **minimize downstream propagation** |\n\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">For convenience, the </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">SmallMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> and </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">ShearMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> can do multiple rounds of perturbation. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">They also check that the new φ/ψ combinations are within an allowable region of the </font>**<font style=\"color:rgba(0, 0, 0, 0.87);\">Ramachandran plot</font>**<font style=\"color:rgba(0, 0, 0, 0.87);\"> by using a </font>**<font style=\"color:rgba(0, 0, 0, 0.87);\">Metropolis acceptance criterion</font>**<font style=\"color:rgba(0, 0, 0, 0.87);\"> based on the rama score component change. (The </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">rama</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> score is a statistical score from Simons et al. 1999, parametrized by bins of φ/ψ space.) </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Because they use the Metropolis criterion, we must also supply </font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">kT</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">.</font>\n\n```python\nkT = 1.0 # temperature\nn_moves = 1 # iterations\n\nmovemap = MoveMap()\nmovemap.set_bb(True)\n\nsmall_mover = SmallMover(movemap, kT, n_moves)\nshear_mover = ShearMover(movemap, kT, n_moves)\n```\n\n### `BackrubMover`\n| **<font style=\"color:rgb(51, 51, 51);\">Mover</font>** | **<font style=\"color:rgb(51, 51, 51);\">Description</font>** |\n| --- | --- |\n| <font style=\"color:#000000;\">BackrubMover</font> | <font style=\"color:rgb(51, 51, 51);\">Makes local rotations around two backbone atoms</font> |\n\n\n### <font style=\"color:rgb(51, 51, 51);\">Minimization Mover </font>`<font style=\"color:rgb(51, 51, 51);\">MinMover</font>`class\nThe `MinMover` carries out a **gradient-based** minimization to find the **nearest local minimum** in the energy function, such as that used in one step of the Monte-Carlo-plus-Minimization algorithm of Li & Scheraga. \n\n```python\nmin_mover = MinMover()\n```\n\n## `MonteCarlo`class\n### Introduction\n<font style=\"color:rgba(0, 0, 0, 0.87);\">The </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">MonteCarlo</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object is an encapsulated object that creates a whole MonteCarlo simulation.</font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">That is, it can decide whether to accept or reject a trial conformation, and it keeps track of the lowest-energy conformation and other statistics about the search. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Having the Monte Carlo operations packaged together is convenient, especially if we want multiple Monte Carlo loops to nest within each other or to operate on different parts of the protein.</font>\n\n```python\n# Assume that we have instantiated a mover `my_mover`\n\n# Instantiate a `MonteCarlo` object `mc`\nmc = MonteCarlo(my_pose, scorefxn, kT)\n# my_pose: a Pose object\n# scorefxn: a ScoreFunction object\n# kT: a parameter - temperature; int or float \n\n# apply the mover\nmy_mover.apply(my_pose) \n\n# deside whether or not to accept the move\nflag = mc.boltzmann(my_pose)\n# flag is boolean\n# True: accept\n# False: reject\n\n# In practice, these 3 steps should be written into a loop.\n```\n\n\n\nA Monte Carlo Simulation process is (in pseudo code):\n\n```python\ndef monte_carlo_sampling(initial_state, kT, N_iteration):\n current_state = initial state\n for i in range(N_iteration):\n new_state = random_move(current_state)\n #fe_delta: delta (difference of) free energies\n fe_delta = free_energy(new_state)-free_energy(current_state) \n if fe_delta < 0 or uniform(1) < exp(-fe_delta / kT): \n # exp(-fe_delta / kT): boltzmann distribution\n current_state = new_state\n```\n\n### `MonteCarlo` Methods\n```python\nmc.boltzmann(my_pose) # See above\nmc.show_scores()\nmc.show_counters()\nmc.show_state()\n```\n\n### `TrialMover`class\n<font style=\"color:rgba(0, 0, 0, 0.87);\">A </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">TrialMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> combines a specified </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">Mover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> with a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">MonteCarlo</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object.</font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">Each time a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);\">TrialMover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> is called, it performs a trial move and tests that move' s acceptance with the </font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">MonteCarlo</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\"> object. </font>\n\n<font style=\"color:rgba(0, 0, 0, 0.87);\">It is designed to test the effects of a </font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">Mover</font>`<font style=\"color:rgba(0, 0, 0, 0.87);\">.</font>\n\n```python\ntrial_mover = TrialMover(small_mover, mc)\n\nfor i in range(10):\n trial_mover.apply(test)\n \nprint(trial_mover.num_accepts())\nprint(trial_mover.acceptance_rate())\n\n# After the trial, information about the trial can also be visited by\n# mc.show_state()\n# so that different movers can be compared\n```\n\n\n\n## `<font style=\"color:rgba(0, 0, 0, 0.87);\">SequenceMover</font>`class and `RepeatMover`class\n```python\nseq_mover = SequenceMover()\nseq_mover.add_mover(small_mover)\nseq_mover.add_mover(shear_mover)\nseq_mover.add_mover(min_mover)\n```\n\n```python\nn_repeats = 3\nrepeat_mover = RepeatMover(my_mover, n_repeats)\n```\n\n","slug":"Note _ PyRosetta Basics (6)_ Movers for Backbone Folding","published":1,"date":"2025-08-21T04:38:22.259Z","updated":"2025-08-21T04:45:54.022Z","comments":1,"layout":"post","photos":[],"_id":"cmekx8a7v004scgu63t0qakzd","content":"<h1 id=\"PyRosetta-Basics-6-Movers-for-Backbone-Folding\"><a href=\"#PyRosetta-Basics-6-Movers-for-Backbone-Folding\" class=\"headerlink\" title=\"PyRosetta Basics (6): Movers for Backbone Folding\"></a>PyRosetta Basics (6): Movers for Backbone Folding</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">!pip install pyrosettacolabsetup</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta; pyrosetta.init()</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.teaching <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init()</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h2><p>One of the most basic operations in protein structure and design algorithms is manipulation of the protein conformation. </p>\n<p>In Rosetta, these manipulations are organized into <code>mover</code>s. </p>\n<p>A <code>Mover</code> object simply changes the conformation of a given pose. </p>\n<p>It can be simple, like a single φ or ψ angle change, or complex, like an entire refinement protocol.</p>\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/Movers-RosettaScripts\">Movers (RosettaScripts)</a></p>\n<h2 id=\"MoveMapclass\"><a href=\"#MoveMapclass\" class=\"headerlink\" title=\"MoveMapclass\"></a><code>MoveMap</code>class</h2><p><font style=\"color:rgba(0, 0, 0, 0.87);\">Most </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">Movers</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> require a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">MoveMap</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object to specify which degrees of freedom are fixed and which are free to change. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Example1:</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_movemap = MoveMap()</span><br><span class=\"line\">my_movemap.set_bb(<span class=\"literal\">True</span>) <span class=\"comment\"># Allowing a mover to change the backbone structure</span></span><br></pre></td></tr></table></figure>\n\n<p>Example2:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">movemap.set_bb(<span class=\"literal\">False</span>) <span class=\"comment\"># Prohibit a mover to change the backbone structure</span></span><br><span class=\"line\">movemap.set_bb(<span class=\"number\">50</span>, <span class=\"literal\">True</span>) <span class=\"comment\"># Allow a mover to chage the backbone structure of residue #50</span></span><br><span class=\"line\">movemap.set_bb(<span class=\"number\">51</span>, <span class=\"literal\">True</span>) <span class=\"comment\"># Allow a mover to chage the backbone structure of residue #51</span></span><br><span class=\"line\"><span class=\"comment\"># Only the backbone structure at residue #50 and #51 can be modified by a mover</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Basic-Backbone-Folding-Process\"><a href=\"#Basic-Backbone-Folding-Process\" class=\"headerlink\" title=\"Basic Backbone Folding Process\"></a>Basic Backbone Folding Process</h2><h3 id=\"Making-a-trial-move\"><a href=\"#Making-a-trial-move\" class=\"headerlink\" title=\"Making a trial move\"></a><font style=\"color:rgba(0, 0, 0, 0.87);\">Making a trial move</font></h3><p>Apply a <em>move</em> (change) to the <em>pose</em> (structure).</p>\n<h3 id=\"Scoring-the-move\"><a href=\"#Scoring-the-move\" class=\"headerlink\" title=\"Scoring the move\"></a>Scoring the move</h3><p>Compare the energy scores before and after the move. </p>\n<p>(Therefore, the pose should be cloned as a backup before the move.)</p>\n<p>And, compare the energy score after the <em>move</em> and the lowest energy score in history. </p>\n<p>If the score after this <em>move</em> is the lowest, store the _pose <em>after this</em> move _as the best pose, and renew the lowest energy score in history.</p>\n<h3 id=\"Desiding-whether-or-not-to-accept-the-move\"><a href=\"#Desiding-whether-or-not-to-accept-the-move\" class=\"headerlink\" title=\"Desiding whether or not to accept the move\"></a>Desiding whether or not to accept the move</h3><p>For the** **decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the <strong>Metropolis criterion</strong>. </p>\n<p>The difference between the energy scores after (t+1) and before (t) a move is $ \\Delta E = E_{t+1} - E_{t} $.</p>\n<p>The Metropolis criterion has a probability of accepting a move as $ P = \\exp( -\\Delta E / kT ) $.</p>\n<p>When $ ΔE ≥ 0 $, the Metropolis criterion probability of accepting the move is $ P = \\exp( -\\Delta E / kT ) $.</p>\n<p>When $ ΔE < 0 $, the Metropolis criterion probability of accepting the move is $ P = 1 $. </p>\n<p>Use $ kT = 1 \\text{\\ Rosetta \\ Energy \\ Unit \\ (REU)} $ . </p>\n<p><font style=\"color:#DF2A3F;\">NOTICE</font>: Search “Boltzmann function” and “Simulated annealing” for more information about $ kT $.</p>\n<p>If the move is accepted, the <em>pose</em> after the <em>move</em> will be used for the next round of trial <em>move.</em></p>\n<p>If not, the <em>pose</em> before the _move _will be used for the next round of trial <em>move</em>.</p>\n<h3 id=\"Iterations\"><a href=\"#Iterations\" class=\"headerlink\" title=\"Iterations\"></a>Iterations</h3><p>For each iteration, the 3 steps above are excuted. </p>\n<p>The final output of this program should be the <strong>lowest energy conformation</strong> that is achieved <strong>at any point</strong> during the simulation. </p>\n<p><font style=\"color:#DF2A3F;\">NOTICE</font>: Search “greedy algorithm” and “Monte Carlo” for more information about the algorithm design. </p>\n<h2 id=\"Basic-backbone-movers\"><a href=\"#Basic-backbone-movers\" class=\"headerlink\" title=\"Basic backbone movers\"></a>Basic backbone movers</h2><h3 id=\"SmallMover-ShearMover-classes\"><a href=\"#SmallMover-ShearMover-classes\" class=\"headerlink\" title=\"SmallMover & ShearMover classes\"></a><code>SmallMover</code> & <code>ShearMover</code> classes</h3><table>\n<thead>\n<tr>\n<th><strong>Mover</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>SmallMover</code></td>\n<td>Makes “small-move-style” torsion moves (no propagation minimization)</td>\n</tr>\n<tr>\n<td><code>ShearMover</code></td>\n<td>Makes “shear-style” torsion moves that <strong>minimize downstream propagation</strong></td>\n</tr>\n</tbody></table>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">For convenience, the </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">SmallMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> and </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">ShearMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> can do multiple rounds of perturbation. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">They also check that the new φ/ψ combinations are within an allowable region of the </font><strong><font style=\"color:rgba(0, 0, 0, 0.87);\">Ramachandran plot</font></strong><font style=\"color:rgba(0, 0, 0, 0.87);\"> by using a </font><strong><font style=\"color:rgba(0, 0, 0, 0.87);\">Metropolis acceptance criterion</font></strong><font style=\"color:rgba(0, 0, 0, 0.87);\"> based on the rama score component change. (The </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">rama</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> score is a statistical score from Simons et al. 1999, parametrized by bins of φ/ψ space.) </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Because they use the Metropolis criterion, we must also supply </font><code><font style="color:rgba(0, 0, 0, 0.87);">kT</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\">.</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">kT = <span class=\"number\">1.0</span> <span class=\"comment\"># temperature</span></span><br><span class=\"line\">n_moves = <span class=\"number\">1</span> <span class=\"comment\"># iterations</span></span><br><span class=\"line\"></span><br><span class=\"line\">movemap = MoveMap()</span><br><span class=\"line\">movemap.set_bb(<span class=\"literal\">True</span>)</span><br><span class=\"line\"></span><br><span class=\"line\">small_mover = SmallMover(movemap, kT, n_moves)</span><br><span class=\"line\">shear_mover = ShearMover(movemap, kT, n_moves)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"BackrubMover\"><a href=\"#BackrubMover\" class=\"headerlink\" title=\"BackrubMover\"></a><code>BackrubMover</code></h3><table>\n<thead>\n<tr>\n<th><strong><font style=\"color:rgb(51, 51, 51);\">Mover</font></strong></th>\n<th><strong><font style=\"color:rgb(51, 51, 51);\">Description</font></strong></th>\n</tr>\n</thead>\n<tbody><tr>\n<td><font style=\"color:#000000;\">BackrubMover</font></td>\n<td><font style=\"color:rgb(51, 51, 51);\">Makes local rotations around two backbone atoms</font></td>\n</tr>\n</tbody></table>\n<h3 id=\"Minimization-Mover-MinMoverclass\"><a href=\"#Minimization-Mover-MinMoverclass\" class=\"headerlink\" title=\"Minimization Mover <font style="color:rgb(51, 51, 51);">MinMover</font>class\"></a><font style=\"color:rgb(51, 51, 51);\">Minimization Mover </font><code><font style="color:rgb(51, 51, 51);">MinMover</font></code>class</h3><p>The <code>MinMover</code> carries out a <strong>gradient-based</strong> minimization to find the <strong>nearest local minimum</strong> in the energy function, such as that used in one step of the Monte-Carlo-plus-Minimization algorithm of Li & Scheraga. </p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">min_mover = MinMover()</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"MonteCarloclass\"><a href=\"#MonteCarloclass\" class=\"headerlink\" title=\"MonteCarloclass\"></a><code>MonteCarlo</code>class</h2><h3 id=\"Introduction-1\"><a href=\"#Introduction-1\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h3><p><font style=\"color:rgba(0, 0, 0, 0.87);\">The </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">MonteCarlo</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object is an encapsulated object that creates a whole MonteCarlo simulation.</font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">That is, it can decide whether to accept or reject a trial conformation, and it keeps track of the lowest-energy conformation and other statistics about the search. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Having the Monte Carlo operations packaged together is convenient, especially if we want multiple Monte Carlo loops to nest within each other or to operate on different parts of the protein.</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have instantiated a mover `my_mover`</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Instantiate a `MonteCarlo` object `mc`</span></span><br><span class=\"line\">mc = MonteCarlo(my_pose, scorefxn, kT)</span><br><span class=\"line\"><span class=\"comment\"># my_pose: a Pose object</span></span><br><span class=\"line\"><span class=\"comment\"># scorefxn: a ScoreFunction object</span></span><br><span class=\"line\"><span class=\"comment\"># kT: a parameter - temperature; int or float </span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># apply the mover</span></span><br><span class=\"line\">my_mover.apply(my_pose) </span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># deside whether or not to accept the move</span></span><br><span class=\"line\">flag = mc.boltzmann(my_pose)</span><br><span class=\"line\"><span class=\"comment\"># flag is boolean</span></span><br><span class=\"line\"><span class=\"comment\"># True: accept</span></span><br><span class=\"line\"><span class=\"comment\"># False: reject</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># In practice, these 3 steps should be written into a loop.</span></span><br></pre></td></tr></table></figure>\n\n\n\n<p>A Monte Carlo Simulation process is (in pseudo code):</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">def</span> <span class=\"title function_\">monte_carlo_sampling</span>(<span class=\"params\">initial_state, kT, N_iteration</span>):</span><br><span class=\"line\"> current_state = initial state</span><br><span class=\"line\"> <span class=\"keyword\">for</span> i <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(N_iteration):</span><br><span class=\"line\"> new_state = random_move(current_state)</span><br><span class=\"line\"> <span class=\"comment\">#fe_delta: delta (difference of) free energies</span></span><br><span class=\"line\"> fe_delta = free_energy(new_state)-free_energy(current_state) </span><br><span class=\"line\"> <span class=\"keyword\">if</span> fe_delta < <span class=\"number\">0</span> <span class=\"keyword\">or</span> uniform(<span class=\"number\">1</span>) < exp(-fe_delta / kT): </span><br><span class=\"line\"> <span class=\"comment\"># exp(-fe_delta / kT): boltzmann distribution</span></span><br><span class=\"line\"> current_state = new_state</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"MonteCarlo-Methods\"><a href=\"#MonteCarlo-Methods\" class=\"headerlink\" title=\"MonteCarlo Methods\"></a><code>MonteCarlo</code> Methods</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">mc.boltzmann(my_pose) <span class=\"comment\"># See above</span></span><br><span class=\"line\">mc.show_scores()</span><br><span class=\"line\">mc.show_counters()</span><br><span class=\"line\">mc.show_state()</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"TrialMoverclass\"><a href=\"#TrialMoverclass\" class=\"headerlink\" title=\"TrialMoverclass\"></a><code>TrialMover</code>class</h3><p><font style=\"color:rgba(0, 0, 0, 0.87);\">A </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">TrialMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> combines a specified </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">Mover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> with a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">MonteCarlo</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object.</font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Each time a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">TrialMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> is called, it performs a trial move and tests that move’ s acceptance with the </font><code><font style="color:rgba(0, 0, 0, 0.87);">MonteCarlo</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">It is designed to test the effects of a </font><code><font style="color:rgba(0, 0, 0, 0.87);">Mover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\">.</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">trial_mover = TrialMover(small_mover, mc)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">for</span> i <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(<span class=\"number\">10</span>):</span><br><span class=\"line\"> trial_mover.apply(test)</span><br><span class=\"line\"> </span><br><span class=\"line\"><span class=\"built_in\">print</span>(trial_mover.num_accepts())</span><br><span class=\"line\"><span class=\"built_in\">print</span>(trial_mover.acceptance_rate())</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># After the trial, information about the trial can also be visited by</span></span><br><span class=\"line\"><span class=\"comment\"># mc.show_state()</span></span><br><span class=\"line\"><span class=\"comment\"># so that different movers can be compared</span></span><br></pre></td></tr></table></figure>\n\n\n\n<h2 id=\"SequenceMoverclass-and-RepeatMoverclass\"><a href=\"#SequenceMoverclass-and-RepeatMoverclass\" class=\"headerlink\" title=\"<font style="color:rgba(0, 0, 0, 0.87);">SequenceMover</font>class and RepeatMoverclass\"></a><code><font style="color:rgba(0, 0, 0, 0.87);">SequenceMover</font></code>class and <code>RepeatMover</code>class</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">seq_mover = SequenceMover()</span><br><span class=\"line\">seq_mover.add_mover(small_mover)</span><br><span class=\"line\">seq_mover.add_mover(shear_mover)</span><br><span class=\"line\">seq_mover.add_mover(min_mover)</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">n_repeats = <span class=\"number\">3</span></span><br><span class=\"line\">repeat_mover = RepeatMover(my_mover, n_repeats)</span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyRosetta-Basics-6-Movers-for-Backbone-Folding\"><a href=\"#PyRosetta-Basics-6-Movers-for-Backbone-Folding\" class=\"headerlink\" title=\"PyRosetta Basics (6): Movers for Backbone Folding\"></a>PyRosetta Basics (6): Movers for Backbone Folding</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">!pip install pyrosettacolabsetup</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosettacolabsetup; pyrosettacolabsetup.install_pyrosetta()</span><br><span class=\"line\"><span class=\"keyword\">import</span> pyrosetta; pyrosetta.init()</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.teaching <span class=\"keyword\">import</span> *</span><br><span class=\"line\">init()</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h2><p>One of the most basic operations in protein structure and design algorithms is manipulation of the protein conformation. </p>\n<p>In Rosetta, these manipulations are organized into <code>mover</code>s. </p>\n<p>A <code>Mover</code> object simply changes the conformation of a given pose. </p>\n<p>It can be simple, like a single φ or ψ angle change, or complex, like an entire refinement protocol.</p>\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/Movers-RosettaScripts\">Movers (RosettaScripts)</a></p>\n<h2 id=\"MoveMapclass\"><a href=\"#MoveMapclass\" class=\"headerlink\" title=\"MoveMapclass\"></a><code>MoveMap</code>class</h2><p><font style=\"color:rgba(0, 0, 0, 0.87);\">Most </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">Movers</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> require a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">MoveMap</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object to specify which degrees of freedom are fixed and which are free to change. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Example1:</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_movemap = MoveMap()</span><br><span class=\"line\">my_movemap.set_bb(<span class=\"literal\">True</span>) <span class=\"comment\"># Allowing a mover to change the backbone structure</span></span><br></pre></td></tr></table></figure>\n\n<p>Example2:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">movemap.set_bb(<span class=\"literal\">False</span>) <span class=\"comment\"># Prohibit a mover to change the backbone structure</span></span><br><span class=\"line\">movemap.set_bb(<span class=\"number\">50</span>, <span class=\"literal\">True</span>) <span class=\"comment\"># Allow a mover to chage the backbone structure of residue #50</span></span><br><span class=\"line\">movemap.set_bb(<span class=\"number\">51</span>, <span class=\"literal\">True</span>) <span class=\"comment\"># Allow a mover to chage the backbone structure of residue #51</span></span><br><span class=\"line\"><span class=\"comment\"># Only the backbone structure at residue #50 and #51 can be modified by a mover</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Basic-Backbone-Folding-Process\"><a href=\"#Basic-Backbone-Folding-Process\" class=\"headerlink\" title=\"Basic Backbone Folding Process\"></a>Basic Backbone Folding Process</h2><h3 id=\"Making-a-trial-move\"><a href=\"#Making-a-trial-move\" class=\"headerlink\" title=\"Making a trial move\"></a><font style=\"color:rgba(0, 0, 0, 0.87);\">Making a trial move</font></h3><p>Apply a <em>move</em> (change) to the <em>pose</em> (structure).</p>\n<h3 id=\"Scoring-the-move\"><a href=\"#Scoring-the-move\" class=\"headerlink\" title=\"Scoring the move\"></a>Scoring the move</h3><p>Compare the energy scores before and after the move. </p>\n<p>(Therefore, the pose should be cloned as a backup before the move.)</p>\n<p>And, compare the energy score after the <em>move</em> and the lowest energy score in history. </p>\n<p>If the score after this <em>move</em> is the lowest, store the _pose <em>after this</em> move _as the best pose, and renew the lowest energy score in history.</p>\n<h3 id=\"Desiding-whether-or-not-to-accept-the-move\"><a href=\"#Desiding-whether-or-not-to-accept-the-move\" class=\"headerlink\" title=\"Desiding whether or not to accept the move\"></a>Desiding whether or not to accept the move</h3><p>For the** **decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the <strong>Metropolis criterion</strong>. </p>\n<p>The difference between the energy scores after (t+1) and before (t) a move is $ \\Delta E = E_{t+1} - E_{t} $.</p>\n<p>The Metropolis criterion has a probability of accepting a move as $ P = \\exp( -\\Delta E / kT ) $.</p>\n<p>When $ ΔE ≥ 0 $, the Metropolis criterion probability of accepting the move is $ P = \\exp( -\\Delta E / kT ) $.</p>\n<p>When $ ΔE < 0 $, the Metropolis criterion probability of accepting the move is $ P = 1 $. </p>\n<p>Use $ kT = 1 \\text{\\ Rosetta \\ Energy \\ Unit \\ (REU)} $ . </p>\n<p><font style=\"color:#DF2A3F;\">NOTICE</font>: Search “Boltzmann function” and “Simulated annealing” for more information about $ kT $.</p>\n<p>If the move is accepted, the <em>pose</em> after the <em>move</em> will be used for the next round of trial <em>move.</em></p>\n<p>If not, the <em>pose</em> before the _move _will be used for the next round of trial <em>move</em>.</p>\n<h3 id=\"Iterations\"><a href=\"#Iterations\" class=\"headerlink\" title=\"Iterations\"></a>Iterations</h3><p>For each iteration, the 3 steps above are excuted. </p>\n<p>The final output of this program should be the <strong>lowest energy conformation</strong> that is achieved <strong>at any point</strong> during the simulation. </p>\n<p><font style=\"color:#DF2A3F;\">NOTICE</font>: Search “greedy algorithm” and “Monte Carlo” for more information about the algorithm design. </p>\n<h2 id=\"Basic-backbone-movers\"><a href=\"#Basic-backbone-movers\" class=\"headerlink\" title=\"Basic backbone movers\"></a>Basic backbone movers</h2><h3 id=\"SmallMover-ShearMover-classes\"><a href=\"#SmallMover-ShearMover-classes\" class=\"headerlink\" title=\"SmallMover & ShearMover classes\"></a><code>SmallMover</code> & <code>ShearMover</code> classes</h3><table>\n<thead>\n<tr>\n<th><strong>Mover</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>SmallMover</code></td>\n<td>Makes “small-move-style” torsion moves (no propagation minimization)</td>\n</tr>\n<tr>\n<td><code>ShearMover</code></td>\n<td>Makes “shear-style” torsion moves that <strong>minimize downstream propagation</strong></td>\n</tr>\n</tbody></table>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">For convenience, the </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">SmallMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> and </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">ShearMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> can do multiple rounds of perturbation. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">They also check that the new φ/ψ combinations are within an allowable region of the </font><strong><font style=\"color:rgba(0, 0, 0, 0.87);\">Ramachandran plot</font></strong><font style=\"color:rgba(0, 0, 0, 0.87);\"> by using a </font><strong><font style=\"color:rgba(0, 0, 0, 0.87);\">Metropolis acceptance criterion</font></strong><font style=\"color:rgba(0, 0, 0, 0.87);\"> based on the rama score component change. (The </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">rama</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> score is a statistical score from Simons et al. 1999, parametrized by bins of φ/ψ space.) </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Because they use the Metropolis criterion, we must also supply </font><code><font style="color:rgba(0, 0, 0, 0.87);">kT</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\">.</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">kT = <span class=\"number\">1.0</span> <span class=\"comment\"># temperature</span></span><br><span class=\"line\">n_moves = <span class=\"number\">1</span> <span class=\"comment\"># iterations</span></span><br><span class=\"line\"></span><br><span class=\"line\">movemap = MoveMap()</span><br><span class=\"line\">movemap.set_bb(<span class=\"literal\">True</span>)</span><br><span class=\"line\"></span><br><span class=\"line\">small_mover = SmallMover(movemap, kT, n_moves)</span><br><span class=\"line\">shear_mover = ShearMover(movemap, kT, n_moves)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"BackrubMover\"><a href=\"#BackrubMover\" class=\"headerlink\" title=\"BackrubMover\"></a><code>BackrubMover</code></h3><table>\n<thead>\n<tr>\n<th><strong><font style=\"color:rgb(51, 51, 51);\">Mover</font></strong></th>\n<th><strong><font style=\"color:rgb(51, 51, 51);\">Description</font></strong></th>\n</tr>\n</thead>\n<tbody><tr>\n<td><font style=\"color:#000000;\">BackrubMover</font></td>\n<td><font style=\"color:rgb(51, 51, 51);\">Makes local rotations around two backbone atoms</font></td>\n</tr>\n</tbody></table>\n<h3 id=\"Minimization-Mover-MinMoverclass\"><a href=\"#Minimization-Mover-MinMoverclass\" class=\"headerlink\" title=\"Minimization Mover <font style="color:rgb(51, 51, 51);">MinMover</font>class\"></a><font style=\"color:rgb(51, 51, 51);\">Minimization Mover </font><code><font style="color:rgb(51, 51, 51);">MinMover</font></code>class</h3><p>The <code>MinMover</code> carries out a <strong>gradient-based</strong> minimization to find the <strong>nearest local minimum</strong> in the energy function, such as that used in one step of the Monte-Carlo-plus-Minimization algorithm of Li & Scheraga. </p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">min_mover = MinMover()</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"MonteCarloclass\"><a href=\"#MonteCarloclass\" class=\"headerlink\" title=\"MonteCarloclass\"></a><code>MonteCarlo</code>class</h2><h3 id=\"Introduction-1\"><a href=\"#Introduction-1\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h3><p><font style=\"color:rgba(0, 0, 0, 0.87);\">The </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">MonteCarlo</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object is an encapsulated object that creates a whole MonteCarlo simulation.</font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">That is, it can decide whether to accept or reject a trial conformation, and it keeps track of the lowest-energy conformation and other statistics about the search. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Having the Monte Carlo operations packaged together is convenient, especially if we want multiple Monte Carlo loops to nest within each other or to operate on different parts of the protein.</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have instantiated a mover `my_mover`</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Instantiate a `MonteCarlo` object `mc`</span></span><br><span class=\"line\">mc = MonteCarlo(my_pose, scorefxn, kT)</span><br><span class=\"line\"><span class=\"comment\"># my_pose: a Pose object</span></span><br><span class=\"line\"><span class=\"comment\"># scorefxn: a ScoreFunction object</span></span><br><span class=\"line\"><span class=\"comment\"># kT: a parameter - temperature; int or float </span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># apply the mover</span></span><br><span class=\"line\">my_mover.apply(my_pose) </span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># deside whether or not to accept the move</span></span><br><span class=\"line\">flag = mc.boltzmann(my_pose)</span><br><span class=\"line\"><span class=\"comment\"># flag is boolean</span></span><br><span class=\"line\"><span class=\"comment\"># True: accept</span></span><br><span class=\"line\"><span class=\"comment\"># False: reject</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># In practice, these 3 steps should be written into a loop.</span></span><br></pre></td></tr></table></figure>\n\n\n\n<p>A Monte Carlo Simulation process is (in pseudo code):</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"keyword\">def</span> <span class=\"title function_\">monte_carlo_sampling</span>(<span class=\"params\">initial_state, kT, N_iteration</span>):</span><br><span class=\"line\"> current_state = initial state</span><br><span class=\"line\"> <span class=\"keyword\">for</span> i <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(N_iteration):</span><br><span class=\"line\"> new_state = random_move(current_state)</span><br><span class=\"line\"> <span class=\"comment\">#fe_delta: delta (difference of) free energies</span></span><br><span class=\"line\"> fe_delta = free_energy(new_state)-free_energy(current_state) </span><br><span class=\"line\"> <span class=\"keyword\">if</span> fe_delta < <span class=\"number\">0</span> <span class=\"keyword\">or</span> uniform(<span class=\"number\">1</span>) < exp(-fe_delta / kT): </span><br><span class=\"line\"> <span class=\"comment\"># exp(-fe_delta / kT): boltzmann distribution</span></span><br><span class=\"line\"> current_state = new_state</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"MonteCarlo-Methods\"><a href=\"#MonteCarlo-Methods\" class=\"headerlink\" title=\"MonteCarlo Methods\"></a><code>MonteCarlo</code> Methods</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">mc.boltzmann(my_pose) <span class=\"comment\"># See above</span></span><br><span class=\"line\">mc.show_scores()</span><br><span class=\"line\">mc.show_counters()</span><br><span class=\"line\">mc.show_state()</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"TrialMoverclass\"><a href=\"#TrialMoverclass\" class=\"headerlink\" title=\"TrialMoverclass\"></a><code>TrialMover</code>class</h3><p><font style=\"color:rgba(0, 0, 0, 0.87);\">A </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">TrialMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> combines a specified </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">Mover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> with a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">MonteCarlo</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object.</font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">Each time a </font><code><font style="color:rgba(0, 0, 0, 0.87);background-color:rgb(238, 238, 238);">TrialMover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> is called, it performs a trial move and tests that move’ s acceptance with the </font><code><font style="color:rgba(0, 0, 0, 0.87);">MonteCarlo</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\"> object. </font></p>\n<p><font style=\"color:rgba(0, 0, 0, 0.87);\">It is designed to test the effects of a </font><code><font style="color:rgba(0, 0, 0, 0.87);">Mover</font></code><font style=\"color:rgba(0, 0, 0, 0.87);\">.</font></p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">trial_mover = TrialMover(small_mover, mc)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"keyword\">for</span> i <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(<span class=\"number\">10</span>):</span><br><span class=\"line\"> trial_mover.apply(test)</span><br><span class=\"line\"> </span><br><span class=\"line\"><span class=\"built_in\">print</span>(trial_mover.num_accepts())</span><br><span class=\"line\"><span class=\"built_in\">print</span>(trial_mover.acceptance_rate())</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># After the trial, information about the trial can also be visited by</span></span><br><span class=\"line\"><span class=\"comment\"># mc.show_state()</span></span><br><span class=\"line\"><span class=\"comment\"># so that different movers can be compared</span></span><br></pre></td></tr></table></figure>\n\n\n\n<h2 id=\"SequenceMoverclass-and-RepeatMoverclass\"><a href=\"#SequenceMoverclass-and-RepeatMoverclass\" class=\"headerlink\" title=\"<font style="color:rgba(0, 0, 0, 0.87);">SequenceMover</font>class and RepeatMoverclass\"></a><code><font style="color:rgba(0, 0, 0, 0.87);">SequenceMover</font></code>class and <code>RepeatMover</code>class</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">seq_mover = SequenceMover()</span><br><span class=\"line\">seq_mover.add_mover(small_mover)</span><br><span class=\"line\">seq_mover.add_mover(shear_mover)</span><br><span class=\"line\">seq_mover.add_mover(min_mover)</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">n_repeats = <span class=\"number\">3</span></span><br><span class=\"line\">repeat_mover = RepeatMover(my_mover, n_repeats)</span><br></pre></td></tr></table></figure>\n\n"},{"title":"Pyrosetta Resources","date":"2025-08-21T04:47:22.000Z","updated":"2025-08-21T04:47:24.000Z","_content":"# Pyrosetta Resources\n## Energy terms\n[https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types](https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types)\n\n[https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms](https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms)\n\n## Movers\n[https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover](https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover)\n\n## FAQ (Important)\n[https://docs.rosettacommons.org/docs/latest/getting_started/FAQ](https://docs.rosettacommons.org/docs/latest/getting_started/FAQ)\n\n## `init`commands(Important)\n[https://docs.rosettacommons.org/docs/latest/full-options-list](https://docs.rosettacommons.org/docs/latest/full-options-list)\n\n\n\n## Operations\n[https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html](https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html)\n\n","source":"_posts/Note _ Pyrosetta Resources.md","raw":"title: Pyrosetta Resources\ndate: '2025-08-21 12:47:22'\nupdated: '2025-08-21 12:47:24'\ntags:\n - PyRosetta\n - biochemistry\n - protein\n - protein design\ncategories:\n - protein design\n---\n# Pyrosetta Resources\n## Energy terms\n[https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types](https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types)\n\n[https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms](https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms)\n\n## Movers\n[https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover](https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover)\n\n## FAQ (Important)\n[https://docs.rosettacommons.org/docs/latest/getting_started/FAQ](https://docs.rosettacommons.org/docs/latest/getting_started/FAQ)\n\n## `init`commands(Important)\n[https://docs.rosettacommons.org/docs/latest/full-options-list](https://docs.rosettacommons.org/docs/latest/full-options-list)\n\n\n\n## Operations\n[https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html](https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html)\n\n","slug":"Note _ Pyrosetta Resources","published":1,"comments":1,"layout":"post","photos":[],"_id":"cmekx8a7v004vcgu6favheh8g","content":"<h1 id=\"Pyrosetta-Resources\"><a href=\"#Pyrosetta-Resources\" class=\"headerlink\" title=\"Pyrosetta Resources\"></a>Pyrosetta Resources</h1><h2 id=\"Energy-terms\"><a href=\"#Energy-terms\" class=\"headerlink\" title=\"Energy terms\"></a>Energy terms</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types\">https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types</a></p>\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms\">https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms</a></p>\n<h2 id=\"Movers\"><a href=\"#Movers\" class=\"headerlink\" title=\"Movers\"></a>Movers</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover\">https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover</a></p>\n<h2 id=\"FAQ-Important\"><a href=\"#FAQ-Important\" class=\"headerlink\" title=\"FAQ (Important)\"></a>FAQ (Important)</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/getting_started/FAQ\">https://docs.rosettacommons.org/docs/latest/getting_started/FAQ</a></p>\n<h2 id=\"initcommands-Important\"><a href=\"#initcommands-Important\" class=\"headerlink\" title=\"initcommands(Important)\"></a><code>init</code>commands(Important)</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/full-options-list\">https://docs.rosettacommons.org/docs/latest/full-options-list</a></p>\n<h2 id=\"Operations\"><a href=\"#Operations\" class=\"headerlink\" title=\"Operations\"></a>Operations</h2><p><a href=\"https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html\">https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html</a></p>\n","excerpt":"","more":"<h1 id=\"Pyrosetta-Resources\"><a href=\"#Pyrosetta-Resources\" class=\"headerlink\" title=\"Pyrosetta Resources\"></a>Pyrosetta Resources</h1><h2 id=\"Energy-terms\"><a href=\"#Energy-terms\" class=\"headerlink\" title=\"Energy terms\"></a>Energy terms</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types\">https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/score-types</a></p>\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms\">https://docs.rosettacommons.org/docs/latest/rosetta_basics/scoring/centroid-score-terms</a></p>\n<h2 id=\"Movers\"><a href=\"#Movers\" class=\"headerlink\" title=\"Movers\"></a>Movers</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover\">https://docs.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/PyMolMover</a></p>\n<h2 id=\"FAQ-Important\"><a href=\"#FAQ-Important\" class=\"headerlink\" title=\"FAQ (Important)\"></a>FAQ (Important)</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/getting_started/FAQ\">https://docs.rosettacommons.org/docs/latest/getting_started/FAQ</a></p>\n<h2 id=\"initcommands-Important\"><a href=\"#initcommands-Important\" class=\"headerlink\" title=\"initcommands(Important)\"></a><code>init</code>commands(Important)</h2><p><a href=\"https://docs.rosettacommons.org/docs/latest/full-options-list\">https://docs.rosettacommons.org/docs/latest/full-options-list</a></p>\n<h2 id=\"Operations\"><a href=\"#Operations\" class=\"headerlink\" title=\"Operations\"></a>Operations</h2><p><a href=\"https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html\">https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html</a></p>\n"},{"title":"PyRosetta Basics (7): Movers for Side Chain Packing and Design","_content":"# PyRosetta Basics (7): Movers for Side Chain Packing and Design\n```python\n#Python\nfrom pyrosetta import *\nfrom pyrosetta.rosetta import *\nfrom pyrosetta.teaching import *\n\n#Core Includes\nfrom pyrosetta.rosetta.core.kinematics import MoveMap\nfrom pyrosetta.rosetta.core.kinematics import FoldTree\nfrom pyrosetta.rosetta.core.pack.task import TaskFactory\nfrom pyrosetta.rosetta.core.pack.task import operation\nfrom pyrosetta.rosetta.core.simple_metrics import metrics\nfrom pyrosetta.rosetta.core.select import residue_selector as selections\nfrom pyrosetta.rosetta.core import select\nfrom pyrosetta.rosetta.core.select.movemap import *\n\n#Protocol Includes\nfrom pyrosetta.rosetta.protocols import minimization_packing as pack_min\nfrom pyrosetta.rosetta.protocols import relax as rel\nfrom pyrosetta.rosetta.protocols.antibody.residue_selector import CDRResidueSelector\nfrom pyrosetta.rosetta.protocols.antibody import *\nfrom pyrosetta.rosetta.protocols.loops import *\nfrom pyrosetta.rosetta.protocols.relax import FastRelax\n```\n\n[https://docs.rosettacommons.org/docs/latest/full-options-list](https://docs.rosettacommons.org/docs/latest/full-options-list)\n\n## Basic Concepts\n### Terms of pose operations\n1. \"Folding\": Folding of the backbone, optimizing values of $ \\phi $and $ \\psi $and $ \\omega $.\n2. \"Packing\": Packing of the side chains of residues, optimizing values of $ \\chi $etc.\n3. \"Designing\": Designing of the protein sequence, optimizing the total energy by changing the identities of amino acids. \n(e.g. substitute an Arg with a Gly).\n\nMonte Carlo simulation is the most basic and classic folding algorithm. \n\nThe basic process of the Monte Carlo simulation is shared by all folding, packing and design process.\n\n<details class=\"lake-collapse\"><summary id=\"u85986045\"><span class=\"ne-text\">Basic Folding Process using Monte Carlo simulation</span></summary><p id=\"u1cf4ba01\" class=\"ne-p\"><a href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" data-href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" class=\"ne-link\"><span class=\"ne-text\">Note | PyRosetta Basics (6): Mover</span></a></p><h3 id=\"e64YK\"><span class=\"ne-text\" style=\"color: rgba(0, 0, 0, 0.87)\">Making a trial move</span></h3><p id=\"u5e5dbfd4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Apply a </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (change) to the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (structure).</span></p><h3 id=\"irwtJ\"><span class=\"ne-text\">Scoring the move</span></h3><p id=\"u44f841d4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Compare the energy scores before and after the move. </span></p><p id=\"u9e89c1ac\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">(Therefore, the pose should be cloned as a backup before the move.)</span></p><p id=\"u24599695\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\"></span></p><p id=\"u8cc42be0\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">And, compare the energy score after the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> and the lowest energy score in history. </span></p><p id=\"u020e8d13\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">If the score after this </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> is the lowest, store the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose </span></em><span class=\"ne-text\" style=\"font-size: 14px\">after this</span><em><span class=\"ne-text\" style=\"font-size: 14px\"> move </span></em><span class=\"ne-text\" style=\"font-size: 14px\">as the best pose, and renew the lowest energy score in history.</span></p><h3 id=\"TAn8b\"><span class=\"ne-text\">Desiding whether or not to accept the move: </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong></h3><p id=\"ucb6377ba\" class=\"ne-p\"><span class=\"ne-text\">For the</span><strong><span class=\"ne-text\"> </span></strong><span class=\"ne-text\">decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong><span class=\"ne-text\">. </span></p><p id=\"u555ca55a\" class=\"ne-p\"><span class=\"ne-text\">The difference between the energy scores after (t+1) and before (t) a move is </span><span id=\"YTTPK\" class=\"ne-math\" style=\"font-size: 14px\"><img src=\"https://cdn.nlark.com/yuque/__latex/140cea98d95645c2586ed9f29e31675b.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u4257265d\" class=\"ne-p\"><span class=\"ne-text\">The Metropolis criterion has a probability of accepting a move as </span><span id=\"GuL5z\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"ub1003231\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"xfX93\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/fb3b0300200beee945a7c33ee9da1833.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"BH3hC\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u03854502\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"jAP7B\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/16d5d059d93f960fa208a43278bc6094.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"U1a3A\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/54928c26406c51ef50311d6f0d99f3a6.svg\"></span><span class=\"ne-text\">. </span></p><p id=\"ucd6574c7\" class=\"ne-p\"><span class=\"ne-text\">Use </span><span id=\"lfd2T\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/825509854c41e934535f33223f7981f1.svg\"></span><span class=\"ne-text\"> . </span></p><p id=\"u05b7dc94\" class=\"ne-p\"><span class=\"ne-text\"></span></p><p id=\"uf6ba059c\" class=\"ne-p\"><span class=\"ne-text\">If the move is accepted, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> after the </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\"> will be used for the next round of trial </span><em><span class=\"ne-text\">move.</span></em></p><p id=\"ud6027a74\" class=\"ne-p\"><span class=\"ne-text\">If not, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> before the </span><em><span class=\"ne-text\">move </span></em><span class=\"ne-text\">will be used for the next round of trial </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\">.</span></p><h3 id=\"SJZe5\"><span class=\"ne-text\">Iterations</span></h3><p id=\"u892da1c2\" class=\"ne-p\"><span class=\"ne-text\">For each iteration, the 3 steps above are excuted. </span></p><p id=\"u6a79e2e1\" class=\"ne-p\"><span class=\"ne-text\">The final output of this program should be the </span><strong><span class=\"ne-text\">lowest energy conformation</span></strong><span class=\"ne-text\"> that is achieved </span><strong><span class=\"ne-text\">at any point</span></strong><span class=\"ne-text\"> during the simulation. </span></p><p id=\"u53388aed\" class=\"ne-p\"><span class=\"ne-text\" style=\"color: #DF2A3F\">NOTICE</span><span class=\"ne-text\">: Search "greedy algorithm" and "Monte Carlo" for more information about the algorithm design. </span></p></details>\n### Simulated annealing\nSimulated anealing refer to the ramping of temperature `kT`in Python looping.\n\n1. Set a high initial temperature, so that more barriers can be easily overcome.\n2. By gradually decreasing the temperarture after each Python loop, the barriers becomes harder to overcome, and the search range gradually narrows down to a local minimum.\n3. In this process, after a period of \"heated\" (active) searching across the energy landscape, the energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).\n\n### Simulated relaxing\nSimulated relaxing refer to the ramping of energy score `E`(and the differences between scores `delta_E`) in Python looping.\n\n1. Set a small initial weight of an energy term, so that the free energy (and the barriers) are underestimated, and thus the energy barriers are easier to be overcome.\n2. By gradually increasing the weight after each Python loop, the energy estimation becomes more realistic, and the search range gradually narrows down to a local minimum.\n3. In this process, after a period of the \"relaxed\" (loose) evaluation, energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).\n\n## Introduction to Packing\n\"Packing\" is the process of optimizing the conformation of side chains (values of $ \\chi_{n} $and other angles).\n\nThe \"_packer_\" is a subset of _movers _that apply packing operations to a pose_. _\n\nWe use \"task operations\" to configure the behaviors of _packers_:\n\n+ The \"task operations\" are provided to a `TaskFactory`object.\n+ The `TaskFactory` is then passed to a _packer_.\n\n## `init()`:Initialize From Rosetta Commandline\nWe can change some defalt Rosetta (C++) commandline settings through\n\n```python\npyrosetta.rosetta.init()\n```\n\nE.g.\n\n```python\n# we can change some defalt settings through\n# pyrosetta.rosetta.init()\n# or, write as:\n# pyrosetta.init()\n# For example\ninit('-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\\n -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 5 -no_fconfig')\n\n'''\nIn this initialization, we\n1. input the scheme for antibody nomenclature;\n2. use the PDB ligand definitions to load all standard residue descriptions;\n3. keep the relax mode as `FastRelax` (which is default);\n4. and set the `FastRelax` repeat times to 5 (by default it is already 5, can be customized);\n5. and do not load the [common] config file if present.\n'''\n```\n\n## `TaskFacrtory`class: prototype of `PackerTask`\n### Introduction\nInstances of`PackerTask`class are used to determine the specific tasks in packing.\n\n`TaskFactory`is the prototype of `PackerTask` class.\n\nEvery time the protein is packed for a single round, the `TaskFactory` will generate what is called the `PackerTask`.\n\n\n\nWe do NOT use `PackerTask` directly.\n\nWe can set `TaskOperations`to the `TaskFactory`, and all `PackerTask`generated by this`TaskFactory` will be controlled by these `TaskOpterations`.\n\nSo bascically a `TaskFactory`object can be seen as \"a list of task operations\".\n\nSome `TaskOperations`can respond to changes in the pose, so we do not set `TaskOperations` directly to `PackerTask`in each packing step.\n\nInstead, we use `TaskFactory`to dynamically generate `PackerTask`objects in each round, behind the scene. \n\n### Instantiation & Configuration(`push_back`)\n```python\nmy_tf = TaskFactory() # Create an empty task factory\n\n# And set task operations to the task factory:\nmy_tf.push_back(operation.InitializeFromCommandline()) \n# IMPORTANT! Use configurations declared in `init()`\nmy_tf.push_back(operation.RestrictToRepacking()) \n# Disable \"designing of side chains\" so that the sequence will be untouched\n```\n\n### Regional Packing: `selections` & `PreventRepackingRLT`\nWe can also use `selections`for regional packing\n\nE.g. Selecting CDR H1 region of an antibody\n\n```python\n# Selecting CDR H1 region of an antibody\ncdr_selector = CDRResidueSelector() # Instantiation\ncdr_selector.set_cdr(h1) # Select the H1 loop only\n# the namespace of `h1` was imported by commandlines that were passed to init() \n\n# Selecting the Neiborhood (in 3D space) residue of CDR H1\nnbr_selector = selections.NeighborhoodResidueSelector() # Instantiation\nnbr_selector.set_focus_selector(cdr_selector) # Find neighbors of cdr_selector (which is the H1 loop)\nnbr_selector.set_include_focus_in_subset(True) # Include the H1 loop in `nbr_selector` as well\n\n#\"RLT\": Residue Level Task Operation\nprevent_repacking_rlt = operation.PreventRepackingRLT() # Instantication\n\nprevent_subset_repacking = operation.OperateOnResidueSubset(prevent_repacking_rlt, nbr_selector, True)\n#`True` indicates here that we are flipping the selection. \n# So that we are turning off everything but the CDR and its neighbors.\n\n# Assume that we have a `TaskFactory` named `my_tf`\nmy_tf.push_back(prevent_subset_repacking)\n```\n\n### `TaskFacrtory` Methods\n#### Add operations: `TaskFacrtory.push_back`\n```python\nmy_tf.push_back(my_operation) \n# E.g.\nmy_tf.push_back(operation.InitializeFromCommandline()) \n```\n\n#### Clear all operations: `TaskFacrtory.clear`\n```python\nmy_tf.clear()\n```\n\n### Resources\n[https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html](https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html)\n\n\n\n## `PackRotamersMover`class\nA _packer_ is a _mover_ that carries out packing under the instruction of `PackerTask`.\n\n### Instantiation & Configurations\n```python\n# Assume that we have a `TaskFactory` object called `my_tf`\nmy_packer = pack_min.PackRotamersMover() # Create a `PackRotamersMover` object\nmy_packer.task_factory(my_tf) # Pass the `TaskFactory` object to the packer\n\n#Note that we are not passing a scorefunction here. We will use the default, cmd-line scorefunction, \n# which can be accessed through `rosetta.core.scoring.get_score_function()`\n# We use a scorefunction later. \n```\n\n### Apply the packer to a pose\n```python\n#Run the packer. (Note this may take a few minutes)\nmy_packer.apply(pose)\n```\n\n","source":"_posts/Note _ PyRosetta Basics (7)_ Movers for Side Chain Packing and Design.md","raw":"title: 'PyRosetta Basics (7): Movers for Side Chain Packing and Design'\ntags:\n - PyRosetta\n - biochemistry\n - protein\n - note\n - protein design\ncategories:\n - protein design\n---\n# PyRosetta Basics (7): Movers for Side Chain Packing and Design\n```python\n#Python\nfrom pyrosetta import *\nfrom pyrosetta.rosetta import *\nfrom pyrosetta.teaching import *\n\n#Core Includes\nfrom pyrosetta.rosetta.core.kinematics import MoveMap\nfrom pyrosetta.rosetta.core.kinematics import FoldTree\nfrom pyrosetta.rosetta.core.pack.task import TaskFactory\nfrom pyrosetta.rosetta.core.pack.task import operation\nfrom pyrosetta.rosetta.core.simple_metrics import metrics\nfrom pyrosetta.rosetta.core.select import residue_selector as selections\nfrom pyrosetta.rosetta.core import select\nfrom pyrosetta.rosetta.core.select.movemap import *\n\n#Protocol Includes\nfrom pyrosetta.rosetta.protocols import minimization_packing as pack_min\nfrom pyrosetta.rosetta.protocols import relax as rel\nfrom pyrosetta.rosetta.protocols.antibody.residue_selector import CDRResidueSelector\nfrom pyrosetta.rosetta.protocols.antibody import *\nfrom pyrosetta.rosetta.protocols.loops import *\nfrom pyrosetta.rosetta.protocols.relax import FastRelax\n```\n\n[https://docs.rosettacommons.org/docs/latest/full-options-list](https://docs.rosettacommons.org/docs/latest/full-options-list)\n\n## Basic Concepts\n### Terms of pose operations\n1. \"Folding\": Folding of the backbone, optimizing values of $ \\phi $and $ \\psi $and $ \\omega $.\n2. \"Packing\": Packing of the side chains of residues, optimizing values of $ \\chi $etc.\n3. \"Designing\": Designing of the protein sequence, optimizing the total energy by changing the identities of amino acids. \n(e.g. substitute an Arg with a Gly).\n\nMonte Carlo simulation is the most basic and classic folding algorithm. \n\nThe basic process of the Monte Carlo simulation is shared by all folding, packing and design process.\n\n<details class=\"lake-collapse\"><summary id=\"u85986045\"><span class=\"ne-text\">Basic Folding Process using Monte Carlo simulation</span></summary><p id=\"u1cf4ba01\" class=\"ne-p\"><a href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" data-href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" class=\"ne-link\"><span class=\"ne-text\">Note | PyRosetta Basics (6): Mover</span></a></p><h3 id=\"e64YK\"><span class=\"ne-text\" style=\"color: rgba(0, 0, 0, 0.87)\">Making a trial move</span></h3><p id=\"u5e5dbfd4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Apply a </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (change) to the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (structure).</span></p><h3 id=\"irwtJ\"><span class=\"ne-text\">Scoring the move</span></h3><p id=\"u44f841d4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Compare the energy scores before and after the move. </span></p><p id=\"u9e89c1ac\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">(Therefore, the pose should be cloned as a backup before the move.)</span></p><p id=\"u24599695\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\"></span></p><p id=\"u8cc42be0\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">And, compare the energy score after the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> and the lowest energy score in history. </span></p><p id=\"u020e8d13\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">If the score after this </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> is the lowest, store the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose </span></em><span class=\"ne-text\" style=\"font-size: 14px\">after this</span><em><span class=\"ne-text\" style=\"font-size: 14px\"> move </span></em><span class=\"ne-text\" style=\"font-size: 14px\">as the best pose, and renew the lowest energy score in history.</span></p><h3 id=\"TAn8b\"><span class=\"ne-text\">Desiding whether or not to accept the move: </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong></h3><p id=\"ucb6377ba\" class=\"ne-p\"><span class=\"ne-text\">For the</span><strong><span class=\"ne-text\"> </span></strong><span class=\"ne-text\">decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong><span class=\"ne-text\">. </span></p><p id=\"u555ca55a\" class=\"ne-p\"><span class=\"ne-text\">The difference between the energy scores after (t+1) and before (t) a move is </span><span id=\"YTTPK\" class=\"ne-math\" style=\"font-size: 14px\"><img src=\"https://cdn.nlark.com/yuque/__latex/140cea98d95645c2586ed9f29e31675b.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u4257265d\" class=\"ne-p\"><span class=\"ne-text\">The Metropolis criterion has a probability of accepting a move as </span><span id=\"GuL5z\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"ub1003231\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"xfX93\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/fb3b0300200beee945a7c33ee9da1833.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"BH3hC\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u03854502\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"jAP7B\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/16d5d059d93f960fa208a43278bc6094.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"U1a3A\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/54928c26406c51ef50311d6f0d99f3a6.svg\"></span><span class=\"ne-text\">. </span></p><p id=\"ucd6574c7\" class=\"ne-p\"><span class=\"ne-text\">Use </span><span id=\"lfd2T\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/825509854c41e934535f33223f7981f1.svg\"></span><span class=\"ne-text\"> . </span></p><p id=\"u05b7dc94\" class=\"ne-p\"><span class=\"ne-text\"></span></p><p id=\"uf6ba059c\" class=\"ne-p\"><span class=\"ne-text\">If the move is accepted, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> after the </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\"> will be used for the next round of trial </span><em><span class=\"ne-text\">move.</span></em></p><p id=\"ud6027a74\" class=\"ne-p\"><span class=\"ne-text\">If not, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> before the </span><em><span class=\"ne-text\">move </span></em><span class=\"ne-text\">will be used for the next round of trial </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\">.</span></p><h3 id=\"SJZe5\"><span class=\"ne-text\">Iterations</span></h3><p id=\"u892da1c2\" class=\"ne-p\"><span class=\"ne-text\">For each iteration, the 3 steps above are excuted. </span></p><p id=\"u6a79e2e1\" class=\"ne-p\"><span class=\"ne-text\">The final output of this program should be the </span><strong><span class=\"ne-text\">lowest energy conformation</span></strong><span class=\"ne-text\"> that is achieved </span><strong><span class=\"ne-text\">at any point</span></strong><span class=\"ne-text\"> during the simulation. </span></p><p id=\"u53388aed\" class=\"ne-p\"><span class=\"ne-text\" style=\"color: #DF2A3F\">NOTICE</span><span class=\"ne-text\">: Search "greedy algorithm" and "Monte Carlo" for more information about the algorithm design. </span></p></details>\n### Simulated annealing\nSimulated anealing refer to the ramping of temperature `kT`in Python looping.\n\n1. Set a high initial temperature, so that more barriers can be easily overcome.\n2. By gradually decreasing the temperarture after each Python loop, the barriers becomes harder to overcome, and the search range gradually narrows down to a local minimum.\n3. In this process, after a period of \"heated\" (active) searching across the energy landscape, the energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).\n\n### Simulated relaxing\nSimulated relaxing refer to the ramping of energy score `E`(and the differences between scores `delta_E`) in Python looping.\n\n1. Set a small initial weight of an energy term, so that the free energy (and the barriers) are underestimated, and thus the energy barriers are easier to be overcome.\n2. By gradually increasing the weight after each Python loop, the energy estimation becomes more realistic, and the search range gradually narrows down to a local minimum.\n3. In this process, after a period of the \"relaxed\" (loose) evaluation, energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).\n\n## Introduction to Packing\n\"Packing\" is the process of optimizing the conformation of side chains (values of $ \\chi_{n} $and other angles).\n\nThe \"_packer_\" is a subset of _movers _that apply packing operations to a pose_. _\n\nWe use \"task operations\" to configure the behaviors of _packers_:\n\n+ The \"task operations\" are provided to a `TaskFactory`object.\n+ The `TaskFactory` is then passed to a _packer_.\n\n## `init()`:Initialize From Rosetta Commandline\nWe can change some defalt Rosetta (C++) commandline settings through\n\n```python\npyrosetta.rosetta.init()\n```\n\nE.g.\n\n```python\n# we can change some defalt settings through\n# pyrosetta.rosetta.init()\n# or, write as:\n# pyrosetta.init()\n# For example\ninit('-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\\n -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 5 -no_fconfig')\n\n'''\nIn this initialization, we\n1. input the scheme for antibody nomenclature;\n2. use the PDB ligand definitions to load all standard residue descriptions;\n3. keep the relax mode as `FastRelax` (which is default);\n4. and set the `FastRelax` repeat times to 5 (by default it is already 5, can be customized);\n5. and do not load the [common] config file if present.\n'''\n```\n\n## `TaskFacrtory`class: prototype of `PackerTask`\n### Introduction\nInstances of`PackerTask`class are used to determine the specific tasks in packing.\n\n`TaskFactory`is the prototype of `PackerTask` class.\n\nEvery time the protein is packed for a single round, the `TaskFactory` will generate what is called the `PackerTask`.\n\n\n\nWe do NOT use `PackerTask` directly.\n\nWe can set `TaskOperations`to the `TaskFactory`, and all `PackerTask`generated by this`TaskFactory` will be controlled by these `TaskOpterations`.\n\nSo bascically a `TaskFactory`object can be seen as \"a list of task operations\".\n\nSome `TaskOperations`can respond to changes in the pose, so we do not set `TaskOperations` directly to `PackerTask`in each packing step.\n\nInstead, we use `TaskFactory`to dynamically generate `PackerTask`objects in each round, behind the scene. \n\n### Instantiation & Configuration(`push_back`)\n```python\nmy_tf = TaskFactory() # Create an empty task factory\n\n# And set task operations to the task factory:\nmy_tf.push_back(operation.InitializeFromCommandline()) \n# IMPORTANT! Use configurations declared in `init()`\nmy_tf.push_back(operation.RestrictToRepacking()) \n# Disable \"designing of side chains\" so that the sequence will be untouched\n```\n\n### Regional Packing: `selections` & `PreventRepackingRLT`\nWe can also use `selections`for regional packing\n\nE.g. Selecting CDR H1 region of an antibody\n\n```python\n# Selecting CDR H1 region of an antibody\ncdr_selector = CDRResidueSelector() # Instantiation\ncdr_selector.set_cdr(h1) # Select the H1 loop only\n# the namespace of `h1` was imported by commandlines that were passed to init() \n\n# Selecting the Neiborhood (in 3D space) residue of CDR H1\nnbr_selector = selections.NeighborhoodResidueSelector() # Instantiation\nnbr_selector.set_focus_selector(cdr_selector) # Find neighbors of cdr_selector (which is the H1 loop)\nnbr_selector.set_include_focus_in_subset(True) # Include the H1 loop in `nbr_selector` as well\n\n#\"RLT\": Residue Level Task Operation\nprevent_repacking_rlt = operation.PreventRepackingRLT() # Instantication\n\nprevent_subset_repacking = operation.OperateOnResidueSubset(prevent_repacking_rlt, nbr_selector, True)\n#`True` indicates here that we are flipping the selection. \n# So that we are turning off everything but the CDR and its neighbors.\n\n# Assume that we have a `TaskFactory` named `my_tf`\nmy_tf.push_back(prevent_subset_repacking)\n```\n\n### `TaskFacrtory` Methods\n#### Add operations: `TaskFacrtory.push_back`\n```python\nmy_tf.push_back(my_operation) \n# E.g.\nmy_tf.push_back(operation.InitializeFromCommandline()) \n```\n\n#### Clear all operations: `TaskFacrtory.clear`\n```python\nmy_tf.clear()\n```\n\n### Resources\n[https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html](https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html)\n\n\n\n## `PackRotamersMover`class\nA _packer_ is a _mover_ that carries out packing under the instruction of `PackerTask`.\n\n### Instantiation & Configurations\n```python\n# Assume that we have a `TaskFactory` object called `my_tf`\nmy_packer = pack_min.PackRotamersMover() # Create a `PackRotamersMover` object\nmy_packer.task_factory(my_tf) # Pass the `TaskFactory` object to the packer\n\n#Note that we are not passing a scorefunction here. We will use the default, cmd-line scorefunction, \n# which can be accessed through `rosetta.core.scoring.get_score_function()`\n# We use a scorefunction later. \n```\n\n### Apply the packer to a pose\n```python\n#Run the packer. (Note this may take a few minutes)\nmy_packer.apply(pose)\n```\n\n","slug":"Note _ PyRosetta Basics (7)_ Movers for Side Chain Packing and Design","published":1,"date":"2025-08-21T04:38:22.261Z","updated":"2025-08-21T04:46:52.945Z","comments":1,"layout":"post","photos":[],"_id":"cmekx8a7w004ycgu6hl09em1m","content":"<h1 id=\"PyRosetta-Basics-7-Movers-for-Side-Chain-Packing-and-Design\"><a href=\"#PyRosetta-Basics-7-Movers-for-Side-Chain-Packing-and-Design\" class=\"headerlink\" title=\"PyRosetta Basics (7): Movers for Side Chain Packing and Design\"></a>PyRosetta Basics (7): Movers for Side Chain Packing and Design</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\">#Python</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.teaching <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Core Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> MoveMap</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> FoldTree</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> TaskFactory</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> operation</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.simple_metrics <span class=\"keyword\">import</span> metrics</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select <span class=\"keyword\">import</span> residue_selector <span class=\"keyword\">as</span> selections</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core <span class=\"keyword\">import</span> select</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select.movemap <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Protocol Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> minimization_packing <span class=\"keyword\">as</span> pack_min</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> relax <span class=\"keyword\">as</span> rel</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody.residue_selector <span class=\"keyword\">import</span> CDRResidueSelector</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.loops <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.relax <span class=\"keyword\">import</span> FastRelax</span><br></pre></td></tr></table></figure>\n\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/full-options-list\">https://docs.rosettacommons.org/docs/latest/full-options-list</a></p>\n<h2 id=\"Basic-Concepts\"><a href=\"#Basic-Concepts\" class=\"headerlink\" title=\"Basic Concepts\"></a>Basic Concepts</h2><h3 id=\"Terms-of-pose-operations\"><a href=\"#Terms-of-pose-operations\" class=\"headerlink\" title=\"Terms of pose operations\"></a>Terms of pose operations</h3><ol>\n<li>“Folding”: Folding of the backbone, optimizing values of $ \\phi $and $ \\psi $and $ \\omega $.</li>\n<li>“Packing”: Packing of the side chains of residues, optimizing values of $ \\chi $etc.</li>\n<li>“Designing”: Designing of the protein sequence, optimizing the total energy by changing the identities of amino acids.<br>(e.g. substitute an Arg with a Gly).</li>\n</ol>\n<p>Monte Carlo simulation is the most basic and classic folding algorithm. </p>\n<p>The basic process of the Monte Carlo simulation is shared by all folding, packing and design process.</p>\n<details class=\"lake-collapse\"><summary id=\"u85986045\"><span class=\"ne-text\">Basic Folding Process using Monte Carlo simulation</span></summary><p id=\"u1cf4ba01\" class=\"ne-p\"><a href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" data-href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" class=\"ne-link\"><span class=\"ne-text\">Note | PyRosetta Basics (6): Mover</span></a></p><h3 id=\"e64YK\"><span class=\"ne-text\" style=\"color: rgba(0, 0, 0, 0.87)\">Making a trial move</span></h3><p id=\"u5e5dbfd4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Apply a </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (change) to the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (structure).</span></p><h3 id=\"irwtJ\"><span class=\"ne-text\">Scoring the move</span></h3><p id=\"u44f841d4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Compare the energy scores before and after the move. </span></p><p id=\"u9e89c1ac\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">(Therefore, the pose should be cloned as a backup before the move.)</span></p><p id=\"u24599695\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\"></span></p><p id=\"u8cc42be0\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">And, compare the energy score after the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> and the lowest energy score in history. </span></p><p id=\"u020e8d13\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">If the score after this </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> is the lowest, store the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose </span></em><span class=\"ne-text\" style=\"font-size: 14px\">after this</span><em><span class=\"ne-text\" style=\"font-size: 14px\"> move </span></em><span class=\"ne-text\" style=\"font-size: 14px\">as the best pose, and renew the lowest energy score in history.</span></p><h3 id=\"TAn8b\"><span class=\"ne-text\">Desiding whether or not to accept the move: </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong></h3><p id=\"ucb6377ba\" class=\"ne-p\"><span class=\"ne-text\">For the</span><strong><span class=\"ne-text\"> </span></strong><span class=\"ne-text\">decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong><span class=\"ne-text\">. </span></p><p id=\"u555ca55a\" class=\"ne-p\"><span class=\"ne-text\">The difference between the energy scores after (t+1) and before (t) a move is </span><span id=\"YTTPK\" class=\"ne-math\" style=\"font-size: 14px\"><img src=\"https://cdn.nlark.com/yuque/__latex/140cea98d95645c2586ed9f29e31675b.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u4257265d\" class=\"ne-p\"><span class=\"ne-text\">The Metropolis criterion has a probability of accepting a move as </span><span id=\"GuL5z\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"ub1003231\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"xfX93\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/fb3b0300200beee945a7c33ee9da1833.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"BH3hC\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u03854502\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"jAP7B\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/16d5d059d93f960fa208a43278bc6094.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"U1a3A\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/54928c26406c51ef50311d6f0d99f3a6.svg\"></span><span class=\"ne-text\">. </span></p><p id=\"ucd6574c7\" class=\"ne-p\"><span class=\"ne-text\">Use </span><span id=\"lfd2T\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/825509854c41e934535f33223f7981f1.svg\"></span><span class=\"ne-text\"> . </span></p><p id=\"u05b7dc94\" class=\"ne-p\"><span class=\"ne-text\"></span></p><p id=\"uf6ba059c\" class=\"ne-p\"><span class=\"ne-text\">If the move is accepted, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> after the </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\"> will be used for the next round of trial </span><em><span class=\"ne-text\">move.</span></em></p><p id=\"ud6027a74\" class=\"ne-p\"><span class=\"ne-text\">If not, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> before the </span><em><span class=\"ne-text\">move </span></em><span class=\"ne-text\">will be used for the next round of trial </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\">.</span></p><h3 id=\"SJZe5\"><span class=\"ne-text\">Iterations</span></h3><p id=\"u892da1c2\" class=\"ne-p\"><span class=\"ne-text\">For each iteration, the 3 steps above are excuted. </span></p><p id=\"u6a79e2e1\" class=\"ne-p\"><span class=\"ne-text\">The final output of this program should be the </span><strong><span class=\"ne-text\">lowest energy conformation</span></strong><span class=\"ne-text\"> that is achieved </span><strong><span class=\"ne-text\">at any point</span></strong><span class=\"ne-text\"> during the simulation. </span></p><p id=\"u53388aed\" class=\"ne-p\"><span class=\"ne-text\" style=\"color: #DF2A3F\">NOTICE</span><span class=\"ne-text\">: Search "greedy algorithm" and "Monte Carlo" for more information about the algorithm design. </span></p></details>\n### Simulated annealing\nSimulated anealing refer to the ramping of temperature `kT`in Python looping.\n\n<ol>\n<li>Set a high initial temperature, so that more barriers can be easily overcome.</li>\n<li>By gradually decreasing the temperarture after each Python loop, the barriers becomes harder to overcome, and the search range gradually narrows down to a local minimum.</li>\n<li>In this process, after a period of “heated” (active) searching across the energy landscape, the energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).</li>\n</ol>\n<h3 id=\"Simulated-relaxing\"><a href=\"#Simulated-relaxing\" class=\"headerlink\" title=\"Simulated relaxing\"></a>Simulated relaxing</h3><p>Simulated relaxing refer to the ramping of energy score <code>E</code>(and the differences between scores <code>delta_E</code>) in Python looping.</p>\n<ol>\n<li>Set a small initial weight of an energy term, so that the free energy (and the barriers) are underestimated, and thus the energy barriers are easier to be overcome.</li>\n<li>By gradually increasing the weight after each Python loop, the energy estimation becomes more realistic, and the search range gradually narrows down to a local minimum.</li>\n<li>In this process, after a period of the “relaxed” (loose) evaluation, energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).</li>\n</ol>\n<h2 id=\"Introduction-to-Packing\"><a href=\"#Introduction-to-Packing\" class=\"headerlink\" title=\"Introduction to Packing\"></a>Introduction to Packing</h2><p>“Packing” is the process of optimizing the conformation of side chains (values of $ \\chi_{n} $and other angles).</p>\n<p>The “<em>packer</em>“ is a subset of _movers <em>that apply packing operations to a pose</em>. _</p>\n<p>We use “task operations” to configure the behaviors of <em>packers</em>:</p>\n<ul>\n<li>The “task operations” are provided to a <code>TaskFactory</code>object.</li>\n<li>The <code>TaskFactory</code> is then passed to a <em>packer</em>.</li>\n</ul>\n<h2 id=\"init-:Initialize-From-Rosetta-Commandline\"><a href=\"#init-:Initialize-From-Rosetta-Commandline\" class=\"headerlink\" title=\"init():Initialize From Rosetta Commandline\"></a><code>init()</code>:Initialize From Rosetta Commandline</h2><p>We can change some defalt Rosetta (C++) commandline settings through</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pyrosetta.rosetta.init()</span><br></pre></td></tr></table></figure>\n\n<p>E.g.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># we can change some defalt settings through</span></span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.rosetta.init()</span></span><br><span class=\"line\"><span class=\"comment\"># or, write as:</span></span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.init()</span></span><br><span class=\"line\"><span class=\"comment\"># For example</span></span><br><span class=\"line\">init(<span class=\"string\">'-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\</span></span><br><span class=\"line\"><span class=\"string\"> -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 5 -no_fconfig'</span>)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br><span class=\"line\"><span class=\"string\">In this initialization, we</span></span><br><span class=\"line\"><span class=\"string\">1. input the scheme for antibody nomenclature;</span></span><br><span class=\"line\"><span class=\"string\">2. use the PDB ligand definitions to load all standard residue descriptions;</span></span><br><span class=\"line\"><span class=\"string\">3. keep the relax mode as `FastRelax` (which is default);</span></span><br><span class=\"line\"><span class=\"string\">4. and set the `FastRelax` repeat times to 5 (by default it is already 5, can be customized);</span></span><br><span class=\"line\"><span class=\"string\">5. and do not load the [common] config file if present.</span></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"TaskFacrtoryclass-prototype-of-PackerTask\"><a href=\"#TaskFacrtoryclass-prototype-of-PackerTask\" class=\"headerlink\" title=\"TaskFacrtoryclass: prototype of PackerTask\"></a><code>TaskFacrtory</code>class: prototype of <code>PackerTask</code></h2><h3 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h3><p>Instances of<code>PackerTask</code>class are used to determine the specific tasks in packing.</p>\n<p><code>TaskFactory</code>is the prototype of <code>PackerTask</code> class.</p>\n<p>Every time the protein is packed for a single round, the <code>TaskFactory</code> will generate what is called the <code>PackerTask</code>.</p>\n<p>We do NOT use <code>PackerTask</code> directly.</p>\n<p>We can set <code>TaskOperations</code>to the <code>TaskFactory</code>, and all <code>PackerTask</code>generated by this<code>TaskFactory</code> will be controlled by these <code>TaskOpterations</code>.</p>\n<p>So bascically a <code>TaskFactory</code>object can be seen as “a list of task operations”.</p>\n<p>Some <code>TaskOperations</code>can respond to changes in the pose, so we do not set <code>TaskOperations</code> directly to <code>PackerTask</code>in each packing step.</p>\n<p>Instead, we use <code>TaskFactory</code>to dynamically generate <code>PackerTask</code>objects in each round, behind the scene. </p>\n<h3 id=\"Instantiation-Configuration-push-back\"><a href=\"#Instantiation-Configuration-push-back\" class=\"headerlink\" title=\"Instantiation & Configuration(push_back)\"></a>Instantiation & Configuration(<code>push_back</code>)</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_tf = TaskFactory() <span class=\"comment\"># Create an empty task factory</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># And set task operations to the task factory:</span></span><br><span class=\"line\">my_tf.push_back(operation.InitializeFromCommandline()) </span><br><span class=\"line\"><span class=\"comment\"># IMPORTANT! Use configurations declared in `init()`</span></span><br><span class=\"line\">my_tf.push_back(operation.RestrictToRepacking()) </span><br><span class=\"line\"><span class=\"comment\"># Disable "designing of side chains" so that the sequence will be untouched</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Regional-Packing-selections-PreventRepackingRLT\"><a href=\"#Regional-Packing-selections-PreventRepackingRLT\" class=\"headerlink\" title=\"Regional Packing: selections & PreventRepackingRLT\"></a>Regional Packing: <code>selections</code> & <code>PreventRepackingRLT</code></h3><p>We can also use <code>selections</code>for regional packing</p>\n<p>E.g. Selecting CDR H1 region of an antibody</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Selecting CDR H1 region of an antibody</span></span><br><span class=\"line\">cdr_selector = CDRResidueSelector() <span class=\"comment\"># Instantiation</span></span><br><span class=\"line\">cdr_selector.set_cdr(h1) <span class=\"comment\"># Select the H1 loop only</span></span><br><span class=\"line\"><span class=\"comment\"># the namespace of `h1` was imported by commandlines that were passed to init() </span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Selecting the Neiborhood (in 3D space) residue of CDR H1</span></span><br><span class=\"line\">nbr_selector = selections.NeighborhoodResidueSelector() <span class=\"comment\"># Instantiation</span></span><br><span class=\"line\">nbr_selector.set_focus_selector(cdr_selector) <span class=\"comment\"># Find neighbors of cdr_selector (which is the H1 loop)</span></span><br><span class=\"line\">nbr_selector.set_include_focus_in_subset(<span class=\"literal\">True</span>) <span class=\"comment\"># Include the H1 loop in `nbr_selector` as well</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#"RLT": Residue Level Task Operation</span></span><br><span class=\"line\">prevent_repacking_rlt = operation.PreventRepackingRLT() <span class=\"comment\"># Instantication</span></span><br><span class=\"line\"></span><br><span class=\"line\">prevent_subset_repacking = operation.OperateOnResidueSubset(prevent_repacking_rlt, nbr_selector, <span class=\"literal\">True</span>)</span><br><span class=\"line\"><span class=\"comment\">#`True` indicates here that we are flipping the selection. </span></span><br><span class=\"line\"><span class=\"comment\"># So that we are turning off everything but the CDR and its neighbors.</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `TaskFactory` named `my_tf`</span></span><br><span class=\"line\">my_tf.push_back(prevent_subset_repacking)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"TaskFacrtory-Methods\"><a href=\"#TaskFacrtory-Methods\" class=\"headerlink\" title=\"TaskFacrtory Methods\"></a><code>TaskFacrtory</code> Methods</h3><h4 id=\"Add-operations-TaskFacrtory-push-back\"><a href=\"#Add-operations-TaskFacrtory-push-back\" class=\"headerlink\" title=\"Add operations: TaskFacrtory.push_back\"></a>Add operations: <code>TaskFacrtory.push_back</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_tf.push_back(my_operation) </span><br><span class=\"line\"><span class=\"comment\"># E.g.</span></span><br><span class=\"line\">my_tf.push_back(operation.InitializeFromCommandline()) </span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Clear-all-operations-TaskFacrtory-clear\"><a href=\"#Clear-all-operations-TaskFacrtory-clear\" class=\"headerlink\" title=\"Clear all operations: TaskFacrtory.clear\"></a>Clear all operations: <code>TaskFacrtory.clear</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_tf.clear()</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Resources\"><a href=\"#Resources\" class=\"headerlink\" title=\"Resources\"></a>Resources</h3><p><a href=\"https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html\">https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html</a></p>\n<h2 id=\"PackRotamersMoverclass\"><a href=\"#PackRotamersMoverclass\" class=\"headerlink\" title=\"PackRotamersMoverclass\"></a><code>PackRotamersMover</code>class</h2><p>A <em>packer</em> is a <em>mover</em> that carries out packing under the instruction of <code>PackerTask</code>.</p>\n<h3 id=\"Instantiation-Configurations\"><a href=\"#Instantiation-Configurations\" class=\"headerlink\" title=\"Instantiation & Configurations\"></a>Instantiation & Configurations</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `TaskFactory` object called `my_tf`</span></span><br><span class=\"line\">my_packer = pack_min.PackRotamersMover() <span class=\"comment\"># Create a `PackRotamersMover` object</span></span><br><span class=\"line\">my_packer.task_factory(my_tf) <span class=\"comment\"># Pass the `TaskFactory` object to the packer</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Note that we are not passing a scorefunction here. We will use the default, cmd-line scorefunction, </span></span><br><span class=\"line\"><span class=\"comment\"># which can be accessed through `rosetta.core.scoring.get_score_function()`</span></span><br><span class=\"line\"><span class=\"comment\"># We use a scorefunction later. </span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Apply-the-packer-to-a-pose\"><a href=\"#Apply-the-packer-to-a-pose\" class=\"headerlink\" title=\"Apply the packer to a pose\"></a>Apply the packer to a pose</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\">#Run the packer. (Note this may take a few minutes)</span></span><br><span class=\"line\">my_packer.apply(pose)</span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyRosetta-Basics-7-Movers-for-Side-Chain-Packing-and-Design\"><a href=\"#PyRosetta-Basics-7-Movers-for-Side-Chain-Packing-and-Design\" class=\"headerlink\" title=\"PyRosetta Basics (7): Movers for Side Chain Packing and Design\"></a>PyRosetta Basics (7): Movers for Side Chain Packing and Design</h1><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\">#Python</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.teaching <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Core Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> MoveMap</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> FoldTree</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> TaskFactory</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> operation</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.simple_metrics <span class=\"keyword\">import</span> metrics</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select <span class=\"keyword\">import</span> residue_selector <span class=\"keyword\">as</span> selections</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core <span class=\"keyword\">import</span> select</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select.movemap <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Protocol Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> minimization_packing <span class=\"keyword\">as</span> pack_min</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> relax <span class=\"keyword\">as</span> rel</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody.residue_selector <span class=\"keyword\">import</span> CDRResidueSelector</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.loops <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.relax <span class=\"keyword\">import</span> FastRelax</span><br></pre></td></tr></table></figure>\n\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/full-options-list\">https://docs.rosettacommons.org/docs/latest/full-options-list</a></p>\n<h2 id=\"Basic-Concepts\"><a href=\"#Basic-Concepts\" class=\"headerlink\" title=\"Basic Concepts\"></a>Basic Concepts</h2><h3 id=\"Terms-of-pose-operations\"><a href=\"#Terms-of-pose-operations\" class=\"headerlink\" title=\"Terms of pose operations\"></a>Terms of pose operations</h3><ol>\n<li>“Folding”: Folding of the backbone, optimizing values of $ \\phi $and $ \\psi $and $ \\omega $.</li>\n<li>“Packing”: Packing of the side chains of residues, optimizing values of $ \\chi $etc.</li>\n<li>“Designing”: Designing of the protein sequence, optimizing the total energy by changing the identities of amino acids.<br>(e.g. substitute an Arg with a Gly).</li>\n</ol>\n<p>Monte Carlo simulation is the most basic and classic folding algorithm. </p>\n<p>The basic process of the Monte Carlo simulation is shared by all folding, packing and design process.</p>\n<details class=\"lake-collapse\"><summary id=\"u85986045\"><span class=\"ne-text\">Basic Folding Process using Monte Carlo simulation</span></summary><p id=\"u1cf4ba01\" class=\"ne-p\"><a href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" data-href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\" class=\"ne-link\"><span class=\"ne-text\">Note | PyRosetta Basics (6): Mover</span></a></p><h3 id=\"e64YK\"><span class=\"ne-text\" style=\"color: rgba(0, 0, 0, 0.87)\">Making a trial move</span></h3><p id=\"u5e5dbfd4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Apply a </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (change) to the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> (structure).</span></p><h3 id=\"irwtJ\"><span class=\"ne-text\">Scoring the move</span></h3><p id=\"u44f841d4\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">Compare the energy scores before and after the move. </span></p><p id=\"u9e89c1ac\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">(Therefore, the pose should be cloned as a backup before the move.)</span></p><p id=\"u24599695\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\"></span></p><p id=\"u8cc42be0\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">And, compare the energy score after the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> and the lowest energy score in history. </span></p><p id=\"u020e8d13\" class=\"ne-p\"><span class=\"ne-text\" style=\"font-size: 14px\">If the score after this </span><em><span class=\"ne-text\" style=\"font-size: 14px\">move</span></em><span class=\"ne-text\" style=\"font-size: 14px\"> is the lowest, store the </span><em><span class=\"ne-text\" style=\"font-size: 14px\">pose </span></em><span class=\"ne-text\" style=\"font-size: 14px\">after this</span><em><span class=\"ne-text\" style=\"font-size: 14px\"> move </span></em><span class=\"ne-text\" style=\"font-size: 14px\">as the best pose, and renew the lowest energy score in history.</span></p><h3 id=\"TAn8b\"><span class=\"ne-text\">Desiding whether or not to accept the move: </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong></h3><p id=\"ucb6377ba\" class=\"ne-p\"><span class=\"ne-text\">For the</span><strong><span class=\"ne-text\"> </span></strong><span class=\"ne-text\">decision step, we need to make a subroutine that either accepts or rejects the new conformatuon based on the </span><strong><span class=\"ne-text\">Metropolis criterion</span></strong><span class=\"ne-text\">. </span></p><p id=\"u555ca55a\" class=\"ne-p\"><span class=\"ne-text\">The difference between the energy scores after (t+1) and before (t) a move is </span><span id=\"YTTPK\" class=\"ne-math\" style=\"font-size: 14px\"><img src=\"https://cdn.nlark.com/yuque/__latex/140cea98d95645c2586ed9f29e31675b.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u4257265d\" class=\"ne-p\"><span class=\"ne-text\">The Metropolis criterion has a probability of accepting a move as </span><span id=\"GuL5z\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"ub1003231\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"xfX93\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/fb3b0300200beee945a7c33ee9da1833.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"BH3hC\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/862838486b7050697b0dee3c6ecb5d6d.svg\"></span><span class=\"ne-text\">.</span></p><p id=\"u03854502\" class=\"ne-p\"><span class=\"ne-text\">When </span><span id=\"jAP7B\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/16d5d059d93f960fa208a43278bc6094.svg\"></span><span class=\"ne-text\">, the Metropolis criterion probability of accepting the move is </span><span id=\"U1a3A\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/54928c26406c51ef50311d6f0d99f3a6.svg\"></span><span class=\"ne-text\">. </span></p><p id=\"ucd6574c7\" class=\"ne-p\"><span class=\"ne-text\">Use </span><span id=\"lfd2T\" class=\"ne-math\"><img src=\"https://cdn.nlark.com/yuque/__latex/825509854c41e934535f33223f7981f1.svg\"></span><span class=\"ne-text\"> . </span></p><p id=\"u05b7dc94\" class=\"ne-p\"><span class=\"ne-text\"></span></p><p id=\"uf6ba059c\" class=\"ne-p\"><span class=\"ne-text\">If the move is accepted, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> after the </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\"> will be used for the next round of trial </span><em><span class=\"ne-text\">move.</span></em></p><p id=\"ud6027a74\" class=\"ne-p\"><span class=\"ne-text\">If not, the </span><em><span class=\"ne-text\">pose</span></em><span class=\"ne-text\"> before the </span><em><span class=\"ne-text\">move </span></em><span class=\"ne-text\">will be used for the next round of trial </span><em><span class=\"ne-text\">move</span></em><span class=\"ne-text\">.</span></p><h3 id=\"SJZe5\"><span class=\"ne-text\">Iterations</span></h3><p id=\"u892da1c2\" class=\"ne-p\"><span class=\"ne-text\">For each iteration, the 3 steps above are excuted. </span></p><p id=\"u6a79e2e1\" class=\"ne-p\"><span class=\"ne-text\">The final output of this program should be the </span><strong><span class=\"ne-text\">lowest energy conformation</span></strong><span class=\"ne-text\"> that is achieved </span><strong><span class=\"ne-text\">at any point</span></strong><span class=\"ne-text\"> during the simulation. </span></p><p id=\"u53388aed\" class=\"ne-p\"><span class=\"ne-text\" style=\"color: #DF2A3F\">NOTICE</span><span class=\"ne-text\">: Search "greedy algorithm" and "Monte Carlo" for more information about the algorithm design. </span></p></details>\n### Simulated annealing\nSimulated anealing refer to the ramping of temperature `kT`in Python looping.\n\n<ol>\n<li>Set a high initial temperature, so that more barriers can be easily overcome.</li>\n<li>By gradually decreasing the temperarture after each Python loop, the barriers becomes harder to overcome, and the search range gradually narrows down to a local minimum.</li>\n<li>In this process, after a period of “heated” (active) searching across the energy landscape, the energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).</li>\n</ol>\n<h3 id=\"Simulated-relaxing\"><a href=\"#Simulated-relaxing\" class=\"headerlink\" title=\"Simulated relaxing\"></a>Simulated relaxing</h3><p>Simulated relaxing refer to the ramping of energy score <code>E</code>(and the differences between scores <code>delta_E</code>) in Python looping.</p>\n<ol>\n<li>Set a small initial weight of an energy term, so that the free energy (and the barriers) are underestimated, and thus the energy barriers are easier to be overcome.</li>\n<li>By gradually increasing the weight after each Python loop, the energy estimation becomes more realistic, and the search range gradually narrows down to a local minimum.</li>\n<li>In this process, after a period of the “relaxed” (loose) evaluation, energy of a pose is expected to be gradually trapped in a deep trough (valley), which is a reliable local energy minimum (a possible global minimum).</li>\n</ol>\n<h2 id=\"Introduction-to-Packing\"><a href=\"#Introduction-to-Packing\" class=\"headerlink\" title=\"Introduction to Packing\"></a>Introduction to Packing</h2><p>“Packing” is the process of optimizing the conformation of side chains (values of $ \\chi_{n} $and other angles).</p>\n<p>The “<em>packer</em>“ is a subset of _movers <em>that apply packing operations to a pose</em>. _</p>\n<p>We use “task operations” to configure the behaviors of <em>packers</em>:</p>\n<ul>\n<li>The “task operations” are provided to a <code>TaskFactory</code>object.</li>\n<li>The <code>TaskFactory</code> is then passed to a <em>packer</em>.</li>\n</ul>\n<h2 id=\"init-:Initialize-From-Rosetta-Commandline\"><a href=\"#init-:Initialize-From-Rosetta-Commandline\" class=\"headerlink\" title=\"init():Initialize From Rosetta Commandline\"></a><code>init()</code>:Initialize From Rosetta Commandline</h2><p>We can change some defalt Rosetta (C++) commandline settings through</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">pyrosetta.rosetta.init()</span><br></pre></td></tr></table></figure>\n\n<p>E.g.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># we can change some defalt settings through</span></span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.rosetta.init()</span></span><br><span class=\"line\"><span class=\"comment\"># or, write as:</span></span><br><span class=\"line\"><span class=\"comment\"># pyrosetta.init()</span></span><br><span class=\"line\"><span class=\"comment\"># For example</span></span><br><span class=\"line\">init(<span class=\"string\">'-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\</span></span><br><span class=\"line\"><span class=\"string\"> -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 5 -no_fconfig'</span>)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br><span class=\"line\"><span class=\"string\">In this initialization, we</span></span><br><span class=\"line\"><span class=\"string\">1. input the scheme for antibody nomenclature;</span></span><br><span class=\"line\"><span class=\"string\">2. use the PDB ligand definitions to load all standard residue descriptions;</span></span><br><span class=\"line\"><span class=\"string\">3. keep the relax mode as `FastRelax` (which is default);</span></span><br><span class=\"line\"><span class=\"string\">4. and set the `FastRelax` repeat times to 5 (by default it is already 5, can be customized);</span></span><br><span class=\"line\"><span class=\"string\">5. and do not load the [common] config file if present.</span></span><br><span class=\"line\"><span class=\"string\">'''</span></span><br></pre></td></tr></table></figure>\n\n<h2 id=\"TaskFacrtoryclass-prototype-of-PackerTask\"><a href=\"#TaskFacrtoryclass-prototype-of-PackerTask\" class=\"headerlink\" title=\"TaskFacrtoryclass: prototype of PackerTask\"></a><code>TaskFacrtory</code>class: prototype of <code>PackerTask</code></h2><h3 id=\"Introduction\"><a href=\"#Introduction\" class=\"headerlink\" title=\"Introduction\"></a>Introduction</h3><p>Instances of<code>PackerTask</code>class are used to determine the specific tasks in packing.</p>\n<p><code>TaskFactory</code>is the prototype of <code>PackerTask</code> class.</p>\n<p>Every time the protein is packed for a single round, the <code>TaskFactory</code> will generate what is called the <code>PackerTask</code>.</p>\n<p>We do NOT use <code>PackerTask</code> directly.</p>\n<p>We can set <code>TaskOperations</code>to the <code>TaskFactory</code>, and all <code>PackerTask</code>generated by this<code>TaskFactory</code> will be controlled by these <code>TaskOpterations</code>.</p>\n<p>So bascically a <code>TaskFactory</code>object can be seen as “a list of task operations”.</p>\n<p>Some <code>TaskOperations</code>can respond to changes in the pose, so we do not set <code>TaskOperations</code> directly to <code>PackerTask</code>in each packing step.</p>\n<p>Instead, we use <code>TaskFactory</code>to dynamically generate <code>PackerTask</code>objects in each round, behind the scene. </p>\n<h3 id=\"Instantiation-Configuration-push-back\"><a href=\"#Instantiation-Configuration-push-back\" class=\"headerlink\" title=\"Instantiation & Configuration(push_back)\"></a>Instantiation & Configuration(<code>push_back</code>)</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_tf = TaskFactory() <span class=\"comment\"># Create an empty task factory</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># And set task operations to the task factory:</span></span><br><span class=\"line\">my_tf.push_back(operation.InitializeFromCommandline()) </span><br><span class=\"line\"><span class=\"comment\"># IMPORTANT! Use configurations declared in `init()`</span></span><br><span class=\"line\">my_tf.push_back(operation.RestrictToRepacking()) </span><br><span class=\"line\"><span class=\"comment\"># Disable "designing of side chains" so that the sequence will be untouched</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Regional-Packing-selections-PreventRepackingRLT\"><a href=\"#Regional-Packing-selections-PreventRepackingRLT\" class=\"headerlink\" title=\"Regional Packing: selections & PreventRepackingRLT\"></a>Regional Packing: <code>selections</code> & <code>PreventRepackingRLT</code></h3><p>We can also use <code>selections</code>for regional packing</p>\n<p>E.g. Selecting CDR H1 region of an antibody</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Selecting CDR H1 region of an antibody</span></span><br><span class=\"line\">cdr_selector = CDRResidueSelector() <span class=\"comment\"># Instantiation</span></span><br><span class=\"line\">cdr_selector.set_cdr(h1) <span class=\"comment\"># Select the H1 loop only</span></span><br><span class=\"line\"><span class=\"comment\"># the namespace of `h1` was imported by commandlines that were passed to init() </span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Selecting the Neiborhood (in 3D space) residue of CDR H1</span></span><br><span class=\"line\">nbr_selector = selections.NeighborhoodResidueSelector() <span class=\"comment\"># Instantiation</span></span><br><span class=\"line\">nbr_selector.set_focus_selector(cdr_selector) <span class=\"comment\"># Find neighbors of cdr_selector (which is the H1 loop)</span></span><br><span class=\"line\">nbr_selector.set_include_focus_in_subset(<span class=\"literal\">True</span>) <span class=\"comment\"># Include the H1 loop in `nbr_selector` as well</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#"RLT": Residue Level Task Operation</span></span><br><span class=\"line\">prevent_repacking_rlt = operation.PreventRepackingRLT() <span class=\"comment\"># Instantication</span></span><br><span class=\"line\"></span><br><span class=\"line\">prevent_subset_repacking = operation.OperateOnResidueSubset(prevent_repacking_rlt, nbr_selector, <span class=\"literal\">True</span>)</span><br><span class=\"line\"><span class=\"comment\">#`True` indicates here that we are flipping the selection. </span></span><br><span class=\"line\"><span class=\"comment\"># So that we are turning off everything but the CDR and its neighbors.</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `TaskFactory` named `my_tf`</span></span><br><span class=\"line\">my_tf.push_back(prevent_subset_repacking)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"TaskFacrtory-Methods\"><a href=\"#TaskFacrtory-Methods\" class=\"headerlink\" title=\"TaskFacrtory Methods\"></a><code>TaskFacrtory</code> Methods</h3><h4 id=\"Add-operations-TaskFacrtory-push-back\"><a href=\"#Add-operations-TaskFacrtory-push-back\" class=\"headerlink\" title=\"Add operations: TaskFacrtory.push_back\"></a>Add operations: <code>TaskFacrtory.push_back</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_tf.push_back(my_operation) </span><br><span class=\"line\"><span class=\"comment\"># E.g.</span></span><br><span class=\"line\">my_tf.push_back(operation.InitializeFromCommandline()) </span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Clear-all-operations-TaskFacrtory-clear\"><a href=\"#Clear-all-operations-TaskFacrtory-clear\" class=\"headerlink\" title=\"Clear all operations: TaskFacrtory.clear\"></a>Clear all operations: <code>TaskFacrtory.clear</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_tf.clear()</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Resources\"><a href=\"#Resources\" class=\"headerlink\" title=\"Resources\"></a>Resources</h3><p><a href=\"https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html\">https://graylab.jhu.edu/PyRosetta.documentation/pyrosetta.rosetta.core.pack.task.operation.html</a></p>\n<h2 id=\"PackRotamersMoverclass\"><a href=\"#PackRotamersMoverclass\" class=\"headerlink\" title=\"PackRotamersMoverclass\"></a><code>PackRotamersMover</code>class</h2><p>A <em>packer</em> is a <em>mover</em> that carries out packing under the instruction of <code>PackerTask</code>.</p>\n<h3 id=\"Instantiation-Configurations\"><a href=\"#Instantiation-Configurations\" class=\"headerlink\" title=\"Instantiation & Configurations\"></a>Instantiation & Configurations</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `TaskFactory` object called `my_tf`</span></span><br><span class=\"line\">my_packer = pack_min.PackRotamersMover() <span class=\"comment\"># Create a `PackRotamersMover` object</span></span><br><span class=\"line\">my_packer.task_factory(my_tf) <span class=\"comment\"># Pass the `TaskFactory` object to the packer</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Note that we are not passing a scorefunction here. We will use the default, cmd-line scorefunction, </span></span><br><span class=\"line\"><span class=\"comment\"># which can be accessed through `rosetta.core.scoring.get_score_function()`</span></span><br><span class=\"line\"><span class=\"comment\"># We use a scorefunction later. </span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Apply-the-packer-to-a-pose\"><a href=\"#Apply-the-packer-to-a-pose\" class=\"headerlink\" title=\"Apply the packer to a pose\"></a>Apply the packer to a pose</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\">#Run the packer. (Note this may take a few minutes)</span></span><br><span class=\"line\">my_packer.apply(pose)</span><br></pre></td></tr></table></figure>\n\n"},{"title":"PyRosetta Basics (8): Relax Protocols","date":"2025-08-21T04:39:12.000Z","updated":"2025-08-21T04:39:17.000Z","_content":"# PyRosetta Basics (8): Relax Protocols\n## Initialization(Same as the \"Packing\" chapter)\n```python\n#Python\nfrom pyrosetta import *\nfrom pyrosetta.rosetta import *\nfrom pyrosetta.teaching import *\n\n#Core Includes\nfrom pyrosetta.rosetta.core.kinematics import MoveMap\nfrom pyrosetta.rosetta.core.kinematics import FoldTree\nfrom pyrosetta.rosetta.core.pack.task import TaskFactory\nfrom pyrosetta.rosetta.core.pack.task import operation\nfrom pyrosetta.rosetta.core.simple_metrics import metrics\nfrom pyrosetta.rosetta.core.select import residue_selector as selections\nfrom pyrosetta.rosetta.core import select\nfrom pyrosetta.rosetta.core.select.movemap import *\n\n#Protocol Includes\nfrom pyrosetta.rosetta.protocols import minimization_packing as pack_min\nfrom pyrosetta.rosetta.protocols import relax as rel\nfrom pyrosetta.rosetta.protocols.antibody.residue_selector import CDRResidueSelector\nfrom pyrosetta.rosetta.protocols.antibody import *\nfrom pyrosetta.rosetta.protocols.loops import *\nfrom pyrosetta.rosetta.protocols.relax import FastRelax\n```\n\n```python\ninit('-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\\n -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 2 -no_fconfig')\n```\n\n## Introduction to Relax\n### Overview\n> Relax is the main protocol for simple all-atom refinement of structures in the Rosetta force-field. Relax does not do extensive refinement and only searches the local conformational space around the starting structure. Relax is thus often used in conjunction with more aggressive sampling protocols like fragment assembly (abinitio) and loop modelling. To evaluate different conformations based on their Rosetta all-atom score one usually has to apply relax.\n>\n> It can also read centroid models, in which case it will convert the model into a fullatom model and pack the sidechains. Relax does not carry out any extensive refinement and only searches the local conformational space neighbourhood.\n>\n> It is further advisable to apply relax only to previously idealized structures. Idealization avoids that score differences arise due to non-ideal geometry (e.g., at the position of former chain-breaks introduced during an aggressive sampling stage and removed by loop closing).\n>\n> [https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax](https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax)\n>\n\n### `ClassicRelax`\nDepreciated. Small move + shear move.\n\n### `FastRelax`(default)\n5 cycles of {[packing + minimization] * n_ramping}.\n\n> Packing: optimizing side chain conformations without editing side chains.\n>\n> Minimization: find local energy minima.\n>\n> n_ramping: steps of ramping up `fa_rep` (in one single cycle).\n>\n\nIn each of the 5 cycles, the repulsion energy (`fa_rep`) are firstly set to a small number, and then gradually increase to a realistic number in n-step ramping.\n\nPseudo code:\n\n```python\n# Assume that we have a `Pose` object called `my_pose`\nfor i in range(0,5): # \"5\" by default, can be modified\n fa_rep = 0.1 * fa_rep\n for j in range(1, n_ramp):\n fa_rep = Increase(fa_rep)\n Packing(my_pose)\n Minimizing(my_pose)\n```\n\n### `CentroidRelax`(for massive screening)\n1. It uses centroid score functions\n2. It ramps up various energy terms while minimizing the pose\n3. It is rough but fast, thus is suitable for high-throughput structure design \n(as a pre-processing & evaluation for further `FastRelax`).\n\n\n\n\n\n## `FastRelax` class\n### Instantiation & Configurations\n```python\nmy_fr = FastRelax() # Instantiation a `FastRelax` object named `my_fr`\n\nmy_scorefxn = get_score_function() # A default ref2015 full atom score function\n\nmy_fr.set_scorefxn(my_scorefxn)\n\n#FastRelax takes a very long time, \n#but we can decrease the amount of minimization cycles we use:\n#(Only recommended for cartesian)\n# fr.max_iter(100)\n```\n\n### Apply `FastRelax`to a `Pose`object\n```python\n# Assume that we have a `Pose` object named `my_pose`\nmy_fr.apply(my_pose)\n```\n\n## Regional Relax: `MoveMapFactory`class\n### Introduction to `MoveMapFactory` class\n`MoveMapFactory`is the prototype of `MoveMap`.\n\n`MoveMap` instructs a mover. \n\nThe default is to have everything OFF first, and turn specific things on.\n\n\n\nRegional Relax requires:\n\n1. pre-defined residue selectors\n2. the pose\n\nSo residue selectors are designed to be passed to the `MoveMapFactory`.\n\n[Note | PyRosetta Basics (6): Movers for Backbone Folding](https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr)\n\n[MoveMapFactories (RosettaScripts)](https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/MoveMapFactories/MoveMapFactories-RosettaScripts)\n\n### Instantiation & configuration\n```python\n# Establish Residue Selector\ncdr_selector = CDRResidueSelector()\ncdr_selector.set_cdr(h1)\n# h1 is a Enum imported when we imported the antibody namespace\n\n# Instantiate a `MoveMapFactory` object named \"my_mmf\"\nmy_mmf = MoveMapFactory()\n# Setup `my_mmf`\nmy_mmf.add_bb_action(mm_enable, cdr_selector)\nmy_mmf.add_chi_action(mm_enable, cdr_selector) \n# mm_enable and mm_disable are Enums (numbered variables) that \n# come when we import the MMF.\n```\n\n### Check the `MoveMapFactory` settings\nBased on the `MoveMapFactory`, we can create a `MoveMap`object from a `Pose`object, and thus we can check the settings.\n\n```python\n# Instantiate a `MoveMap` object from `my_mmf`\n# We need to pass in a `Pose` object (`my_pose`)\nmy_mm = my_mmf.create_movemap_from_pose(my_pose)\n\n# Inspect my_mm\nprint(my_mm)\n```\n\n### Basic Setup of Regional `FastRelax`\n```python\n# Assume that we have a `FastRelax` object called `my_fr`\n# Assume that we have a `MoveMapFactory` object called `my_mmf`\nmy_fr.set_movemap_factory(my_mmf)\n\n# Assume that we have a `TaskFactory` object called `pack_cdrs_and_neighbors_tf`\nmy_fr.set_task_factory(pack_cdrs_and_neighbors_tf)\n\n# Assume that we have a default ref2015 full atom score function\nmy_fr.set_scorefxn(my_scorefxn)\n\n# Assume that we have a `Pose` object called `my_pose`\n# Finally, we can apply the `my_fr` to `my_pose`:\nmy_fr.apply(my_pose)\n```\n\n### Optimization\nBasic Setup may cause large conformation shifts that we don't want.\n\nWe can tackle this problem by using a different score function, OR by customizing the `FoldTree`.\n\n(Not both)\n\n#### Cartesian-space refinement `ref2015_cart`\n```python\n# Create score function specified for Cartesian\ncart_sf = create_score_function(\"ref2015_cart\")\n\n# Assume that we have a `MoveMapFactory` object called `my_mmf`\nmy_mmf.set_cartesian(True) # Turn \"Cartesian mode\" on.\n\n# Assume that we have a `FastRelax` object called `my_fr`\nmy_fr.set_movemap_factory(my_mmf)\n\n# Use `cart_sf` as the score function for FastRelax\nmy_fr.set_scorefxn(cart_sf)\nmy_fr.cartesian(True)\n\n#This is a general recommendation for cartesian minimization - it lowers the number of maximum cycles.\n# More than this only increases time of protocol, but has little effect on energies/structure\nfr.max_iter(200)\n```\n\nThese settings are Cartesian-specifc. They are turned off by default. Turn them off under other circumstances.\n\n```python\nmy_mmf.set_cartesian(False)\nmy_fr.cartesian(False)\nmy_fr.max_iter(0) #Reset to default \n```\n\n#### Customizing `FoldTree` (A Classic way)\n<font style=\"color:#DF2A3F;\">WARNING</font>: If Cartesian has been turned on, we should turn Cartesian off before using this solution.\n\n```python\n# Assume that we have a `Pose` object named `my_pose`, and it is an antibody\nab_info = AntibodyInfo(my_pose) # Get antibody-specific information\nmy_ft = FoldTree() # Instantiate an empty FolTree\n\n# Get CDR H1 loop parameters\n# >>> #\nstart = ab_info.get_CDR_start(h1, my_pose)\nstop = ab_info.get_CDR_end(h1, my_pose)\ncutpoint = int((stop-start)/2) + start\n# <<< #\n\n# Define the loop\ncdr_loop = Loop(start, stop, cutpoint)\ncdr_loops = Loops()\ncdr_loops.add_loop(cdr_loop)\n\n# Setup of `my_ft`\nfold_tree_from_loops(my_pose, cdr_loops, my_ft) \n\nmy_pose.fold_tree(my_ft)\noriginal_ft = my_pose.fold_tree() # Backup the original fold tree\nadd_cutpoint_variants(my_pose)\n\n# Create a default full atom score function\nscorefxn = get_score_function()\n\n# Add chainbreak term to `scorefxn` so we don't get wacky stuff. \n# This term helps keep the peptide closed during bb movement.\nscorefxn_ch = scorefxn # Copy the default score function\nscorefxn_ch.set_weight(rosetta.core.scoring.chainbreak, 100) # Add chainbreak term\n\n# Assume that we have a `FastRelax` object called `my_fr`\nmy_fr.set_scorefxn(scorefxn_ch)\n\n# Assume that we have a `MoveMap` object (with basic configurations) called `my_mmf`\nmy_fr.set_movemap_factory(my_mmf)\n\nmy_fr.max_iter(0) #Reset to default \n# if it's 0, then we don't set it in the MinMover that FastRelax runs\n\n# Start FastRelax\nmy_fr.apply(my_pose)\n\n#Reapply the original fold tree\nmy_pose.fold_tree(original_ft)\n```\n\n","source":"_posts/Note _ PyRosetta Basics (8)_ Relax Protocols.md","raw":"title: 'PyRosetta Basics (8): Relax Protocols'\ndate: '2025-08-21 12:39:12'\nupdated: '2025-08-21 12:39:17'\ntags:\n - protein\n - biochemistry\n - protein design\n - PyRosetta\n - note\ncategories:\n - protein design\n---\n# PyRosetta Basics (8): Relax Protocols\n## Initialization(Same as the \"Packing\" chapter)\n```python\n#Python\nfrom pyrosetta import *\nfrom pyrosetta.rosetta import *\nfrom pyrosetta.teaching import *\n\n#Core Includes\nfrom pyrosetta.rosetta.core.kinematics import MoveMap\nfrom pyrosetta.rosetta.core.kinematics import FoldTree\nfrom pyrosetta.rosetta.core.pack.task import TaskFactory\nfrom pyrosetta.rosetta.core.pack.task import operation\nfrom pyrosetta.rosetta.core.simple_metrics import metrics\nfrom pyrosetta.rosetta.core.select import residue_selector as selections\nfrom pyrosetta.rosetta.core import select\nfrom pyrosetta.rosetta.core.select.movemap import *\n\n#Protocol Includes\nfrom pyrosetta.rosetta.protocols import minimization_packing as pack_min\nfrom pyrosetta.rosetta.protocols import relax as rel\nfrom pyrosetta.rosetta.protocols.antibody.residue_selector import CDRResidueSelector\nfrom pyrosetta.rosetta.protocols.antibody import *\nfrom pyrosetta.rosetta.protocols.loops import *\nfrom pyrosetta.rosetta.protocols.relax import FastRelax\n```\n\n```python\ninit('-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\\n -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 2 -no_fconfig')\n```\n\n## Introduction to Relax\n### Overview\n> Relax is the main protocol for simple all-atom refinement of structures in the Rosetta force-field. Relax does not do extensive refinement and only searches the local conformational space around the starting structure. Relax is thus often used in conjunction with more aggressive sampling protocols like fragment assembly (abinitio) and loop modelling. To evaluate different conformations based on their Rosetta all-atom score one usually has to apply relax.\n>\n> It can also read centroid models, in which case it will convert the model into a fullatom model and pack the sidechains. Relax does not carry out any extensive refinement and only searches the local conformational space neighbourhood.\n>\n> It is further advisable to apply relax only to previously idealized structures. Idealization avoids that score differences arise due to non-ideal geometry (e.g., at the position of former chain-breaks introduced during an aggressive sampling stage and removed by loop closing).\n>\n> [https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax](https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax)\n>\n\n### `ClassicRelax`\nDepreciated. Small move + shear move.\n\n### `FastRelax`(default)\n5 cycles of {[packing + minimization] * n_ramping}.\n\n> Packing: optimizing side chain conformations without editing side chains.\n>\n> Minimization: find local energy minima.\n>\n> n_ramping: steps of ramping up `fa_rep` (in one single cycle).\n>\n\nIn each of the 5 cycles, the repulsion energy (`fa_rep`) are firstly set to a small number, and then gradually increase to a realistic number in n-step ramping.\n\nPseudo code:\n\n```python\n# Assume that we have a `Pose` object called `my_pose`\nfor i in range(0,5): # \"5\" by default, can be modified\n fa_rep = 0.1 * fa_rep\n for j in range(1, n_ramp):\n fa_rep = Increase(fa_rep)\n Packing(my_pose)\n Minimizing(my_pose)\n```\n\n### `CentroidRelax`(for massive screening)\n1. It uses centroid score functions\n2. It ramps up various energy terms while minimizing the pose\n3. It is rough but fast, thus is suitable for high-throughput structure design \n(as a pre-processing & evaluation for further `FastRelax`).\n\n\n\n\n\n## `FastRelax` class\n### Instantiation & Configurations\n```python\nmy_fr = FastRelax() # Instantiation a `FastRelax` object named `my_fr`\n\nmy_scorefxn = get_score_function() # A default ref2015 full atom score function\n\nmy_fr.set_scorefxn(my_scorefxn)\n\n#FastRelax takes a very long time, \n#but we can decrease the amount of minimization cycles we use:\n#(Only recommended for cartesian)\n# fr.max_iter(100)\n```\n\n### Apply `FastRelax`to a `Pose`object\n```python\n# Assume that we have a `Pose` object named `my_pose`\nmy_fr.apply(my_pose)\n```\n\n## Regional Relax: `MoveMapFactory`class\n### Introduction to `MoveMapFactory` class\n`MoveMapFactory`is the prototype of `MoveMap`.\n\n`MoveMap` instructs a mover. \n\nThe default is to have everything OFF first, and turn specific things on.\n\n\n\nRegional Relax requires:\n\n1. pre-defined residue selectors\n2. the pose\n\nSo residue selectors are designed to be passed to the `MoveMapFactory`.\n\n[Note | PyRosetta Basics (6): Movers for Backbone Folding](https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr)\n\n[MoveMapFactories (RosettaScripts)](https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/MoveMapFactories/MoveMapFactories-RosettaScripts)\n\n### Instantiation & configuration\n```python\n# Establish Residue Selector\ncdr_selector = CDRResidueSelector()\ncdr_selector.set_cdr(h1)\n# h1 is a Enum imported when we imported the antibody namespace\n\n# Instantiate a `MoveMapFactory` object named \"my_mmf\"\nmy_mmf = MoveMapFactory()\n# Setup `my_mmf`\nmy_mmf.add_bb_action(mm_enable, cdr_selector)\nmy_mmf.add_chi_action(mm_enable, cdr_selector) \n# mm_enable and mm_disable are Enums (numbered variables) that \n# come when we import the MMF.\n```\n\n### Check the `MoveMapFactory` settings\nBased on the `MoveMapFactory`, we can create a `MoveMap`object from a `Pose`object, and thus we can check the settings.\n\n```python\n# Instantiate a `MoveMap` object from `my_mmf`\n# We need to pass in a `Pose` object (`my_pose`)\nmy_mm = my_mmf.create_movemap_from_pose(my_pose)\n\n# Inspect my_mm\nprint(my_mm)\n```\n\n### Basic Setup of Regional `FastRelax`\n```python\n# Assume that we have a `FastRelax` object called `my_fr`\n# Assume that we have a `MoveMapFactory` object called `my_mmf`\nmy_fr.set_movemap_factory(my_mmf)\n\n# Assume that we have a `TaskFactory` object called `pack_cdrs_and_neighbors_tf`\nmy_fr.set_task_factory(pack_cdrs_and_neighbors_tf)\n\n# Assume that we have a default ref2015 full atom score function\nmy_fr.set_scorefxn(my_scorefxn)\n\n# Assume that we have a `Pose` object called `my_pose`\n# Finally, we can apply the `my_fr` to `my_pose`:\nmy_fr.apply(my_pose)\n```\n\n### Optimization\nBasic Setup may cause large conformation shifts that we don't want.\n\nWe can tackle this problem by using a different score function, OR by customizing the `FoldTree`.\n\n(Not both)\n\n#### Cartesian-space refinement `ref2015_cart`\n```python\n# Create score function specified for Cartesian\ncart_sf = create_score_function(\"ref2015_cart\")\n\n# Assume that we have a `MoveMapFactory` object called `my_mmf`\nmy_mmf.set_cartesian(True) # Turn \"Cartesian mode\" on.\n\n# Assume that we have a `FastRelax` object called `my_fr`\nmy_fr.set_movemap_factory(my_mmf)\n\n# Use `cart_sf` as the score function for FastRelax\nmy_fr.set_scorefxn(cart_sf)\nmy_fr.cartesian(True)\n\n#This is a general recommendation for cartesian minimization - it lowers the number of maximum cycles.\n# More than this only increases time of protocol, but has little effect on energies/structure\nfr.max_iter(200)\n```\n\nThese settings are Cartesian-specifc. They are turned off by default. Turn them off under other circumstances.\n\n```python\nmy_mmf.set_cartesian(False)\nmy_fr.cartesian(False)\nmy_fr.max_iter(0) #Reset to default \n```\n\n#### Customizing `FoldTree` (A Classic way)\n<font style=\"color:#DF2A3F;\">WARNING</font>: If Cartesian has been turned on, we should turn Cartesian off before using this solution.\n\n```python\n# Assume that we have a `Pose` object named `my_pose`, and it is an antibody\nab_info = AntibodyInfo(my_pose) # Get antibody-specific information\nmy_ft = FoldTree() # Instantiate an empty FolTree\n\n# Get CDR H1 loop parameters\n# >>> #\nstart = ab_info.get_CDR_start(h1, my_pose)\nstop = ab_info.get_CDR_end(h1, my_pose)\ncutpoint = int((stop-start)/2) + start\n# <<< #\n\n# Define the loop\ncdr_loop = Loop(start, stop, cutpoint)\ncdr_loops = Loops()\ncdr_loops.add_loop(cdr_loop)\n\n# Setup of `my_ft`\nfold_tree_from_loops(my_pose, cdr_loops, my_ft) \n\nmy_pose.fold_tree(my_ft)\noriginal_ft = my_pose.fold_tree() # Backup the original fold tree\nadd_cutpoint_variants(my_pose)\n\n# Create a default full atom score function\nscorefxn = get_score_function()\n\n# Add chainbreak term to `scorefxn` so we don't get wacky stuff. \n# This term helps keep the peptide closed during bb movement.\nscorefxn_ch = scorefxn # Copy the default score function\nscorefxn_ch.set_weight(rosetta.core.scoring.chainbreak, 100) # Add chainbreak term\n\n# Assume that we have a `FastRelax` object called `my_fr`\nmy_fr.set_scorefxn(scorefxn_ch)\n\n# Assume that we have a `MoveMap` object (with basic configurations) called `my_mmf`\nmy_fr.set_movemap_factory(my_mmf)\n\nmy_fr.max_iter(0) #Reset to default \n# if it's 0, then we don't set it in the MinMover that FastRelax runs\n\n# Start FastRelax\nmy_fr.apply(my_pose)\n\n#Reapply the original fold tree\nmy_pose.fold_tree(original_ft)\n```\n\n","slug":"Note _ PyRosetta Basics (8)_ Relax Protocols","published":1,"comments":1,"layout":"post","photos":[],"_id":"cmekx8a7w0051cgu614t9h3vb","content":"<h1 id=\"PyRosetta-Basics-8-Relax-Protocols\"><a href=\"#PyRosetta-Basics-8-Relax-Protocols\" class=\"headerlink\" title=\"PyRosetta Basics (8): Relax Protocols\"></a>PyRosetta Basics (8): Relax Protocols</h1><h2 id=\"Initialization-Same-as-the-“Packing”-chapter\"><a href=\"#Initialization-Same-as-the-“Packing”-chapter\" class=\"headerlink\" title=\"Initialization(Same as the “Packing” chapter)\"></a>Initialization(Same as the “Packing” chapter)</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\">#Python</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.teaching <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Core Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> MoveMap</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> FoldTree</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> TaskFactory</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> operation</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.simple_metrics <span class=\"keyword\">import</span> metrics</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select <span class=\"keyword\">import</span> residue_selector <span class=\"keyword\">as</span> selections</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core <span class=\"keyword\">import</span> select</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select.movemap <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Protocol Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> minimization_packing <span class=\"keyword\">as</span> pack_min</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> relax <span class=\"keyword\">as</span> rel</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody.residue_selector <span class=\"keyword\">import</span> CDRResidueSelector</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.loops <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.relax <span class=\"keyword\">import</span> FastRelax</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">init(<span class=\"string\">'-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\</span></span><br><span class=\"line\"><span class=\"string\"> -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 2 -no_fconfig'</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Introduction-to-Relax\"><a href=\"#Introduction-to-Relax\" class=\"headerlink\" title=\"Introduction to Relax\"></a>Introduction to Relax</h2><h3 id=\"Overview\"><a href=\"#Overview\" class=\"headerlink\" title=\"Overview\"></a>Overview</h3><blockquote>\n<p>Relax is the main protocol for simple all-atom refinement of structures in the Rosetta force-field. Relax does not do extensive refinement and only searches the local conformational space around the starting structure. Relax is thus often used in conjunction with more aggressive sampling protocols like fragment assembly (abinitio) and loop modelling. To evaluate different conformations based on their Rosetta all-atom score one usually has to apply relax.</p>\n<p>It can also read centroid models, in which case it will convert the model into a fullatom model and pack the sidechains. Relax does not carry out any extensive refinement and only searches the local conformational space neighbourhood.</p>\n<p>It is further advisable to apply relax only to previously idealized structures. Idealization avoids that score differences arise due to non-ideal geometry (e.g., at the position of former chain-breaks introduced during an aggressive sampling stage and removed by loop closing).</p>\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax\">https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax</a></p>\n</blockquote>\n<h3 id=\"ClassicRelax\"><a href=\"#ClassicRelax\" class=\"headerlink\" title=\"ClassicRelax\"></a><code>ClassicRelax</code></h3><p>Depreciated. Small move + shear move.</p>\n<h3 id=\"FastRelax-default\"><a href=\"#FastRelax-default\" class=\"headerlink\" title=\"FastRelax(default)\"></a><code>FastRelax</code>(default)</h3><p>5 cycles of {[packing + minimization] * n_ramping}.</p>\n<blockquote>\n<p>Packing: optimizing side chain conformations without editing side chains.</p>\n<p>Minimization: find local energy minima.</p>\n<p>n_ramping: steps of ramping up <code>fa_rep</code> (in one single cycle).</p>\n</blockquote>\n<p>In each of the 5 cycles, the repulsion energy (<code>fa_rep</code>) are firstly set to a small number, and then gradually increase to a realistic number in n-step ramping.</p>\n<p>Pseudo code:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object called `my_pose`</span></span><br><span class=\"line\"><span class=\"keyword\">for</span> i <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(<span class=\"number\">0</span>,<span class=\"number\">5</span>): <span class=\"comment\"># "5" by default, can be modified</span></span><br><span class=\"line\"> fa_rep = <span class=\"number\">0.1</span> * fa_rep</span><br><span class=\"line\"> <span class=\"keyword\">for</span> j <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(<span class=\"number\">1</span>, n_ramp):</span><br><span class=\"line\"> fa_rep = Increase(fa_rep)</span><br><span class=\"line\"> Packing(my_pose)</span><br><span class=\"line\"> Minimizing(my_pose)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"CentroidRelax-for-massive-screening\"><a href=\"#CentroidRelax-for-massive-screening\" class=\"headerlink\" title=\"CentroidRelax(for massive screening)\"></a><code>CentroidRelax</code>(for massive screening)</h3><ol>\n<li>It uses centroid score functions</li>\n<li>It ramps up various energy terms while minimizing the pose</li>\n<li>It is rough but fast, thus is suitable for high-throughput structure design<br>(as a pre-processing & evaluation for further <code>FastRelax</code>).</li>\n</ol>\n<h2 id=\"FastRelax-class\"><a href=\"#FastRelax-class\" class=\"headerlink\" title=\"FastRelax class\"></a><code>FastRelax</code> class</h2><h3 id=\"Instantiation-Configurations\"><a href=\"#Instantiation-Configurations\" class=\"headerlink\" title=\"Instantiation & Configurations\"></a>Instantiation & Configurations</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_fr = FastRelax() <span class=\"comment\"># Instantiation a `FastRelax` object named `my_fr`</span></span><br><span class=\"line\"></span><br><span class=\"line\">my_scorefxn = get_score_function() <span class=\"comment\"># A default ref2015 full atom score function</span></span><br><span class=\"line\"></span><br><span class=\"line\">my_fr.set_scorefxn(my_scorefxn)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#FastRelax takes a very long time, </span></span><br><span class=\"line\"><span class=\"comment\">#but we can decrease the amount of minimization cycles we use:</span></span><br><span class=\"line\"><span class=\"comment\">#(Only recommended for cartesian)</span></span><br><span class=\"line\"><span class=\"comment\"># fr.max_iter(100)</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Apply-FastRelaxto-a-Poseobject\"><a href=\"#Apply-FastRelaxto-a-Poseobject\" class=\"headerlink\" title=\"Apply FastRelaxto a Poseobject\"></a>Apply <code>FastRelax</code>to a <code>Pose</code>object</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object named `my_pose`</span></span><br><span class=\"line\">my_fr.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Regional-Relax-MoveMapFactoryclass\"><a href=\"#Regional-Relax-MoveMapFactoryclass\" class=\"headerlink\" title=\"Regional Relax: MoveMapFactoryclass\"></a>Regional Relax: <code>MoveMapFactory</code>class</h2><h3 id=\"Introduction-to-MoveMapFactory-class\"><a href=\"#Introduction-to-MoveMapFactory-class\" class=\"headerlink\" title=\"Introduction to MoveMapFactory class\"></a>Introduction to <code>MoveMapFactory</code> class</h3><p><code>MoveMapFactory</code>is the prototype of <code>MoveMap</code>.</p>\n<p><code>MoveMap</code> instructs a mover. </p>\n<p>The default is to have everything OFF first, and turn specific things on.</p>\n<p>Regional Relax requires:</p>\n<ol>\n<li>pre-defined residue selectors</li>\n<li>the pose</li>\n</ol>\n<p>So residue selectors are designed to be passed to the <code>MoveMapFactory</code>.</p>\n<p><a href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\">Note | PyRosetta Basics (6): Movers for Backbone Folding</a></p>\n<p><a href=\"https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/MoveMapFactories/MoveMapFactories-RosettaScripts\">MoveMapFactories (RosettaScripts)</a></p>\n<h3 id=\"Instantiation-configuration\"><a href=\"#Instantiation-configuration\" class=\"headerlink\" title=\"Instantiation & configuration\"></a>Instantiation & configuration</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Establish Residue Selector</span></span><br><span class=\"line\">cdr_selector = CDRResidueSelector()</span><br><span class=\"line\">cdr_selector.set_cdr(h1)</span><br><span class=\"line\"><span class=\"comment\"># h1 is a Enum imported when we imported the antibody namespace</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Instantiate a `MoveMapFactory` object named "my_mmf"</span></span><br><span class=\"line\">my_mmf = MoveMapFactory()</span><br><span class=\"line\"><span class=\"comment\"># Setup `my_mmf`</span></span><br><span class=\"line\">my_mmf.add_bb_action(mm_enable, cdr_selector)</span><br><span class=\"line\">my_mmf.add_chi_action(mm_enable, cdr_selector) </span><br><span class=\"line\"><span class=\"comment\"># mm_enable and mm_disable are Enums (numbered variables) that </span></span><br><span class=\"line\"><span class=\"comment\"># come when we import the MMF.</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Check-the-MoveMapFactory-settings\"><a href=\"#Check-the-MoveMapFactory-settings\" class=\"headerlink\" title=\"Check the MoveMapFactory settings\"></a>Check the <code>MoveMapFactory</code> settings</h3><p>Based on the <code>MoveMapFactory</code>, we can create a <code>MoveMap</code>object from a <code>Pose</code>object, and thus we can check the settings.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Instantiate a `MoveMap` object from `my_mmf`</span></span><br><span class=\"line\"><span class=\"comment\"># We need to pass in a `Pose` object (`my_pose`)</span></span><br><span class=\"line\">my_mm = my_mmf.create_movemap_from_pose(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Inspect my_mm</span></span><br><span class=\"line\"><span class=\"built_in\">print</span>(my_mm)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Basic-Setup-of-Regional-FastRelax\"><a href=\"#Basic-Setup-of-Regional-FastRelax\" class=\"headerlink\" title=\"Basic Setup of Regional FastRelax\"></a>Basic Setup of Regional <code>FastRelax</code></h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `FastRelax` object called `my_fr`</span></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `MoveMapFactory` object called `my_mmf`</span></span><br><span class=\"line\">my_fr.set_movemap_factory(my_mmf)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `TaskFactory` object called `pack_cdrs_and_neighbors_tf`</span></span><br><span class=\"line\">my_fr.set_task_factory(pack_cdrs_and_neighbors_tf)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a default ref2015 full atom score function</span></span><br><span class=\"line\">my_fr.set_scorefxn(my_scorefxn)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object called `my_pose`</span></span><br><span class=\"line\"><span class=\"comment\"># Finally, we can apply the `my_fr` to `my_pose`:</span></span><br><span class=\"line\">my_fr.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Optimization\"><a href=\"#Optimization\" class=\"headerlink\" title=\"Optimization\"></a>Optimization</h3><p>Basic Setup may cause large conformation shifts that we don’t want.</p>\n<p>We can tackle this problem by using a different score function, OR by customizing the <code>FoldTree</code>.</p>\n<p>(Not both)</p>\n<h4 id=\"Cartesian-space-refinement-ref2015-cart\"><a href=\"#Cartesian-space-refinement-ref2015-cart\" class=\"headerlink\" title=\"Cartesian-space refinement ref2015_cart\"></a>Cartesian-space refinement <code>ref2015_cart</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Create score function specified for Cartesian</span></span><br><span class=\"line\">cart_sf = create_score_function(<span class=\"string\">"ref2015_cart"</span>)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `MoveMapFactory` object called `my_mmf`</span></span><br><span class=\"line\">my_mmf.set_cartesian(<span class=\"literal\">True</span>) <span class=\"comment\"># Turn "Cartesian mode" on.</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `FastRelax` object called `my_fr`</span></span><br><span class=\"line\">my_fr.set_movemap_factory(my_mmf)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Use `cart_sf` as the score function for FastRelax</span></span><br><span class=\"line\">my_fr.set_scorefxn(cart_sf)</span><br><span class=\"line\">my_fr.cartesian(<span class=\"literal\">True</span>)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#This is a general recommendation for cartesian minimization - it lowers the number of maximum cycles.</span></span><br><span class=\"line\"><span class=\"comment\"># More than this only increases time of protocol, but has little effect on energies/structure</span></span><br><span class=\"line\">fr.max_iter(<span class=\"number\">200</span>)</span><br></pre></td></tr></table></figure>\n\n<p>These settings are Cartesian-specifc. They are turned off by default. Turn them off under other circumstances.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_mmf.set_cartesian(<span class=\"literal\">False</span>)</span><br><span class=\"line\">my_fr.cartesian(<span class=\"literal\">False</span>)</span><br><span class=\"line\">my_fr.max_iter(<span class=\"number\">0</span>) <span class=\"comment\">#Reset to default </span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Customizing-FoldTree-A-Classic-way\"><a href=\"#Customizing-FoldTree-A-Classic-way\" class=\"headerlink\" title=\"Customizing FoldTree (A Classic way)\"></a>Customizing <code>FoldTree</code> (A Classic way)</h4><p><font style=\"color:#DF2A3F;\">WARNING</font>: If Cartesian has been turned on, we should turn Cartesian off before using this solution.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br><span class=\"line\">32</span><br><span class=\"line\">33</span><br><span class=\"line\">34</span><br><span class=\"line\">35</span><br><span class=\"line\">36</span><br><span class=\"line\">37</span><br><span class=\"line\">38</span><br><span class=\"line\">39</span><br><span class=\"line\">40</span><br><span class=\"line\">41</span><br><span class=\"line\">42</span><br><span class=\"line\">43</span><br><span class=\"line\">44</span><br><span class=\"line\">45</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object named `my_pose`, and it is an antibody</span></span><br><span class=\"line\">ab_info = AntibodyInfo(my_pose) <span class=\"comment\"># Get antibody-specific information</span></span><br><span class=\"line\">my_ft = FoldTree() <span class=\"comment\"># Instantiate an empty FolTree</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Get CDR H1 loop parameters</span></span><br><span class=\"line\"><span class=\"comment\"># >>> #</span></span><br><span class=\"line\">start = ab_info.get_CDR_start(h1, my_pose)</span><br><span class=\"line\">stop = ab_info.get_CDR_end(h1, my_pose)</span><br><span class=\"line\">cutpoint = <span class=\"built_in\">int</span>((stop-start)/<span class=\"number\">2</span>) + start</span><br><span class=\"line\"><span class=\"comment\"># <<< #</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Define the loop</span></span><br><span class=\"line\">cdr_loop = Loop(start, stop, cutpoint)</span><br><span class=\"line\">cdr_loops = Loops()</span><br><span class=\"line\">cdr_loops.add_loop(cdr_loop)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Setup of `my_ft`</span></span><br><span class=\"line\">fold_tree_from_loops(my_pose, cdr_loops, my_ft) </span><br><span class=\"line\"></span><br><span class=\"line\">my_pose.fold_tree(my_ft)</span><br><span class=\"line\">original_ft = my_pose.fold_tree() <span class=\"comment\"># Backup the original fold tree</span></span><br><span class=\"line\">add_cutpoint_variants(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Create a default full atom score function</span></span><br><span class=\"line\">scorefxn = get_score_function()</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Add chainbreak term to `scorefxn` so we don't get wacky stuff. </span></span><br><span class=\"line\"><span class=\"comment\"># This term helps keep the peptide closed during bb movement.</span></span><br><span class=\"line\">scorefxn_ch = scorefxn <span class=\"comment\"># Copy the default score function</span></span><br><span class=\"line\">scorefxn_ch.set_weight(rosetta.core.scoring.chainbreak, <span class=\"number\">100</span>) <span class=\"comment\"># Add chainbreak term</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `FastRelax` object called `my_fr`</span></span><br><span class=\"line\">my_fr.set_scorefxn(scorefxn_ch)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `MoveMap` object (with basic configurations) called `my_mmf`</span></span><br><span class=\"line\">my_fr.set_movemap_factory(my_mmf)</span><br><span class=\"line\"></span><br><span class=\"line\">my_fr.max_iter(<span class=\"number\">0</span>) <span class=\"comment\">#Reset to default </span></span><br><span class=\"line\"><span class=\"comment\"># if it's 0, then we don't set it in the MinMover that FastRelax runs</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Start FastRelax</span></span><br><span class=\"line\">my_fr.apply(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Reapply the original fold tree</span></span><br><span class=\"line\">my_pose.fold_tree(original_ft)</span><br></pre></td></tr></table></figure>\n\n","excerpt":"","more":"<h1 id=\"PyRosetta-Basics-8-Relax-Protocols\"><a href=\"#PyRosetta-Basics-8-Relax-Protocols\" class=\"headerlink\" title=\"PyRosetta Basics (8): Relax Protocols\"></a>PyRosetta Basics (8): Relax Protocols</h1><h2 id=\"Initialization-Same-as-the-“Packing”-chapter\"><a href=\"#Initialization-Same-as-the-“Packing”-chapter\" class=\"headerlink\" title=\"Initialization(Same as the “Packing” chapter)\"></a>Initialization(Same as the “Packing” chapter)</h2><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\">#Python</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.teaching <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Core Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> MoveMap</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.kinematics <span class=\"keyword\">import</span> FoldTree</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> TaskFactory</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.pack.task <span class=\"keyword\">import</span> operation</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.simple_metrics <span class=\"keyword\">import</span> metrics</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select <span class=\"keyword\">import</span> residue_selector <span class=\"keyword\">as</span> selections</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core <span class=\"keyword\">import</span> select</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.core.select.movemap <span class=\"keyword\">import</span> *</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Protocol Includes</span></span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> minimization_packing <span class=\"keyword\">as</span> pack_min</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols <span class=\"keyword\">import</span> relax <span class=\"keyword\">as</span> rel</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody.residue_selector <span class=\"keyword\">import</span> CDRResidueSelector</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.antibody <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.loops <span class=\"keyword\">import</span> *</span><br><span class=\"line\"><span class=\"keyword\">from</span> pyrosetta.rosetta.protocols.relax <span class=\"keyword\">import</span> FastRelax</span><br></pre></td></tr></table></figure>\n\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">init(<span class=\"string\">'-use_input_sc -input_ab_scheme AHo_Scheme -ignore_unrecognized_res \\</span></span><br><span class=\"line\"><span class=\"string\"> -ignore_zero_occupancy false -load_PDB_components false -relax:default_repeats 2 -no_fconfig'</span>)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Introduction-to-Relax\"><a href=\"#Introduction-to-Relax\" class=\"headerlink\" title=\"Introduction to Relax\"></a>Introduction to Relax</h2><h3 id=\"Overview\"><a href=\"#Overview\" class=\"headerlink\" title=\"Overview\"></a>Overview</h3><blockquote>\n<p>Relax is the main protocol for simple all-atom refinement of structures in the Rosetta force-field. Relax does not do extensive refinement and only searches the local conformational space around the starting structure. Relax is thus often used in conjunction with more aggressive sampling protocols like fragment assembly (abinitio) and loop modelling. To evaluate different conformations based on their Rosetta all-atom score one usually has to apply relax.</p>\n<p>It can also read centroid models, in which case it will convert the model into a fullatom model and pack the sidechains. Relax does not carry out any extensive refinement and only searches the local conformational space neighbourhood.</p>\n<p>It is further advisable to apply relax only to previously idealized structures. Idealization avoids that score differences arise due to non-ideal geometry (e.g., at the position of former chain-breaks introduced during an aggressive sampling stage and removed by loop closing).</p>\n<p><a href=\"https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax\">https://docs.rosettacommons.org/docs/latest/application_documentation/structure_prediction/relax</a></p>\n</blockquote>\n<h3 id=\"ClassicRelax\"><a href=\"#ClassicRelax\" class=\"headerlink\" title=\"ClassicRelax\"></a><code>ClassicRelax</code></h3><p>Depreciated. Small move + shear move.</p>\n<h3 id=\"FastRelax-default\"><a href=\"#FastRelax-default\" class=\"headerlink\" title=\"FastRelax(default)\"></a><code>FastRelax</code>(default)</h3><p>5 cycles of {[packing + minimization] * n_ramping}.</p>\n<blockquote>\n<p>Packing: optimizing side chain conformations without editing side chains.</p>\n<p>Minimization: find local energy minima.</p>\n<p>n_ramping: steps of ramping up <code>fa_rep</code> (in one single cycle).</p>\n</blockquote>\n<p>In each of the 5 cycles, the repulsion energy (<code>fa_rep</code>) are firstly set to a small number, and then gradually increase to a realistic number in n-step ramping.</p>\n<p>Pseudo code:</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object called `my_pose`</span></span><br><span class=\"line\"><span class=\"keyword\">for</span> i <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(<span class=\"number\">0</span>,<span class=\"number\">5</span>): <span class=\"comment\"># "5" by default, can be modified</span></span><br><span class=\"line\"> fa_rep = <span class=\"number\">0.1</span> * fa_rep</span><br><span class=\"line\"> <span class=\"keyword\">for</span> j <span class=\"keyword\">in</span> <span class=\"built_in\">range</span>(<span class=\"number\">1</span>, n_ramp):</span><br><span class=\"line\"> fa_rep = Increase(fa_rep)</span><br><span class=\"line\"> Packing(my_pose)</span><br><span class=\"line\"> Minimizing(my_pose)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"CentroidRelax-for-massive-screening\"><a href=\"#CentroidRelax-for-massive-screening\" class=\"headerlink\" title=\"CentroidRelax(for massive screening)\"></a><code>CentroidRelax</code>(for massive screening)</h3><ol>\n<li>It uses centroid score functions</li>\n<li>It ramps up various energy terms while minimizing the pose</li>\n<li>It is rough but fast, thus is suitable for high-throughput structure design<br>(as a pre-processing & evaluation for further <code>FastRelax</code>).</li>\n</ol>\n<h2 id=\"FastRelax-class\"><a href=\"#FastRelax-class\" class=\"headerlink\" title=\"FastRelax class\"></a><code>FastRelax</code> class</h2><h3 id=\"Instantiation-Configurations\"><a href=\"#Instantiation-Configurations\" class=\"headerlink\" title=\"Instantiation & Configurations\"></a>Instantiation & Configurations</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_fr = FastRelax() <span class=\"comment\"># Instantiation a `FastRelax` object named `my_fr`</span></span><br><span class=\"line\"></span><br><span class=\"line\">my_scorefxn = get_score_function() <span class=\"comment\"># A default ref2015 full atom score function</span></span><br><span class=\"line\"></span><br><span class=\"line\">my_fr.set_scorefxn(my_scorefxn)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#FastRelax takes a very long time, </span></span><br><span class=\"line\"><span class=\"comment\">#but we can decrease the amount of minimization cycles we use:</span></span><br><span class=\"line\"><span class=\"comment\">#(Only recommended for cartesian)</span></span><br><span class=\"line\"><span class=\"comment\"># fr.max_iter(100)</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Apply-FastRelaxto-a-Poseobject\"><a href=\"#Apply-FastRelaxto-a-Poseobject\" class=\"headerlink\" title=\"Apply FastRelaxto a Poseobject\"></a>Apply <code>FastRelax</code>to a <code>Pose</code>object</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object named `my_pose`</span></span><br><span class=\"line\">my_fr.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n<h2 id=\"Regional-Relax-MoveMapFactoryclass\"><a href=\"#Regional-Relax-MoveMapFactoryclass\" class=\"headerlink\" title=\"Regional Relax: MoveMapFactoryclass\"></a>Regional Relax: <code>MoveMapFactory</code>class</h2><h3 id=\"Introduction-to-MoveMapFactory-class\"><a href=\"#Introduction-to-MoveMapFactory-class\" class=\"headerlink\" title=\"Introduction to MoveMapFactory class\"></a>Introduction to <code>MoveMapFactory</code> class</h3><p><code>MoveMapFactory</code>is the prototype of <code>MoveMap</code>.</p>\n<p><code>MoveMap</code> instructs a mover. </p>\n<p>The default is to have everything OFF first, and turn specific things on.</p>\n<p>Regional Relax requires:</p>\n<ol>\n<li>pre-defined residue selectors</li>\n<li>the pose</li>\n</ol>\n<p>So residue selectors are designed to be passed to the <code>MoveMapFactory</code>.</p>\n<p><a href=\"https://www.yuque.com/yuqueyonghu2r84jv/zmy8pd/gfkfxof6pygtuwkr\">Note | PyRosetta Basics (6): Movers for Backbone Folding</a></p>\n<p><a href=\"https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/MoveMapFactories/MoveMapFactories-RosettaScripts\">MoveMapFactories (RosettaScripts)</a></p>\n<h3 id=\"Instantiation-configuration\"><a href=\"#Instantiation-configuration\" class=\"headerlink\" title=\"Instantiation & configuration\"></a>Instantiation & configuration</h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Establish Residue Selector</span></span><br><span class=\"line\">cdr_selector = CDRResidueSelector()</span><br><span class=\"line\">cdr_selector.set_cdr(h1)</span><br><span class=\"line\"><span class=\"comment\"># h1 is a Enum imported when we imported the antibody namespace</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Instantiate a `MoveMapFactory` object named "my_mmf"</span></span><br><span class=\"line\">my_mmf = MoveMapFactory()</span><br><span class=\"line\"><span class=\"comment\"># Setup `my_mmf`</span></span><br><span class=\"line\">my_mmf.add_bb_action(mm_enable, cdr_selector)</span><br><span class=\"line\">my_mmf.add_chi_action(mm_enable, cdr_selector) </span><br><span class=\"line\"><span class=\"comment\"># mm_enable and mm_disable are Enums (numbered variables) that </span></span><br><span class=\"line\"><span class=\"comment\"># come when we import the MMF.</span></span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Check-the-MoveMapFactory-settings\"><a href=\"#Check-the-MoveMapFactory-settings\" class=\"headerlink\" title=\"Check the MoveMapFactory settings\"></a>Check the <code>MoveMapFactory</code> settings</h3><p>Based on the <code>MoveMapFactory</code>, we can create a <code>MoveMap</code>object from a <code>Pose</code>object, and thus we can check the settings.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Instantiate a `MoveMap` object from `my_mmf`</span></span><br><span class=\"line\"><span class=\"comment\"># We need to pass in a `Pose` object (`my_pose`)</span></span><br><span class=\"line\">my_mm = my_mmf.create_movemap_from_pose(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Inspect my_mm</span></span><br><span class=\"line\"><span class=\"built_in\">print</span>(my_mm)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Basic-Setup-of-Regional-FastRelax\"><a href=\"#Basic-Setup-of-Regional-FastRelax\" class=\"headerlink\" title=\"Basic Setup of Regional FastRelax\"></a>Basic Setup of Regional <code>FastRelax</code></h3><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `FastRelax` object called `my_fr`</span></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `MoveMapFactory` object called `my_mmf`</span></span><br><span class=\"line\">my_fr.set_movemap_factory(my_mmf)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `TaskFactory` object called `pack_cdrs_and_neighbors_tf`</span></span><br><span class=\"line\">my_fr.set_task_factory(pack_cdrs_and_neighbors_tf)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a default ref2015 full atom score function</span></span><br><span class=\"line\">my_fr.set_scorefxn(my_scorefxn)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object called `my_pose`</span></span><br><span class=\"line\"><span class=\"comment\"># Finally, we can apply the `my_fr` to `my_pose`:</span></span><br><span class=\"line\">my_fr.apply(my_pose)</span><br></pre></td></tr></table></figure>\n\n<h3 id=\"Optimization\"><a href=\"#Optimization\" class=\"headerlink\" title=\"Optimization\"></a>Optimization</h3><p>Basic Setup may cause large conformation shifts that we don’t want.</p>\n<p>We can tackle this problem by using a different score function, OR by customizing the <code>FoldTree</code>.</p>\n<p>(Not both)</p>\n<h4 id=\"Cartesian-space-refinement-ref2015-cart\"><a href=\"#Cartesian-space-refinement-ref2015-cart\" class=\"headerlink\" title=\"Cartesian-space refinement ref2015_cart\"></a>Cartesian-space refinement <code>ref2015_cart</code></h4><figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Create score function specified for Cartesian</span></span><br><span class=\"line\">cart_sf = create_score_function(<span class=\"string\">"ref2015_cart"</span>)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `MoveMapFactory` object called `my_mmf`</span></span><br><span class=\"line\">my_mmf.set_cartesian(<span class=\"literal\">True</span>) <span class=\"comment\"># Turn "Cartesian mode" on.</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `FastRelax` object called `my_fr`</span></span><br><span class=\"line\">my_fr.set_movemap_factory(my_mmf)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Use `cart_sf` as the score function for FastRelax</span></span><br><span class=\"line\">my_fr.set_scorefxn(cart_sf)</span><br><span class=\"line\">my_fr.cartesian(<span class=\"literal\">True</span>)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#This is a general recommendation for cartesian minimization - it lowers the number of maximum cycles.</span></span><br><span class=\"line\"><span class=\"comment\"># More than this only increases time of protocol, but has little effect on energies/structure</span></span><br><span class=\"line\">fr.max_iter(<span class=\"number\">200</span>)</span><br></pre></td></tr></table></figure>\n\n<p>These settings are Cartesian-specifc. They are turned off by default. Turn them off under other circumstances.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br></pre></td><td class=\"code\"><pre><span class=\"line\">my_mmf.set_cartesian(<span class=\"literal\">False</span>)</span><br><span class=\"line\">my_fr.cartesian(<span class=\"literal\">False</span>)</span><br><span class=\"line\">my_fr.max_iter(<span class=\"number\">0</span>) <span class=\"comment\">#Reset to default </span></span><br></pre></td></tr></table></figure>\n\n<h4 id=\"Customizing-FoldTree-A-Classic-way\"><a href=\"#Customizing-FoldTree-A-Classic-way\" class=\"headerlink\" title=\"Customizing FoldTree (A Classic way)\"></a>Customizing <code>FoldTree</code> (A Classic way)</h4><p><font style=\"color:#DF2A3F;\">WARNING</font>: If Cartesian has been turned on, we should turn Cartesian off before using this solution.</p>\n<figure class=\"highlight python\"><table><tr><td class=\"gutter\"><pre><span class=\"line\">1</span><br><span class=\"line\">2</span><br><span class=\"line\">3</span><br><span class=\"line\">4</span><br><span class=\"line\">5</span><br><span class=\"line\">6</span><br><span class=\"line\">7</span><br><span class=\"line\">8</span><br><span class=\"line\">9</span><br><span class=\"line\">10</span><br><span class=\"line\">11</span><br><span class=\"line\">12</span><br><span class=\"line\">13</span><br><span class=\"line\">14</span><br><span class=\"line\">15</span><br><span class=\"line\">16</span><br><span class=\"line\">17</span><br><span class=\"line\">18</span><br><span class=\"line\">19</span><br><span class=\"line\">20</span><br><span class=\"line\">21</span><br><span class=\"line\">22</span><br><span class=\"line\">23</span><br><span class=\"line\">24</span><br><span class=\"line\">25</span><br><span class=\"line\">26</span><br><span class=\"line\">27</span><br><span class=\"line\">28</span><br><span class=\"line\">29</span><br><span class=\"line\">30</span><br><span class=\"line\">31</span><br><span class=\"line\">32</span><br><span class=\"line\">33</span><br><span class=\"line\">34</span><br><span class=\"line\">35</span><br><span class=\"line\">36</span><br><span class=\"line\">37</span><br><span class=\"line\">38</span><br><span class=\"line\">39</span><br><span class=\"line\">40</span><br><span class=\"line\">41</span><br><span class=\"line\">42</span><br><span class=\"line\">43</span><br><span class=\"line\">44</span><br><span class=\"line\">45</span><br></pre></td><td class=\"code\"><pre><span class=\"line\"><span class=\"comment\"># Assume that we have a `Pose` object named `my_pose`, and it is an antibody</span></span><br><span class=\"line\">ab_info = AntibodyInfo(my_pose) <span class=\"comment\"># Get antibody-specific information</span></span><br><span class=\"line\">my_ft = FoldTree() <span class=\"comment\"># Instantiate an empty FolTree</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Get CDR H1 loop parameters</span></span><br><span class=\"line\"><span class=\"comment\"># >>> #</span></span><br><span class=\"line\">start = ab_info.get_CDR_start(h1, my_pose)</span><br><span class=\"line\">stop = ab_info.get_CDR_end(h1, my_pose)</span><br><span class=\"line\">cutpoint = <span class=\"built_in\">int</span>((stop-start)/<span class=\"number\">2</span>) + start</span><br><span class=\"line\"><span class=\"comment\"># <<< #</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Define the loop</span></span><br><span class=\"line\">cdr_loop = Loop(start, stop, cutpoint)</span><br><span class=\"line\">cdr_loops = Loops()</span><br><span class=\"line\">cdr_loops.add_loop(cdr_loop)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Setup of `my_ft`</span></span><br><span class=\"line\">fold_tree_from_loops(my_pose, cdr_loops, my_ft) </span><br><span class=\"line\"></span><br><span class=\"line\">my_pose.fold_tree(my_ft)</span><br><span class=\"line\">original_ft = my_pose.fold_tree() <span class=\"comment\"># Backup the original fold tree</span></span><br><span class=\"line\">add_cutpoint_variants(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Create a default full atom score function</span></span><br><span class=\"line\">scorefxn = get_score_function()</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Add chainbreak term to `scorefxn` so we don't get wacky stuff. </span></span><br><span class=\"line\"><span class=\"comment\"># This term helps keep the peptide closed during bb movement.</span></span><br><span class=\"line\">scorefxn_ch = scorefxn <span class=\"comment\"># Copy the default score function</span></span><br><span class=\"line\">scorefxn_ch.set_weight(rosetta.core.scoring.chainbreak, <span class=\"number\">100</span>) <span class=\"comment\"># Add chainbreak term</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `FastRelax` object called `my_fr`</span></span><br><span class=\"line\">my_fr.set_scorefxn(scorefxn_ch)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Assume that we have a `MoveMap` object (with basic configurations) called `my_mmf`</span></span><br><span class=\"line\">my_fr.set_movemap_factory(my_mmf)</span><br><span class=\"line\"></span><br><span class=\"line\">my_fr.max_iter(<span class=\"number\">0</span>) <span class=\"comment\">#Reset to default </span></span><br><span class=\"line\"><span class=\"comment\"># if it's 0, then we don't set it in the MinMover that FastRelax runs</span></span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\"># Start FastRelax</span></span><br><span class=\"line\">my_fr.apply(my_pose)</span><br><span class=\"line\"></span><br><span class=\"line\"><span class=\"comment\">#Reapply the original fold tree</span></span><br><span class=\"line\">my_pose.fold_tree(original_ft)</span><br></pre></td></tr></table></figure>\n\n"}],"PostAsset":[{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1/image1.jpg","slug":"image1.jpg","post":"clso7h26s0001sguj5ypcd8po","modified":0,"renderable":0},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1/image2.png","slug":"image2.png","post":"clso7h26s0001sguj5ypcd8po","modified":0,"renderable":0},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-1/image3.png","slug":"image3.png","post":"clso7h26s0001sguj5ypcd8po","modified":0,"renderable":0},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2/filters.svg","slug":"filters.svg","post":"clso7h26v0003sguj8zlu8dqf","modified":0,"renderable":0},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2/midband ommatidia.svg","slug":"midband ommatidia.svg","post":"clso7h26v0003sguj8zlu8dqf","modified":0,"renderable":0},{"_id":"source/_posts/Notes-on-Stomatopod-s-visual-ability-2/ommatidia1.svg","slug":"ommatidia1.svg","post":"clso7h26v0003sguj8zlu8dqf","modified":0,"renderable":0}],"PostCategory":[{"post_id":"clso7h2700008sguj0ghua3aj","category_id":"clso7h26x0004sguj8btpcete","_id":"clso7h272000bsgujc7vi3mlr"},{"post_id":"clso7h26s0001sguj5ypcd8po","category_id":"clso7h26x0004sguj8btpcete","_id":"clso7h272000dsguj29sw5kdo"},{"post_id":"clso7h26v0003sguj8zlu8dqf","category_id":"clso7h26x0004sguj8btpcete","_id":"clso7h272000esgujf80qh0z5"},{"post_id":"cmekx8a7i003zcgu67fw1eqyu","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7q0045cgu6b5jd99x9"},{"post_id":"cmekx8a7l0040cgu6bl89942f","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7q0047cgu6c6zz7pyu"},{"post_id":"cmekx8a7u004ncgu6e82ggme8","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7v004tcgu60v2dft5j"},{"post_id":"cmekx8a7u004ocgu68vm47ter","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7w004wcgu6e5qneu0i"},{"post_id":"cmekx8a7v004qcgu6hfq56d9p","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7w004zcgu63cc6ak0m"},{"post_id":"cmekx8a7v004scgu63t0qakzd","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7w0052cgu6gmbn0erx"},{"post_id":"cmekx8a7v004vcgu6favheh8g","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7x0054cgu69qju47ay"},{"post_id":"cmekx8a7w004ycgu6hl09em1m","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7x0056cgu6fgnm1ptq"},{"post_id":"cmekx8a7w0051cgu614t9h3vb","category_id":"cmekx8a7p0041cgu6esfn1cr9","_id":"cmekx8a7x0058cgu668mk57ua"}],"PostTag":[{"post_id":"clso7h26s0001sguj5ypcd8po","tag_id":"clso7h26y0005sgujgh87bt9f","_id":"clso7h273000hsguj5y93h8jn"},{"post_id":"clso7h26s0001sguj5ypcd8po","tag_id":"clso7h271000asguj30bw0zz2","_id":"clso7h273000isgujckbwdn29"},{"post_id":"clso7h26s0001sguj5ypcd8po","tag_id":"clso7h272000csgujf5c350fx","_id":"clso7h273000ksgujb44z6z2v"},{"post_id":"clso7h26s0001sguj5ypcd8po","tag_id":"clso7h272000fsgujfry54btz","_id":"clso7h273000lsgujcn8q6zhh"},{"post_id":"clso7h26v0003sguj8zlu8dqf","tag_id":"clso7h26y0005sgujgh87bt9f","_id":"clso7h274000psgujdnzr6gxt"},{"post_id":"clso7h26v0003sguj8zlu8dqf","tag_id":"clso7h271000asguj30bw0zz2","_id":"clso7h274000qsguj7di4c93e"},{"post_id":"clso7h26v0003sguj8zlu8dqf","tag_id":"clso7h272000csgujf5c350fx","_id":"clso7h274000ssgujgy2f8q0y"},{"post_id":"clso7h26v0003sguj8zlu8dqf","tag_id":"clso7h272000fsgujfry54btz","_id":"clso7h274000tsgujb5y3e3bv"},{"post_id":"clso7h2700008sguj0ghua3aj","tag_id":"clso7h26y0005sgujgh87bt9f","_id":"clso7h274000vsguj4i0hgd8l"},{"post_id":"clso7h2700008sguj0ghua3aj","tag_id":"clso7h271000asguj30bw0zz2","_id":"clso7h274000wsguj2hey2ykf"},{"post_id":"clso7h2700008sguj0ghua3aj","tag_id":"clso7h272000csgujf5c350fx","_id":"clso7h274000xsguj9ohpgyxa"},{"post_id":"clso7h2700008sguj0ghua3aj","tag_id":"clso7h272000fsgujfry54btz","_id":"clso7h274000ysguj92f5f8e6"},{"post_id":"cmekx8a7i003zcgu67fw1eqyu","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7r004acgu67fh49dth"},{"post_id":"cmekx8a7i003zcgu67fw1eqyu","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7r004bcgu6d5i4hb75"},{"post_id":"cmekx8a7i003zcgu67fw1eqyu","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7r004dcgu68bcc98jr"},{"post_id":"cmekx8a7i003zcgu67fw1eqyu","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7r004ecgu69luba5pf"},{"post_id":"cmekx8a7i003zcgu67fw1eqyu","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7r004gcgu68bkieb46"},{"post_id":"cmekx8a7l0040cgu6bl89942f","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7r004icgu61cj2c87u"},{"post_id":"cmekx8a7l0040cgu6bl89942f","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7r004jcgu6cvcg1nnn"},{"post_id":"cmekx8a7l0040cgu6bl89942f","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7r004kcgu69thl6k09"},{"post_id":"cmekx8a7l0040cgu6bl89942f","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7r004lcgu62humbxrt"},{"post_id":"cmekx8a7l0040cgu6bl89942f","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7s004mcgu60t832lum"},{"post_id":"cmekx8a7u004ncgu6e82ggme8","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7v004pcgu6fym3f9zr"},{"post_id":"cmekx8a7u004ncgu6e82ggme8","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7v004rcgu68pk94ta1"},{"post_id":"cmekx8a7u004ncgu6e82ggme8","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7v004ucgu62y4ady0j"},{"post_id":"cmekx8a7u004ncgu6e82ggme8","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7w004xcgu65wwi45at"},{"post_id":"cmekx8a7u004ncgu6e82ggme8","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7w0050cgu6egpga3k0"},{"post_id":"cmekx8a7u004ocgu68vm47ter","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7w0053cgu635qnh6bj"},{"post_id":"cmekx8a7u004ocgu68vm47ter","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7x0055cgu6fkatbe0o"},{"post_id":"cmekx8a7u004ocgu68vm47ter","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7x0057cgu64pwraclu"},{"post_id":"cmekx8a7u004ocgu68vm47ter","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7x0059cgu61vwv5dh0"},{"post_id":"cmekx8a7u004ocgu68vm47ter","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7x005acgu6f4s7ataq"},{"post_id":"cmekx8a7v004qcgu6hfq56d9p","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7x005bcgu6h0k2h3u1"},{"post_id":"cmekx8a7v004qcgu6hfq56d9p","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7x005ccgu69tmo01uj"},{"post_id":"cmekx8a7v004qcgu6hfq56d9p","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7x005dcgu673hg4uz7"},{"post_id":"cmekx8a7v004qcgu6hfq56d9p","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7x005ecgu6d7hn3fyp"},{"post_id":"cmekx8a7v004qcgu6hfq56d9p","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7x005fcgu65yr642we"},{"post_id":"cmekx8a7v004scgu63t0qakzd","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7x005gcgu6amw28pme"},{"post_id":"cmekx8a7v004scgu63t0qakzd","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7x005hcgu6eu8b7wmp"},{"post_id":"cmekx8a7v004scgu63t0qakzd","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7x005icgu6gdkkd3o1"},{"post_id":"cmekx8a7v004scgu63t0qakzd","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7x005jcgu6bbbs4bqr"},{"post_id":"cmekx8a7v004scgu63t0qakzd","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7x005kcgu6f3204fs3"},{"post_id":"cmekx8a7v004vcgu6favheh8g","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7x005lcgu687mm8n19"},{"post_id":"cmekx8a7v004vcgu6favheh8g","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7x005mcgu6334e8466"},{"post_id":"cmekx8a7v004vcgu6favheh8g","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7x005ncgu691kche1i"},{"post_id":"cmekx8a7v004vcgu6favheh8g","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7x005ocgu6acofhvzm"},{"post_id":"cmekx8a7w004ycgu6hl09em1m","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7x005pcgu6c6i64num"},{"post_id":"cmekx8a7w004ycgu6hl09em1m","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7x005qcgu6d6pv7mfi"},{"post_id":"cmekx8a7w004ycgu6hl09em1m","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7x005rcgu65vc60is2"},{"post_id":"cmekx8a7w004ycgu6hl09em1m","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7x005scgu63ylw9eyp"},{"post_id":"cmekx8a7w004ycgu6hl09em1m","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7x005tcgu6cu5759c5"},{"post_id":"cmekx8a7w0051cgu614t9h3vb","tag_id":"cmekx8a7q0046cgu64zx17zyd","_id":"cmekx8a7x005ucgu64odv7yaa"},{"post_id":"cmekx8a7w0051cgu614t9h3vb","tag_id":"cmekx8a7q0044cgu6e07aasfl","_id":"cmekx8a7x005vcgu61kf887rv"},{"post_id":"cmekx8a7w0051cgu614t9h3vb","tag_id":"cmekx8a7q0048cgu6c0b3b8da","_id":"cmekx8a7x005wcgu6ftvh6ic9"},{"post_id":"cmekx8a7w0051cgu614t9h3vb","tag_id":"cmekx8a7p0042cgu6b3pneiut","_id":"cmekx8a7x005xcgu62qzuhls6"},{"post_id":"cmekx8a7w0051cgu614t9h3vb","tag_id":"clso7h272000fsgujfry54btz","_id":"cmekx8a7y005ycgu6844lbkux"}],"Tag":[{"name":"mantis shrimp","_id":"clso7h26y0005sgujgh87bt9f"},{"name":"vision","_id":"clso7h271000asguj30bw0zz2"},{"name":"neuroscience","_id":"clso7h272000csgujf5c350fx"},{"name":"note","_id":"clso7h272000fsgujfry54btz"},{"name":"PyRosetta","_id":"cmekx8a7p0042cgu6b3pneiut"},{"name":"biochemistry","_id":"cmekx8a7q0044cgu6e07aasfl"},{"name":"protein","_id":"cmekx8a7q0046cgu64zx17zyd"},{"name":"protein design","_id":"cmekx8a7q0048cgu6c0b3b8da"}]}}