def runMACS( infile, outfile ):
    to_cluster = True

    if infile.endswith( ".norm.bam"):

        track = infile[:-len(".norm.bam")]
        if track.startswith("control"):
            P.touch( outfile )
            return

        format = "bam"
        suffix = ".norm.bam"

    elif infile.endswith( ".bam"):

        track = infile[:-len(".bam")]
        if track.startswith("control"):
            P.touch( outfile )
            return

        format = "bam"
        suffix = ".norm.bam"
        
    elif infile.endswith(".bed.gz"):

        track = infile[:-len(".bed.gz")]
        if track.startswith("control"):
            outs = open( outfile, "w")
            outs.close()
            return

        format = "bed"
        suffix = ".bed.gz"
        
    control = getControl( track )
    
    if control != None:
        control += suffix
    else:
        E.info("%s: no control for track %s" % (outfile, track ) )
        control = None
            
    if control: control = "-c %s" % control
    else: control = ""


        
    statement = '''
    macs -t %(infile)s %(control)s \
    --diag \
    --name=%(outfile)s \
    --format=%(format)s \
    %(macs_options)s >& %(outfile)s''' 
    
    P.run( **dict( locals().items() + PARAMS.items() ) )

############################################################
############################################################
############################################################
run MACS for peak detection.
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD_intervals.py/runMACS