Пример #1
0
    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]
Пример #2
0
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)
Пример #3
0
    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]
Пример #4
0
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)
Пример #5
0
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()))
Пример #6
0
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()))
Пример #7
0
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)
Пример #8
0
    def get_info(self, token=None, ref=None):
        taxon_api = TaxonAPI(self.services, token, ref)
        result = taxon_api.get_info()

        return ttypes.ObjectInfo(**result)
Пример #9
0
 def get_genetic_code(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_genetic_code()
Пример #10
0
 def get_aliases(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_aliases()
Пример #11
0
 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)})
Пример #12
0
 def get_taxonomic_id(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_taxonomic_id()
Пример #13
0
 def get_scientific_name(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_scientific_name()
Пример #14
0
 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)
Пример #15
0
 def get_children(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_children(ref_only=True)
Пример #16
0
 def get_domain(self, token=None, ref=None):
     taxon_api = TaxonAPI(self.services, token, ref)
     return taxon_api.get_domain()
Пример #17
0
 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)})