题目
2254 BIOSC 1544 SEC1000 Exam #2
单项选择题
Consider the following Python code, which is meant to count the number of molecules in molecules.sdf that pass Lipinski's rule of fives: from rdkit import Chem from rdkit.Chem import AllChem, Crippen, Lipinski mols = [mol for mol in Chem.SDMolSupplier("molecules.sdf") if mol is not None] cnt = 0 for m in mols: mw = 1 if AllChem.CalcExactMolWt(m) <= 500 else 0 logp = 1 if Crippen.MolLogP(m) <= 5 else 0 hd = 1 if Lipinski.NumHDonors(m) <= 5 else 0 ha = 1 if Lipinski.NumHAcceptors(m) <= 10 else 0 num_pass = mw + logp + hd + ha # Modified rule: incorrectly rejects molecules with even one violation if num_pass == 4: cnt += 1 print(cnt) What is wrong with this code?
选项
A.The script incorrectly loads molecules because Chem.SDMolSupplier("molecules.sdf") does not return a list.
B.It incorrectly calculates molecular weight using AllChem.CalcExactMolWt(m), which is not an RDKit function.
C.It does not allow for one violation of the four criteria, which contradicts the rule’s original intent.
D.The code should be using >= instead of <= in the threshold conditions.
E.The code should count the number of violations instead of the number of passing criteria.
查看解析
标准答案
Please login to view
思路分析
Let’s break down the question and each proposed option to understand what’s faulty in this snippet.
Option 1: 'The script incorrectly loads molecules because Chem.SDMolSupplier("molecules.sdf") does not return a list.' In this code, the author converts the supplier into a list with a list comprehension: mols = [mol for mol in Chem.SDMolSupplier("molecules.sdf") if mol is not None]. RDKit’s SDMolSupplier returns an iterable generator-like object, which is perfectly valid to iterate over or to materialize into a list as done here. Therefore, this option mischar......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
The combination IF with OR is used
The following application was developed to allow a user to guess a number between 0 and 10. If a number between 0 and 10 is entered, the number is not accepted.How can this error be removed?
What is the value of the label after the button is clicked and the code is run?
The following application was developed to allow a user to guess a number between 0 and 10. If a number larger than 10 is entered, the number is accepted.How can this error be removed?
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!