def set_taxonID(self, name): taxids = {} nameset = set([self.name, self.binomial, self.tnrs_acceptedname, self.tnrs_binomial]) if 'NA' in nameset: nameset.remove('NA') for name in nameset: taxid = genbank.get_taxid(name) taxids[name] = taxid taxid_set = set(taxids.values()) if 'NA' in taxid_set: taxid_set.remove('NA') if len(taxid_set)>1: out = json.dumps(taxids, indent=2) log.warning("More than one taxon ID found: \n%s" %taxids) self.taxid = "NA" log.info("TaxonID set to 'NA'") if len(taxid_set)==1: self.taxid = list(taxid_set)[0] log.info("TaxonID set to %s" % self.taxid) if len(taxid_set)==0: log.warning("No taxon ID found") self.taxid = "NA" log.info("TaxonID set to 'NA'")
def set_taxonID(self, name): taxids = {} nameset = set([ self.name, self.binomial, self.tnrs_acceptedname, self.tnrs_binomial ]) if 'NA' in nameset: nameset.remove('NA') for name in nameset: taxid = genbank.get_taxid(name) taxids[name] = taxid taxid_set = set(taxids.values()) if 'NA' in taxid_set: taxid_set.remove('NA') if len(taxid_set) > 1: out = json.dumps(taxids, indent=2) log.warning("More than one taxon ID found: \n%s" % taxids) self.taxid = "NA" log.info("TaxonID set to 'NA'") if len(taxid_set) == 1: self.taxid = list(taxid_set)[0] log.info("TaxonID set to %s" % self.taxid) if len(taxid_set) == 0: log.warning("No taxon ID found") self.taxid = "NA" log.info("TaxonID set to 'NA'")
def get_taxonID(self, name): taxid = genbank.get_taxid(name) return taxid