docs: def write_taxonomy_and_seqinfo_files(self, taxonomies, output_taxonomy_file, output_seqinfo_file):
          '''Write out taxonomy and seqinfo files as required by taxtastic
          from known taxonomies
          
          Parameters
          ----------
          taxonomies:
              hash of taxon_id to array of taxonomic information
          output_taxonomy_file:
              write taxtastic-compatible 'taxonomy' file here
          output_seqinfo_file:
              write taxtastic-compatible 'seqinfo' file here'''
          
          first_pass_id_and_taxonomies = []
          tc=TaxonomyCleaner()
          max_number_of_ranks = 0
          
          for taxon_id, tax_split in taxonomies.iteritems():
              # Replace spaces with underscores e.g. 'Candidatus my_genus'
              for idx, item in enumerate(tax_split):
                  tax_split[idx] = re.sub('\s+', '_', item.strip())
  
              # Remove 'empty' taxononomies e.g. 's__'
              tax_split = tc.remove_empty_ranks(tax_split)
  
              # Add this fixed up list to the list
              first_pass_id_and_taxonomies.append([taxon_id]+tax_split)
  
              if len(tax_split) > max_number_of_ranks:
                  max_number_of_ranks = len(tax_split)
  
          # Find taxons that have multiple parents, building a hash of parents as we go (i.e. a tree of taxonomies embedded in a hash)
          #
          # Assumes that no two taxonomic labels are the same when they are from different
          # taxonomic levels. When there are children with multiple parents at the
          # same taxonomic label then these are warned about and worked around.
          parents = {} #hash of taxon to immediate parent
          known_duplicates = sets.Set([])
          for j, array in enumerate(first_pass_id_and_taxonomies):
              taxonomy = array[1:]
              for i, tax in enumerate(taxonomy):
                  if i==0: continue #top levels don't have parents
                  ancestry = taxonomy[i-1]
                  if parents.has_key(tax):
                      if parents[tax] != ancestry:
  
                          dup = "%s%s" %(parents[tax], ancestry)
                          # don't report the same problem several times
                          if dup not in known_duplicates:
                              print " %s '%s' with multiple parents %s and %s" % (array[0], tax, parents[tax], ancestry)
                              known_duplicates.add(dup)
  
                          # fix the current one
                          new_name_id = 1
                          new_name = "%se%s" % (tax, new_name_id)
  
                          while parents.has_key(new_name) and parents[new_name] != ancestry:
                              new_name_id += 1
                              new_name = "%se%s" % (tax, new_name_id)
  
                          first_pass_id_and_taxonomies[j][i+1] = new_name
                          taxonomy[i] = new_name
                          parents[new_name] = ancestry
                  else:
                      # normal case, seeing a new taxon and parent for the first time
  
                      parents[tax] = ancestry
  
          # Write the sequence file
          with open(output_seqinfo_file, 'w') as seqout:
              # write header
              seqout.write('seqname,tax_id\n')
              # write each taxonomic association
              for array in first_pass_id_and_taxonomies:
                  sequence_id = array[0]
                  if len(array)==1:
                      most_specific_taxonomic_affiliation = 'Root'
                  else:  
                      most_specific_taxonomic_affiliation = array[-1]
  
                  seqout.write("%s,%s\n" % (array[0], 
                                            most_specific_taxonomic_affiliation))
  
          # Write the taxonomy file
          noted_taxonomies = sets.Set([])
          taxonomic_level_names = ["rank_%i" % rank for rank in range(max_number_of_ranks)]
          with open(output_taxonomy_file, 'w') as seqout:
              # write header and root line
              seqout.write(','.join(['tax_id','parent_id','rank','tax_name','root'] + taxonomic_level_names) +'\n')
              seqout.write(','.join(['Root','Root','root','Root','Root'])+ ''.join([',']*max_number_of_ranks) + '\n')
              # write all the taxonomies
              for array in first_pass_id_and_taxonomies:
                  taxons = array[1:]
                  for i, tax in enumerate(taxons):
                      line = self._taxonomy_line(i, taxons[:(i+1)], taxonomic_level_names)
                      if line not in noted_taxonomies:
                          seqout.write(line+"\n")
                          noted_taxonomies.add(line)