@files( ( os.path.join( PARAMS["geneset_dir"],PARAMS["geneset_transcript_tss"] ), PARAMS["bed_ucsc_cgi"]), "cgi/cgi.transcript_tss.overlap.count" )
def getCGITranscriptTSSOverlapCount( infiles, outfile ):
    tss, cgi = infiles
    to_cluster = True
    statement = '''echo "Predicted CGIs overlapping 1 or more TSS" > %(outfile)s; intersectBed -a %(cgi)s -b %(tss)s -u | wc -l >> %(outfile)s; 
                   echo "Predicted CGIs not overlapping any TSS" >> %(outfile)s; intersectBed -a %(cgi)s -b %(tss)s -v | wc -l >> %(outfile)s; 
                   echo "TSS overlapped by 1 or more CGI" >> %(outfile)s; intersectBed -a %(tss)s -b %(cgi)s -u | wc -l >> %(outfile)s; 
                   echo "TSS not overlapped by any predicted CGI" >> %(outfile)s; intersectBed -a %(tss)s -b %(cgi)s -v | wc -l >> %(outfile)s; 
                   sed -i '{N;s/\\n/\\t/g}' %(outfile)s; '''
    P.run()

############################################################
Establish overlap between UCSC predicted CGIs and  protein-coding transcript TSS intervals
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_proj007.py/getCGITranscriptTSSOverlapCount