1616# documentation: http://packages.python.org/bioservices
1717#
1818##############################################################################
19- #$Id$
2019"""Interface to some part of the UniProt web service
2120
2221.. topic:: What is UniProt ?
5049
5150from bs4 import BeautifulSoup
5251from bioservices .services import REST
53- from bioservices .xmltools import readXML , HTTPError
52+ from bioservices .xmltools import readXML
5453
5554
5655__all__ = ["BioCarta" ]
@@ -108,7 +107,8 @@ def _get_organism(self):
108107
109108 def _set_organism (self , organism ):
110109 organism = organism [:1 ].upper () + organism [1 :].lower ()
111- if organism == self ._organism : return
110+ if organism == self ._organism :
111+ return
112112 if organism not in BioCarta .organisms :
113113 raise ValueError ("Invalid organism. Check the list in :attr:`organisms` attribute" )
114114
@@ -120,7 +120,7 @@ def _set_organism(self, organism):
120120
121121 def _get_pathway_categories (self ):
122122 if self ._pathway_categories is None :
123- self ._pathway_categories = self .services .http_get_ou_post ()
123+ self ._pathway_categories = self .services .http_get
124124 return self ._pathway_categories
125125 pathway_categories = property (_get_pathway_categories )
126126
@@ -160,7 +160,7 @@ def get_pathway_protein_names(self, pathway):
160160
161161
162162 """
163- self .logging .info ("Fetching the pathway" )
163+ self .services . logging .info ("Fetching the pathway" )
164164 # first identify gene from GeneInfo tag
165165 # this is not XML but HTML
166166 url = "http://cgap.nci.nih.gov/Pathways/BioCarta/%s" % pathway
@@ -171,7 +171,7 @@ def get_pathway_protein_names(self, pathway):
171171
172172 links = set ([link .attrs ['href' ] for link in links ])
173173
174- self .logging .info ("Scanning information about %s genes" % len (links ))
174+ self .services . logging .info ("Scanning information about %s genes" % len (links ))
175175 # open each page and get info
176176 genes = {}
177177 for link in links :
@@ -181,19 +181,22 @@ def get_pathway_protein_names(self, pathway):
181181 table_gene_info = soup .findAll ("table" )[1 ]
182182
183183 gene_name = link .rsplit ("=" , 1 )[1 ]
184- self .logging .info (" - " + gene_name )
184+ self .services . logging .info (" - " + gene_name )
185185
186186 genes [gene_name ] = {}
187187 self .tt = table_gene_info
188188 for row in table_gene_info .find_all ('tr' ):
189189 entry = row .find_all ('td' )
190- try :key = entry [0 ].text .strip ()
191- except :continue
192- try :value = entry [1 ].text .strip ()
193- except :continue
190+ try :
191+ key = entry [0 ].text .strip ()
192+ except :
193+ continue
194+ try :
195+ value = entry [1 ].text .strip ()
196+ except :
197+ continue
194198 if "[Text]" in key :
195199 continue
196200 genes [gene_name ][key ] = value
197201
198-
199202 return genes
0 commit comments