2行目の構造値

2行目の構造値

スクリプトを実行した後、次の行を取得します。


 PyMOL(TM) Molecular Graphics System, Version 1.4.1.
 Copyright (c) Schrodinger, LLC.
 All Rights Reserved.

    Created by Warren L. DeLano, Ph.D. 

    PyMOL is user-supported open-source software.  Although some versions
    are freely available, PyMOL is not in the public domain.

    If PyMOL is helpful in your work or study, then please volunteer 
    support for our ongoing efforts to create open and affordable scientific
    software by purchasing a PyMOL Maintenance and/or Support subscription.

    More information can be found at "http://www.pymol.org".

    Enter "help" for a list of commands.
    Enter "help <command-name>" for information on a specific command.

 Hit ESC anytime to toggle between text and graphics.

 Command mode. No graphics front end.
 Detected 8 CPU cores.  Enabled multithreaded rendering.
PyMOL>align MHC1, MHC2
 Match: read scoring matrix.
 Match: assigning 385 x 384 pairwise scores.
 MatchAlign: aligning residues (385 vs 384)...
 ExecutiveAlign: 3810 atoms aligned.
 Executive: RMS =    0.000 (3810 to 3810 atoms)
PyMOL>sele EP1, chain M
 Selector: selection "EP1" defined with 63 atoms.
PyMOL>sele EP2, chain R
 Selector: selection "EP2" defined with 64 atoms.
PyMOL>rms_cur EP1 and n. CA, EP2 and n. CA
 Executive: RMS =    7.457 (9 to 9 atoms)
 PyMOL: normal program termination.

「実行:RMS = 7.457(9〜9原子)」行から「7.457」の値を抽出する必要があります。 「7.457」値と「9~9原子」の情報はラウンドごとに異なるため、パターンとして使用することはできません。 「Executive:RMS」は変更できませんが、上記の行の一部を繰り返します。明らかに私はいつも2番目から最後の行に値を入れます。これを使用して値を抽出できますが、Pythonまたはシェルスクリプトを使用して値を抽出する方法がわかりません。

誰でも私を助けることができますか?とても感謝しています!

しかし、私が作業しているスクリプトは次のとおりです(RMSD値を取得する特定のPyMolプログラムです)。

## RUNNING
## Importing PyMol files
from pymol.cgo import *
from pymol import cmd
from pymol import stored
# Loading MHC1
cmd.load ("MHC1.pdb")
#Change chain C to chain M (MHC1 epitope)
cmd.alter (('chain C'),'chain="M"')
# Loading MHC2
cmd.load ("MHC2.pdb")
#Change chain C to chain R (MHC2 epitope)
cmd.alter (('chain C'),'chain="R"')
## Align MHC1 and MHC2
cmd.do ("align MHC1, MHC2")
## MHC1 epitope selection (EP1)
cmd.do ("sele EP1, chain M")
## MHC2 epitope selection (EP2)
cmd.do ("sele EP2, chain R")
## Remove chain names (this is required so 'rms_cur' will work properly)
cmd.alter (("all"),'chain=""')
## Residues numbers aligned (this is required so 'rms_cur' will work properly)
cmd.alter (("all"),'segi=""')
## RMSD Calculation between EP1 and EP2
cmd.do ("rms_cur EP1 and n. CA, EP2 and n. CA")

ベストアンサー1

script | sed -n '${x;p};h'

私の考えでは、この程度は大丈夫だと思います。常に2番目から最後の行まで印刷します。

この番号だけが必要な場合は、次のことができます。

script | sed -n '${x;s/.*= *//;s/ .*//p};h'

とても大きいH 追加到着sed's スペアスペース現在のコンテンツパターン空間,そして非常に少数h 書くそれ。したがって、上書きするとスペアスペース各行について$最後の行にx変更スペアスペースそしてパターン空間,それから2番目の最後の行をカバーしています。

これは、必要なリソースをできるだけ少なく使用するため、この問題について私が想像できる最善のソリューションです。メモリには常に2つ以上の行がありません。

おすすめ記事