@merge(summarizeAllelesPerGene, "alleles.genematrix" )
def buildGeneMatrixAlleles( infiles, outfile ):

    analysis = ( ( "stoptruncated", "e.is_truncated" ),
                 ( "nmdknockout", "e.is_nmd_knockout" ),
                 ( "splicetruncated", "e.is_splice_truncated" ),
                 ( "knockout", "(e.is_nmd_knockout or e.is_truncated or e.is_splice_truncated)" ) )

    tracks = [ x[:-len("_alleles_genes.load")] for x in infiles ]
    
    statement = '''
            SELECT DISTINCT e.gene_id 
            FROM
                  %(track)s_alleles_genes AS e
            WHERE 
                %(field_where)s
            '''

    buildGeneMatrix( tracks, analysis, statement, outfile )

####################################################################
build gene matrix from alleles results
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_snps.py/buildGeneMatrixAlleles