问题描述
我正在使用 pybiomart python package,我想使用 here 中提供的过滤器之一。其中一个过滤器属于 boolean_list 类型。当我使用该类型的过滤器值时,我不确定如何传递参数。
我通过 dataset.list_filters()
方法知道它是 boolean_list 类型,该方法显示以下内容:
我的查询如下:
from pybiomart import Server,Dataset
a=[False]*20
a[7]=True
dataset=Dataset(name='hsapiens_gene_ensembl',host='http://www.ensembl.org')
dataset.query(attributes=['uniprotswissprot'],filters={'id_list_protein_domain_and_feature_filters':a})
我在这里所做的是将 a 作为 filters dic 中相应过滤器的值传递。我认为我将 a 定义为一个 boolean_list(这是我的想法)。我将 a 定义为一个包含 20 个布尔值的列表,所有 False
除了我需要的那个,我使它成为 True
。请从 biomart 网站的 GUI 中查看下面的屏幕截图。我想选择 With Pfam ID(s) 作为该过滤器的值 (id_list_protein_domain_and_feature_filters)
问题是,当我运行该查询时,出现以下错误:
---------------------------------------------------------------------------
biomartException Traceback (most recent call last)
<ipython-input-19-3b59f9b0b207> in <module>()
3 a[2]=True
4 dataset=Dataset(name='hsapiens_gene_ensembl',host='http://www.ensembl.org')
----> 5 dataset.query(attributes=['uniprotswissprot'],filters={'id_list_protein_domain_and_feature_filters':a})
/usr/local/lib/python3.7/dist-packages/pybiomart/dataset.py in query(self,attributes,filters,only_unique,use_attr_names)
264 # Raise exception if an error occurred.
265 if 'Query ERROR' in response.text:
--> 266 raise biomartException(response.text)
267
268 # Parse results into a DataFrame.
biomartException: Query ERROR: caught biomart::Exception::Database: Error during query execution: You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ' ensembl_mart_103.hsapiens_gene_ensembl__translation__main main WHERE (. 'False' at line 1
我想要做的基本上是选择组合框中的项目之一(如下面的 biomart 网站 GUI 屏幕截图所示) 提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)