How to use the bioservices.services.BioServicesError function in bioservices

To help you get started, we’ve selected a few bioservices examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cokelaer / bioservices / attic / geneprof.py View on Github external
dictionaries. Each dictionary corresponds to one experiment.

        .. doctest::

            from bioservices import GeneProf
            g = GeneProf(verbose=False)
            experiments = g.get_list_experiments(with_outputs=True)

        """
        frmt = self._check_format(frmt)
        params = {}
        for key in kargs.keys():
            if key not in ["with_ats", "with_samples", "with_inputs",
                    "with_outputs", "with_workflow", "with_all_data",
                    "only_user_experiments", "key"]:
                raise BioServicesError("invalid parameter (%s) provided" % key)
            params[key] = kargs.get(key)

        params = self._clean_parameters(params)

        res =self.http_get("exp/list." + frmt, frmt=frmt, params=params)
        if frmt == "json":
            try:
                res = res['experiments']
            except:
                pass
        return res
github cokelaer / bioservices / src / bioservices / kegg.py View on Github external
s.list("hsa")                 # returns the entire list of human genes
            s.list("T01001")              # same as above
            s.list("hsa:10458+ece:Z5100") # returns the list of a human gene and an E.coli O157 gene
            s.list("cpd:C01290+gl:G00092")# returns the list of a compound entry and a glycan entry
            s.list("C01290+G00092")       # same as above
        """
        url = "list"
        if query:
            #can be something else than a database so we can not use checkDB
            #self._checkDB(database, mode="list")
            url += "/" + query

        if organism:
            if organism not in self.organismIds:
                self.logging.error("""Invalid organism provided (%s). See the organismIds attribute""" % organism)
                raise BioServicesError("Not a valid organism")
            if query not in ["pathway", "module"]:
                self.logging.error("""
    If organism is set, then the first argument
    (database) must be either 'pathway' or 'module'. You provided %s""" % query)
                raise
            url += "/" + organism

        res = self.http_get(url, "txt")
        return res
github cokelaer / bioservices / attic / geneprof.py View on Github external
def _check_id(self, Id):
        try:
            Id = int(Id)
        except:
            pass
        if Id not in self.ids_exp and Id not in self.rigid_ids_exp:
            raise BioServicesError("Incorrect ids provides. See ids and rigid_ids attributes.")
github cokelaer / bioservices / attic / geneprof.py View on Github external
def _check_kargs(self, kargs, valid_keys):
        for key in kargs.keys():
            if key not in valid_keys:
                raise BioServicesError("invalid parameter (%s) provided" % key)
github cokelaer / bioservices / attic / geneprof.py View on Github external
def _check_reference(self, ref):
        if ref not in self.valid_species:
            raise BioServicesError("Incorrect reference. check attribute :attr:`valid_species`.")