@split( (PARAMS["filename_expression"], PARAMS["filename_expression2"],importProbeset2Transcript),
        ("expression.skipped", "expression.table",  "expression.map", "exp*.data"))
def buildExpressionTracks( infiles, outfiles ):
    '''build expression tracks from FILENAME_EXPRESSION and FILENAME_EXPRESSION2'''

    # start with a clean sheet
    for f in outfiles:
        try:
            os.remove( f )
        except OSError:
            pass


    outf = open( "expression.map", "w" )
    outf.write("tablename\tcellline\ttime\tstimulus\n" )

    for index, infile in enumerate(infiles):
        map_exp2columns = collections.defaultdict( list )
        if infile == PARAMS["filename_expression"]:
            map_exp2columns = { 'GM00855_00_D3' : (3,4,5),
                                'GM00855_36_D3' : (6,7,8),
                                'GM00855_36_Est' : (9,10,11),
                                'GM00855_36_D3Est' : (12,13,14),
                                'GM00861_00_D3' : (15,16,17),
                                'GM00861_36_D3' : (18,19,20),
                                'GM00861_36_Est' : (21,22,23),
                                'GM00861_36_D3Est' : (24,25,26),
                                'All_00_D3' : (3,4,5,15,16,17),
                                'All_36_D3' : (6,7,8,18,19,20),
                                'All_36_Est' : (9,10,11,21,22,23),
                                'All_36_D3Est' : (12,13,14,24,25,26),
                                }
            
            PExpression.buildExpressionTracks( infile, outfiles, map_exp2columns, suffix = "" )
            for key in map_exp2columns.keys():
                cellline, time, stimulus = key.split("_")
                outf.write( "\t".join( (key, cellline, time, stimulus) ) + "\n" )
                
        elif infile == PARAMS["filename_expression2"]:
            x = 1
            stimulus = "D3"
            # pool lymphoblastoid cell lines (lcl) and others separately

            for cell in ('GMO7019', 'GMO7348', 'GM18054',
                         'Ag09309', 'HL60', 'K562', 
                         'HEPG2', 'AG09319', 'GM12878'):
                for timepoint in ('00', '08', '36'):
                    key = "%s_%s_%s" % (cell, timepoint, stimulus)
                    map_exp2columns[ key ] = (x,x+1)
                    if cell.startswith( "GM" ):
                        key2 = ("LCL", timepoint, stimulus) % "%s_%s_%s"
                    else:
                        key2 = "%s_%s_%s" % ("nonLCL", timepoint, stimulus)
                                            
                    map_exp2columns[key2].extend( [x, x+1] )
                    x += 2

            PExpression.buildExpressionTracks( infile, outfiles, map_exp2columns, suffix = ".%0i" % index )
            for key in map_exp2columns.keys():
                cellline, time, stimulus = key.split("_")
                outf.write( "\t".join( (key, cellline, time, stimulus) ) + "\n" )

    outf.close()
        
############################################################
############################################################
############################################################
##
############################################################
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD.py/buildExpressionTracks/swapped operands of `%`