# Path: xenoGI/genomes.py
# def loadSeq(paramD,fileEnding,genesS=None):
#     def __init__(self, geneInfoFN):
#     def initializeGeneRangeByStrainD(self,geneInfoFN):
#     def initializeStrainGeneRangeT(self):
#     def initializeGeneNumToNameD(self,geneInfoFN,strainNamesL=None):
#     def initializeGeneInfoD(self,geneInfoFN,strainNamesL=None):
#     def loadDictFromGeneInfoFile(self,geneInfoFN,strainNamesL,onlyNames):
#     def numToStrainName(self,geneNum):
#     def numToName(self,geneNumber):
#     def iterGenes(self,strainL=None):
#     def iterGenesStrain(self,strainName):
#     def numToGeneInfo(self,geneNumber):
#     def __len__(self):
#     def __repr__(self):
# def getProximityInWindow(geneWinT,geneProximityD):
# def createGeneProximityD(geneOrderD,geneProximityForGroup):
# def createGeneOrderD(geneOrderFN,strainNamesL):
# class genes:
#         D = {}
#         L=s.split('\t')
# 
# Path: xenoGI/fasta.py
# def load(filename):


from Bio import Phylo
from multiprocessing import Pool
from .Tree import *
from xenoGI import genomes,fasta
import glob,os,shutil,subprocess
    for orthoGroupNum,orthoT in orthoTL:
        # we use counter for placememnt in argumentL since at least in
        # the case of single gene families, some will be missing
        orthoGroupNumStr = str(orthoGroupNum).zfill(6) # pad w/ 0's so ls will display in right order
        argumentL[counter%numProcesses][0].append(orthoGroupNumStr)
        argumentL[counter%numProcesses][1].append(orthoT)
        counter += 1
        
    # run
    with Pool(processes=numProcesses) as p:
        for _ in p.imap_unordered(makeOneGeneTreeGroup, argumentL):
            pass

    return
        
def makeOneGeneTreeGroup(argT):
    '''Wrapper for multiprocessing. Given a group of orthoT's to work on,
calls makeOneGeneTree on each.'''
    
    orthoGroupNumStrL,orthoTL,paramD,strainHeader,genesO,workDir,gtFileStem,musclePath,fastTreePath = argT

    # get set of all genes in orthoTL to restrict size of seqD's
    orthoGenesS=set()
    for orthoT in orthoTL:
        orthoGenesS.update(orthoT)
    
    # load protein and dna sequences
    protSeqD=genomes.loadSeq(paramD, '_prot.fa',genesS=orthoGenesS)

    if paramD['dnaBasedGeneTrees'] == True:

# Path: xenoGI/genomes.py
# def loadSeq(paramD,fileEnding,genesS=None):
#     def __init__(self, geneInfoFN):
#     def initializeGeneRangeByStrainD(self,geneInfoFN):
#     def initializeStrainGeneRangeT(self):
#     def initializeGeneNumToNameD(self,geneInfoFN,strainNamesL=None):
#     def initializeGeneInfoD(self,geneInfoFN,strainNamesL=None):
#     def loadDictFromGeneInfoFile(self,geneInfoFN,strainNamesL,onlyNames):
#     def numToStrainName(self,geneNum):
#     def numToName(self,geneNumber):
#     def iterGenes(self,strainL=None):
#     def iterGenesStrain(self,strainName):
#     def numToGeneInfo(self,geneNumber):
#     def __len__(self):
#     def __repr__(self):
# def getProximityInWindow(geneWinT,geneProximityD):
# def createGeneProximityD(geneOrderD,geneProximityForGroup):
# def createGeneOrderD(geneOrderFN,strainNamesL):
# class genes:
#         D = {}
#         L=s.split('\t')
# 
# Path: xenoGI/fasta.py
# def load(filename):


# Path: xenoGI/trees.py
from Bio import Phylo
from multiprocessing import Pool
from .Tree import *
from xenoGI import genomes,fasta
import glob,os,shutil,subprocess

    for orthoGroupNum,orthoT in orthoTL:
        # we use counter for placememnt in argumentL since at least in
        # the case of single gene families, some will be missing
        orthoGroupNumStr = str(orthoGroupNum).zfill(6) # pad w/ 0's so ls will display in right order
        argumentL[counter%numProcesses][0].append(orthoGroupNumStr)
        argumentL[counter%numProcesses][1].append(orthoT)
        counter += 1
        
    # run
    with Pool(processes=numProcesses) as p:
        for _ in p.imap_unordered(makeOneGeneTreeGroup, argumentL):
            pass

    return
        
def makeOneGeneTreeGroup(argT):
    '''Wrapper for multiprocessing. Given a group of orthoT's to work on,
calls makeOneGeneTree on each.'''
    
    orthoGroupNumStrL,orthoTL,paramD,strainHeader,genesO,workDir,gtFileStem,musclePath,fastTreePath = argT

    # get set of all genes in orthoTL to restrict size of seqD's
    orthoGenesS=set()
    for orthoT in orthoTL:
        orthoGenesS.update(orthoT)
    
    # load protein and dna sequences
    protSeqD=genomes.loadSeq(paramD, '_prot.fa',genesS=orthoGenesS)

    if paramD['dnaBasedGeneTrees'] == True:

        dnaSeqD = genomes.loadSeq(paramD, '_dna.fa',genesS=orthoGenesS)