def get_provenance(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) result = taxon_api.get_provenance() self.logger.info(result) return [ttypes.ObjectProvenanceAction(**x) for x in result]
def setup(): shared.setup() global t_new, t_new_e, t_old, t_old_e t_new = TaxonAPI(shared.services, shared.token, taxon_new) t_new_e = _Prototype(shared.services, shared.token, taxon_new) t_old = TaxonAPI(shared.services, shared.token, taxon_old) t_old_e = _KBaseGenomes_Genome(shared.services, shared.token, taxon_old)
def get_history(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) result = taxon_api.get_history() self.logger.info(result) return [ttypes.ObjectInfo(**x) for x in result]
def setup(): shared.setup() global t_new, t_new_e, t_old, t_old_e, t_client_new, t_client_old t_new = TaxonAPI(shared.services, shared.token, taxon_new) t_new_e = _Taxon(shared.services, shared.token, taxon_new) t_old = TaxonAPI(shared.services, shared.token, taxon_old) t_old_e = _KBaseGenomes_Genome(shared.services, shared.token, taxon_old) _log.info("Connecting to Taxon Thrift Service at {}".format(shared.services["taxon_service_url"])) t_client_new = TaxonClientAPI(shared.services["taxon_service_url"], shared.token, taxon_new) t_client_old = TaxonClientAPI(shared.services["taxon_service_url"], shared.token, taxon_old)
def fetch_and_print_taxon(ws_url='https://ci.kbase.us/services/ws/'): """Fetch Taxon from Workspace Service. Args: ws_url (str): a service address or a local directory containing a downloaded version of the data created with the ``dump_wsfile`` utility. """ # Initialize API with target object taxon_ref = 'ReferenceTaxons/242159_taxon' # Try to connect to remote service taxon = TaxonAPI(token=os.environ.get('KB_AUTH_TOKEN'), ref=taxon_ref, services={'workspace_service_url': ws_url}) # Now the methods of the instance can be used to fetch and show # taxonomic information print('Got taxon "{} ({})"'.format(taxon.get_scientific_name(), taxon.get_taxonomic_id()))
def test_bogus_type(): inputs = ["Bogus", "ReferenceGenomeAnnotations/kb|g.166819", "ReferenceGenomeAnnotations/kb|g.166819_assembly", "OriginalReferenceGenomes/kb|g.166819.contigset"] _log.info("Input {}".format(inputs)) for x in inputs: try: t = TaxonAPI(shared.services, shared.token, x) except Exception, e: assert isinstance(e, TypeError)
def get_info(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) result = taxon_api.get_info() return ttypes.ObjectInfo(**result)
def get_genetic_code(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_genetic_code()
def get_aliases(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_aliases()
def get_domain(self, token=None, ref=None): try: taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_domain() except Exception, e: raise ttypes.ServiceException(e.message, traceback.print_exc(), "get_domain", {"ref": str(ref)})
def get_taxonomic_id(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_taxonomic_id()
def get_scientific_name(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_scientific_name()
def get_genome_annotations(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_genome_annotations(ref_only=True)
def get_children(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_children(ref_only=True)
def get_domain(self, token=None, ref=None): taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_domain()
def get_genome_annotations(self, token=None, ref=None): try: taxon_api = TaxonAPI(self.services, token, ref) return taxon_api.get_genome_annotations(ref_only=True) except Exception, e: raise ttypes.ServiceException(e.message, traceback.print_exc(), "get_genome_annotation", {"ref": str(ref)})