pybiomart icon indicating copy to clipboard operation
pybiomart copied to clipboard

Error querying biomart

Open joseph-siefert opened this issue 1 year ago • 3 comments

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

joseph-siefert avatar Jan 15 '24 18:01 joseph-siefert

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

tnnandi avatar Jan 24 '24 01:01 tnnandi

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?

ewalsh396 avatar Feb 09 '24 00:02 ewalsh396

Hi, I'm getting a similar error:

ParseError: mismatched tag: line 56, column 2

Did you solve this?

skoturan avatar Sep 03 '24 15:09 skoturan