@follows( overlappedGeneChromatinIntersection )
@merge( "overlapped_genes/*.counts", "overlapped_genes/h3k27me3.stats" )
def overlappedGeneChromatinIntersectionStats(infiles, outfile):
    first = True
    header = ""
    outs = open(outfile, "w")
    for infile in infiles:
        f = open(infile, "r")
        names = []
        values = []
        for line in f:
            name, value = line.split("\t")
            names.append(name.strip())
            values.append(value.strip())
        header = "\t".join(names)+"\n"
        outline = "\t".join(values)+"\n"
        if first:
            outs.write(header)
            first = False
        outs.write(outline)
        f.close()
    outs.close()
    
############################################################
calculate intersection of chromatin marks and CAPSeq overlapped genes
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_proj007.py/overlappedGeneChromatinIntersectionStats