cokelaer / bioservices

Access to Biological Web Services from Python.

Home Page:http://bioservices.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in parse_kgml_pathway -- examples/plot_kegg_relations.py

timbitz opened this issue · comments

Hi, I'm getting an error when I try the sample code in examples/plot_kegg_relations.py. It seems the parse_kgml_pathway() function is the culprit. Am I missing something?

from pylab import *

from bioservices.kegg import KEGG
s = KEGG()
s.organism = "hsa"

# retrieve more than 260 pathways so it takes time
max_pathways = 10
results = [s.parse_kgml_pathway(x) for x in s.pathwayIds[0:max_pathways]]

FeatureNotFound Traceback (most recent call last)
/local/28743564/ipykernel_22028/583790337.py in
7 # retrieve more than 260 pathways so it takes time
8 max_pathways = 10
----> 9 results = [s.parse_kgml_pathway(x) for x in s.pathwayIds[0:max_pathways]]

/local/28743564/ipykernel_22028/583790337.py in (.0)
7 # retrieve more than 260 pathways so it takes time
8 max_pathways = 10
----> 9 results = [s.parse_kgml_pathway(x) for x in s.pathwayIds[0:max_pathways]]

~/.conda/envs/mlenv/lib/python3.7/site-packages/bioservices/kegg.py in parse_kgml_pathway(self, pathwayId, res)
1070 # Fixing bug #24 assembla
1071 if res is None:
-> 1072 res = self.easyXML(self.get(pathwayId, "kgml"))
1073 else:
1074 res = self.easyXML(res)

~/.conda/envs/mlenv/lib/python3.7/site-packages/bioservices/services.py in easyXML(self, res)
213 from bioservices import xmltools
214
--> 215 return xmltools.easyXML(res)
216
217 def str(self):

~/.conda/envs/mlenv/lib/python3.7/site-packages/bioservices/xmltools.py in init(self, data, encoding)
81 self.root = self.data[:]
82 self._soup = None
---> 83 self.prettify = self.soup.prettify
84 self.findAll = self.soup.findAll
85

~/.conda/envs/mlenv/lib/python3.7/site-packages/bioservices/xmltools.py in _get_soup(self)
93 def _get_soup(self):
94 if self._soup is None:
---> 95 self._soup = bs4.BeautifulSoup(self.data, "lxml")
96 return self._soup
97

~/.conda/envs/mlenv/lib/python3.7/site-packages/bs4/init.py in init(self, markup, features, builder, parse_only, from_encoding, exclude_encodings, element_classes, **kwargs)
246 "Couldn't find a tree builder with the features you "
247 "requested: %s. Do you need to install a parser library?"
--> 248 % ",".join(features))
249
250 # At this point either we have a TreeBuilder instance in

FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

That is strange indeed. I see you are using conda. Have you installed bioservices using conda or pip ?
Which version of bioservices are you using ?

bioservices --version

from the command line ?

Just try again. It works with current version 1.11.2. Closing due to inactivity. I believe this issue was a temporary slow request, or issue within one of the dependency (beautiflsoup, lxml)