@merge( (exportReferenceAsBed, exportIntervalsAsBed, 
         ["%s.bed" % x for x in TRACKS_REFERENCE ] ),
        "intervals.overlap" )
def buildOverlap( infiles, outfile ):
    '''compute overlap between intervals.
    '''

    if os.path.exists(outfile): 
        os.rename( outfile, outfile + ".orig" )
        options = "--update=%s.orig" % outfile
    else:
        options = ""

    infiles = " ".join(IOTools.flatten(infiles))

    statement = '''
        python %(scriptsdir)s/diff_bed.py 
               --log=%(outfile)s.log 
               %(options)s 
               %(infiles)s 
        > %(outfile)s
        '''
    P.run()

############################################################
############################################################
############################################################
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD.py/buildOverlap/original