Another question

Issue #13 resolved
Former user created an issue

Hi,
I'm running the following code on the attached file

with open(synonym_filename,encoding='utf8', errors='ignore') as filehandle:
    taxonset = file_csv.load_synonyms(filehandle, synnamefield='Name', synauthfield='Author',
                                      accnamefield='Accepted_name', accauthfield='Accepted_author', get_info=True)

And I'm getting the error below. I tried debugging a little but I didn't quite understand how to overcome the problem.
Is this a bug or am I missing something?

Thanks

Traceback (most recent call last):
  File "D:\moshe\Dropbox\Dropbox\University\ploidb_src\chromcount\create_schema.py", line 628, in <module>
    log_file = input_tuple[4],authfield=authority)
  File "D:\moshe\Dropbox\Dropbox\University\ploidb_src\chromcount\name_resolve.py", line 160, in write_synonym_results
    accnamefield='Accepted_name', accauthfield='Accepted_author', get_info=True)
  File "C:\Python33\lib\site-packages\taxonome\taxa\file_csv.py", line 179, in load_synonyms
    taxonset.add(tax)
  File "C:\Python33\lib\site-packages\taxonome\taxa\collection.py", line 193, in add
    self._del_qname(taxon.name)
  File "C:\Python33\lib\site-packages\taxonome\taxa\collection.py", line 234, in _del_qname
    raise KeyError(qname)
KeyError: taxonome.Name("Huperzia pulcherrima", "(Wall.) T. Sen & U. Sen")

Comments (7)

  1. Thomas Kluyver

    That looks like a bug. When it adds a taxon to the collection, it adds its names to an index. If its accepted name is already in the index for another taxon, it removes the previous copy of the name, and puts the new copy in place instead. Somehow, it's determining that the name is already in the index, but when it comes to remove it, it's not finding it. I'll have a look into it this evening.

  2. Thomas Kluyver

    With a particular pair of authority names, the fuzzy comparison was returning a different result for a==b and b==a. The comparison mechanism seemed like a good idea at the time, but now it seems overly complicated. For the time being, I've replaced it with a much simpler comparison - it may miss some authority matches that it previously found, but it's much more predictable.

  3. Moshe Einhorn

    Hi Thomas, I work at the same lab with Lior and also encountered this problem. After updating the code from the collection2 branch and running taxonome again on the same data set I get a slightly different error:

    2013-06-20 10:21:51,601 ERROR Exception caught while processing C:\temp\names\newzealand40-names.csv C:\temp\names\newzealand40-mapping.csv
    Traceback (most recent call last):
      File "D:\moshe\Dropbox\Dropbox\University\ploidb_src\chromcount\create_schema.py", line 733, in <module>
        log_file = input_tuple[4],authfield=authority)
      File "D:\moshe\Dropbox\Dropbox\University\ploidb_src\chromcount\name_resolve.py", line 175, in write_synonym_results
        run_match_taxa (input_taxa,taxonset, tracker=trackers,nameselector=name_selector.NameSelector())
      File "C:\Python33\lib\site-packages\taxonome\taxa\collection.py", line 471, in run_match_taxa
        for taxonpair in streaming_match_taxa(taxa, target, **kwargs):
      File "C:\Python33\lib\site-packages\taxonome\taxa\collection.py", line 457, in streaming_match_taxa
        t2 = target.select(taxon.name, tracker=tracker, **kwargs)
      File "C:\Python33\lib\site-packages\taxonome\taxa\collection.py", line 143, in select
        for n, an, tid in possnames:
    ValueError: need more than 2 values to unpack
    

    Regards, Moshe

  4. Thomas Kluyver

    Thanks, I'd missed a change I needed to make. It should be fixed now, but let me know if not.

  5. Log in to comment