jrderuiter / pybiomart

A simple pythonic interface to biomart.
MIT License
55 stars 11 forks source link

Error querying biomart #23

Open joseph-siefert opened 10 months ago

joseph-siefert commented 10 months ago

Both of the following code blocks give similar errors:

from pybiomart import Server

server = Server(host='http://www.ensembl.org')

dataset = (server.marts['ENSEMBL_MART_ENSEMBL']
                 .datasets['hsapiens_gene_ensembl'])

dataset.query(attributes=['ensembl_gene_id', 'external_gene_name'],
              filters={'chromosome_name': ['1','2']})

Traceback (most recent call last):

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[12], line 5
    dataset = (server.marts['ENSEMBL_MART_ENSEMBL']

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/pybiomart/server.py:61 in marts
    self._marts = self._fetch_marts()

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/pybiomart/server.py:81 in _fetch_marts
    xml = xml_from_string(response.content)

  File /mambaforge/envs/scanpy/lib/python3.9/xml/etree/ElementTree.py:1342 in XML
    parser.feed(text)

  File <string>
ParseError: mismatched tag: line 62, column 2
from pybiomart import Dataset

dataset = Dataset(name='hsapiens_gene_ensembl',
                  host='http://www.ensembl.org')

dataset.query(attributes=['ensembl_gene_id', 'external_gene_name'],
              filters={'chromosome_name': ['1','2']})

Traceback (most recent call last):

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  Cell In[13], line 6
    dataset.query(attributes=['ensembl_gene_id', 'external_gene_name'],

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/pybiomart/dataset.py:243 in query
    attr = self.attributes[name]

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/pybiomart/dataset.py:99 in attributes
    self._filters, self._attributes = self._fetch_configuration()

  File /mambaforge/envs/scanpy/lib/python3.9/site-packages/pybiomart/dataset.py:152 in _fetch_configuration
    xml = ElementTree.fromstring(response.content)

  File /mambaforge/envs/scanpy/lib/python3.9/xml/etree/ElementTree.py:1342 in XML
    parser.feed(text)

  File <string>
ParseError: mismatched tag: line 62, column 2

Package versions:

pybiomart     0.2.0
Python     3.9.18
tnnandi commented 9 months ago

https://www.ensembl.info/category/07-status/

ewalsh396 commented 9 months ago

The blog post says that it has been fixed, but I am still getting the same error that is reported here. Does anyone else still get this error?

skoturan commented 2 months ago

Hi, I'm getting a similar error:

ParseError: mismatched tag: line 56, column 2

Did you solve this?