Error while using pybiomart package
Entering edit mode
8 weeks ago

Hi, I am using pybiomart python package and I want to use one of the filters provided as in here. One of those filters is of type boolean_list. I am not sure how to pass the parameters while I am using a filter value of that type. I knew that it is of type boolean_list through the dataset.list_filters() method which displays the following:

enter image description here

My query is as follows:

from pybiomart import Server, Dataset
dataset=Dataset(name='hsapiens_gene_ensembl', host='')

What I am doing here is that I am passing a as the value for the corresponding filter in the filters dic. I think that I am defining a as a boolean_list (this is what I thought of). I defined a to be a list of 20 boolean values, all False except for the one that I need, I made it True. Kindly have a look on the screenshot below from the GUI of the biomart website. I want to choose With Pfam ID(s) as the value for that filter (id_list_protein_domain_and_feature_filters) The problem is that when I run that query, I get the following error:

BiomartException                          Traceback (most recent call last)
<ipython-input-19-3b59f9b0b207> in <module>()
      3 a[2]=True
      4 dataset=Dataset(name='hsapiens_gene_ensembl', host='')
----> 5 dataset.query(attributes=['uniprotswissprot'],filters={'id_list_protein_domain_and_feature_filters':a})

/usr/local/lib/python3.7/dist-packages/pybiomart/ 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)
    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

What I am trying to do is basically selecting one of the items in the Combobox ( as in the screenshot below from the biomart website GUI)

Thanks in advance.

GUI filter selection example that I want to perform through the pybiomart package

biomart pybiomart • 110 views

Login before adding your answer.

Traffic: 1818 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6