如何在 vs 代码中使用 sysargv 模块?
How to use sysargv module in vs code?
我一直在尝试根据分子与参考分子的结构相似性来过滤分子数据库,但脚本无法正常工作,因为 od 警告 'An exception has occurred, use %tb to see the full traceback.' 我在 vs code 中使用 jupyter notebook。
问题中的行是:
如果 len(sys.argv)!=5 :
sys.exit("用法: python tetheredMinimization.py reference.sdf output1.sdf outputtethered.sdf outputnontethered.sdf")
import sys
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem import rdFMCS
from rdkit.Chem.rdMolAlign import AlignMol
if len(sys.argv)!=5 :
sys.exit("usage : python tetheredMinimization.py reference.sdf output1.sdf outputtethered.sdf
outputnontethered.sdf")
ratioThreshold=0.20
reference = Chem.MolFromMolFile(sys.argv[1], removeHs=True)
ligands = Chem.SDMolSupplier(sys.argv[2],removeHs=True)
w=Chem.SDWriter(sys.argv[3])
wnt=Chem.SDWriter(sys.argv[4])
如果您正在使用 Jupyter,您可能不想使用 sys.argv
,这通常用于检索 command-line arguments。在 Jupyter 中使用,您很可能会得到用于启动 IPython 的参数,这也可能不满足 len(sys.argv) == 5
。与其使用它,不如在代码中定义您的参数,并将您使用的所有地方 sys.argv
替换为正确的变量。
我一直在尝试根据分子与参考分子的结构相似性来过滤分子数据库,但脚本无法正常工作,因为 od 警告 'An exception has occurred, use %tb to see the full traceback.' 我在 vs code 中使用 jupyter notebook。
问题中的行是:
如果 len(sys.argv)!=5 :
sys.exit("用法: python tetheredMinimization.py reference.sdf output1.sdf outputtethered.sdf outputnontethered.sdf")
import sys from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Chem import rdFMCS from rdkit.Chem.rdMolAlign import AlignMol
if len(sys.argv)!=5 :
sys.exit("usage : python tetheredMinimization.py reference.sdf output1.sdf outputtethered.sdf outputnontethered.sdf")ratioThreshold=0.20
reference = Chem.MolFromMolFile(sys.argv[1], removeHs=True)
ligands = Chem.SDMolSupplier(sys.argv[2],removeHs=True)w=Chem.SDWriter(sys.argv[3]) wnt=Chem.SDWriter(sys.argv[4])
如果您正在使用 Jupyter,您可能不想使用 sys.argv
,这通常用于检索 command-line arguments。在 Jupyter 中使用,您很可能会得到用于启动 IPython 的参数,这也可能不满足 len(sys.argv) == 5
。与其使用它,不如在代码中定义您的参数,并将您使用的所有地方 sys.argv
替换为正确的变量。