@files( ( (importMGI, "assignments.mgi"),) )
def createMGI( infile, outfile ):

    dbhandle = sqlite3.connect( PARAMS["database"] )

    statement = '''
                 SELECT DISTINCT 'MPheno.ontology', m2g.gene_id, a2p.phenotype_id, p.term, 'NA' 
                 FROM mgi_marker2gene as m2g, 
                      mgi_marker2allele as m2a, 
                      mgi_allele2phenotype as a2p, 
                      mgi_phenotypes as p 
                 WHERE m2g.marker_id = m2a.marker_id AND 
                       a2p.allele_id = m2a.allele_id AND 
                       p.phenotype_id = a2p.phenotype_id
                ''' 
    cc = dbhandle.cursor()
    data = cc.execute(statement).fetchall()
    
    outf = open(outfile, "w")
    outf.write( "\n".join( [ "\t".join(x) for x in data ] ) + "\n" )
    outf.close()



####################################################################
Steps 1 and 2 in the Wikipedia page.
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_snps.py/createMGI--crossover with--dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/utils/linear_assignment_.py/_step1