@follows(getOverlappedGeneGTF)
@transform( "../merged_bams/*.merge.bam", regex(r"../merged_bams/(\S+).merge.bam"), r"overlapped_genes/\1.overlapped_genes.capseq_profile.log" )    
def overlappedGeneCAPseqProfile(infile, outfile):
    track = P.snip( os.path.basename(infile), ".merge.bam" )
    ofp = P.snip( outfile, ".log" )
    capseq = "overlapped_genes/"+track+".overlapped_genes.gtf.gz"
    statement = '''python %(scriptsdir)s/bam2geneprofile.py 
                           --bamfile=%(infile)s 
                           --gtffile=%(capseq)s
                           --output-filename-pattern=%(ofp)s
                           --reporter=gene
                           --method=geneprofile
                           --log=%(outfile)s
                           --normalize-profile=area
                           --normalize-profile=counts
                           --normalize-profile=none
                           --scale_flank_length=1'''
    P.run() 

############################################################
plot CAPseq profiles over long intervals
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_proj007.py/overlappedGeneCAPseqProfile