Commit 6208cbee by Celine Mercier

Fixes #20 and several other bugs related to that function

parent 1d4c3f99
......@@ -320,9 +320,9 @@ if __name__ == '__main__':
parent[3],parent[0],options.taxonomy._ranks[parent[1]])
localdata=True
for n in options.newname:
tx = t.split(t,':')
taxid = options.taxonomy.addPreferedName(tx[0].strip(),tx[1])
for t in options.newname:
tx = t.split(':')
taxid = options.taxonomy.addPreferedName(int(tx[1]), tx[0].strip())
print "name : %8d\t->\t%s" % (taxid,options.taxonomy.getPreferedName(taxid))
ecoTaxonomyWriter(options.ecodb,options.taxonomy,onlyLocal=True)
......
......@@ -269,7 +269,7 @@ class Taxonomy(object):
def addPreferedName(self,taxid,name):
idx = self.findIndex(taxid)
self._preferedName.append(name,'obi',idx)
self._preferedName.append([name,'obi',idx])
self._preferedidx[idx]=name
return taxid
......@@ -399,10 +399,10 @@ class EcoTaxonomyDB(Taxonomy,EcoPCRDBFile):
for t in self._taxonomy[self._localtaxon:]:
self._name.append((t[3],'scientific name',i))
i+=1
try :
self._preferedName = [(x[0],'obi',x[2])
for x in self.__ecoNameIterator(self._preferedNamesFile,noError=True)]
for x in self.__ecoNameIterator(self._preferedNamesFile)]
print >> sys.stderr, " [INFO : Preferred taxon name file found] : %d added taxa" % len(self._preferedName)
except:
print >> sys.stderr, " [INFO : Preferred taxon name file not found]"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment