# Path: taxtastic/utils.py
# def get_new_nodes(fname):
# def getlines(fname):
# def try_set_fields(d, regex, text, hook=lambda x: x):
# def parse_raxmlng(handle):
# def parse_raxmlng(handle):
# def parse_raxml(handle):
# def parse_fasttree(fobj):
# def parse_phyml(fobj, frequency_type=None):
# def parse_stockholm(fobj):
# def has_rppr(rppr_name='rppr'):
# def add_database_args(parser):
# def sqlite_default():
#     def parse_url(url):
# def random_name(length):
# class InvalidLogError(ValueError):
# DNA = ['JC', 'K80', 'F81', 'HKY', 'TN93ef', 'TN93', 'K81', 'K81uf', 'TPM2',
#        'TPM2uf', 'TPM3', 'TPM3uf', 'TIM1', 'TIM1uf', 'TIM2', 'TIM2uf',
#        'TIM3', 'TIM3uf', 'TVMef', 'TVM', 'SYM', 'GTR']
# PROT = ['Blosum62', 'cpREV', 'Dayhoff', 'DCMut', 'DEN', 'FLU', 'HIVb',
#         'HIVw', 'JTT', 'JTT-DCMut', 'LG', 'mtART', 'mtMAM', 'mtREV',
#         'mtZOA', 'PMB', 'rtREV', 'stmtREV', 'VT', 'WAG', 'LG4M', 'LG4X',
#         'PROTGTR']
# JTT_MODEL = ('ML Model: Jones-Taylor-Thorton, CAT '
#              'approximation with 20 rate categories')
# WAG_MODEL = ('ML Model: Whelan-And-Goldman, CAT '
#              'approximation with 20 rate categories')
# LG_MODEL = 'ML Model: Le-Gascuel 2008, CAT approximation with 20 rate categories'
# 
# Path: taxtastic/taxdb.py
# class OnUpdate(object):
# class _IntermediateTaxon(object):
# class Taxdb(object):
#     def __init__(self, proxied):
#     def __get__(self, inst, cls):
#     def __set__(self, inst, value):
#     def __call__(self, f):
#     def __init__(self, tax_id, parent, rank, tax_name):
#     def parent(self, p):
#     def adjacent_to(self, n):
#     def iterate_children(self, on_pop=None, including_self=True):
#     def __init__(self, sqlite_db=None):
#     def __getattr__(self, attr):
#     def create_tables(self):
#     def insert_from_taxtable(self, fieldnames_cb, table):
#         def on_pop(parent):


import errno
import os
import time
import warnings
import sys
import contextlib
import copy
import csv
import functools
import hashlib
import json
import shutil
import subprocess
import tempfile
import zipfile
import dendropy
from decorator import decorator
from fastalite import fastalite
from taxtastic import utils, taxdb
            res = self._small_mrca(ts)

        if res:
            (res,), = res
        else:
            raise NoAncestor()
        return res

    def _large_mrca(self, ts):
        """Find the MRCA using a temporary table."""
        cursor = self.db.cursor()

        cursor.execute("""
            DROP TABLE IF EXISTS _mrca_temp
        """)

        cursor.execute("""
            CREATE TEMPORARY TABLE _mrca_temp(
                child TEXT PRIMARY KEY REFERENCES taxa (tax_id) NOT NULL
            )
        """)

        cursor.executemany("""
            INSERT INTO _mrca_temp
            VALUES (?)
        """, ((tid,) for tid in ts))
        cursor.execute("""
            SELECT parent
            FROM   _mrca_temp
                   JOIN parents USING (child)

# Path: taxtastic/utils.py
# def get_new_nodes(fname):
# def getlines(fname):
# def try_set_fields(d, regex, text, hook=lambda x: x):
# def parse_raxmlng(handle):
# def parse_raxmlng(handle):
# def parse_raxml(handle):
# def parse_fasttree(fobj):
# def parse_phyml(fobj, frequency_type=None):
# def parse_stockholm(fobj):
# def has_rppr(rppr_name='rppr'):
# def add_database_args(parser):
# def sqlite_default():
#     def parse_url(url):
# def random_name(length):
# class InvalidLogError(ValueError):
# DNA = ['JC', 'K80', 'F81', 'HKY', 'TN93ef', 'TN93', 'K81', 'K81uf', 'TPM2',
#        'TPM2uf', 'TPM3', 'TPM3uf', 'TIM1', 'TIM1uf', 'TIM2', 'TIM2uf',
#        'TIM3', 'TIM3uf', 'TVMef', 'TVM', 'SYM', 'GTR']
# PROT = ['Blosum62', 'cpREV', 'Dayhoff', 'DCMut', 'DEN', 'FLU', 'HIVb',
#         'HIVw', 'JTT', 'JTT-DCMut', 'LG', 'mtART', 'mtMAM', 'mtREV',
#         'mtZOA', 'PMB', 'rtREV', 'stmtREV', 'VT', 'WAG', 'LG4M', 'LG4X',
#         'PROTGTR']
# JTT_MODEL = ('ML Model: Jones-Taylor-Thorton, CAT '
#              'approximation with 20 rate categories')
# WAG_MODEL = ('ML Model: Whelan-And-Goldman, CAT '
#              'approximation with 20 rate categories')
# LG_MODEL = 'ML Model: Le-Gascuel 2008, CAT approximation with 20 rate categories'
# 
# Path: taxtastic/taxdb.py
# class OnUpdate(object):
# class _IntermediateTaxon(object):
# class Taxdb(object):
#     def __init__(self, proxied):
#     def __get__(self, inst, cls):
#     def __set__(self, inst, value):
#     def __call__(self, f):
#     def __init__(self, tax_id, parent, rank, tax_name):
#     def parent(self, p):
#     def adjacent_to(self, n):
#     def iterate_children(self, on_pop=None, including_self=True):
#     def __init__(self, sqlite_db=None):
#     def __getattr__(self, attr):
#     def create_tables(self):
#     def insert_from_taxtable(self, fieldnames_cb, table):
#         def on_pop(parent):


# Path: taxtastic/refpkg.py
import errno
import os
import time
import warnings
import sys
import contextlib
import copy
import csv
import functools
import hashlib
import json
import shutil
import subprocess
import tempfile
import zipfile
import dendropy
from decorator import decorator
from fastalite import fastalite
from taxtastic import utils, taxdb

            res = self._small_mrca(ts)

        if res:
            (res,), = res
        else:
            raise NoAncestor()
        return res

    def _large_mrca(self, ts):
        """Find the MRCA using a temporary table."""
        cursor = self.db.cursor()

        cursor.execute("""
            DROP TABLE IF EXISTS _mrca_temp
        """)

        cursor.execute("""
            CREATE TEMPORARY TABLE _mrca_temp(
                child TEXT PRIMARY KEY REFERENCES taxa (tax_id) NOT NULL
            )
        """)

        cursor.executemany("""
            INSERT INTO _mrca_temp
            VALUES (?)
        """, ((tid,) for tid in ts))
        cursor.execute("""
            SELECT parent
            FROM   _mrca_temp
                   JOIN parents USING (child)

                   JOIN taxa