This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error while using pybiomart package

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
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})

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='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

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

0 answers

No answers yet.

Log in to answer this question.