どこかで一度話題にした気もしますが、PyMOL(python?)のコマンドにはデフォでaliasという機能が組み込まれてます。簡単に言うと、コマンドラインに2,3文字入れてtabキーを叩くと、該当するコマンドを補完するか、候補のコマンドを表示してくれます。
実はこれ、自分でも作れます。
今回はこちらのページを参考にしました。
今回の内容はざっとこんな感じです。
Alias example
alias xxx, yyyみたいなコマンドを打つと、次からxxxと言うコマンドでyyyのFunctionになります。
何言ってんだよって感じなので、実際にやってみましょう。
今回参考にした文献は、たまたま読んだこちらです。
(2019) Nat Chem Biol 15: 672-680
とりあえずPDB ID: 6HR2 と6HAX, 6HAYを読み込んでおきます。
続いて、次のコマンドを実行します。
alias nice, as cartoon; show sticks, organic; show spheres, inorganic
ええ、まんまサイトからパクってます。
次にコマンド niceを実行すると…
と言う具合にalias nice, 以降のコマンドをまとめて実行してくれるわけです。
今回のコマンドは水が消えただけですね。
へぇ、それで?
ルーチンのコマンドをPyMOL>File>Edit pymolrcに書き込んで、デフォルトでエイリアス化してしまいましょう。こんな感じです。(#keetane should be replaced with your own user name)
Alias example for default setting at .pymolrc.pml
cd /Users/username/Desktop
set cartoon_transparency, 0.5
set transparency, 0.6
set surface_color, white
set sphere_scale, 0.2
set label_color, gray
alias al, alignto; zoom
alias sp, split_chains enabled; alignto; zoom
alias cc, util.color_chains("(enabled and name CA)",_self=cmd)
alias see, zoom byres organic around 8 and chain A
alias sol, as cartoon; show sticks, organic; show spheres, inorganic organic
alias del, as cartoon; show sticks, organic; show spheres, inorganic organic solvent
alias line, show lines, byres organic around 4
alias hb, select ligand, organic and enabled; cmd.dist("ligand_polar_conts","(ligand)","(byobj (ligand)) and (not (ligand))",quiet=1,mode=2,label=0,reset=1);cmd.enable("ligand_polar_conts")
alias well, show surface, byres organic expand 4
alias 5, create a5, byres organic expand 5 and enabled; disable !a5
alias 4, create a4, byres organic expand 4 and enabled; disable !a4
alias tag, label enabled and name ca, "%s%s" % (resn,resi)
alias untag, hide label
alias pick, cmd.mouse('forward')
alias ch, capture; save image.png
Practice
実際に使ってみましょう。
新たに作ったalを実行するとこんな感じです。
タンパクを重ね合わせてzoomしました。
次にccを実行して主鎖ごとに色を変えます。
さらにseeを実行してligandにzoomします。
del/solの実行で溶媒の表示を切り替えます。
今回のaliasは基本的にアクティブになっているオブジェクトに適応されるので、今は3つのオブジェクトの水が全部表示されててごちゃごちゃしてます。
disable !6HAY
で6HAY以外を非表示にします。
lineを実行して周辺残基を確認します。
hbを実行してリガンドからのpolar contactを表示します。これは、Action>find>polar contacts>to other atoms in objectと同じに設定してあります。
tag/untagの実行で側鎖のラベルの表示を切り替えます。
例えばここの水酸基はS111とH115が相互作用してそうです。
wellを実行してポケットのくぼみを観察してみます。
pickを実行してマウスモードを切り替えます。3-bottun Editingに切り替えて原子をPickしていくと、原子間距離、角度、二面角の順番に表示してくれます。
今まであんなにコマンド打ってたのはなんだったの…というくらいにはサクッと出来ました。
Hint: 今回のコマンドはsol, del, line, wellは全てのオブジェクトに適用されます。
前回記事で水分子を上手く扱えないかなぁとモヤっとしてたので、自己解決出来ました。
なるほど。