def draw_CEAS(genome_p,ChIP_p,pval,bg_res=100,chip_res=600,prom=3000,biprom=5000,down=3000,gene_div=(3,5)):
    
    # got the time stamp
    timestamp=time.strftime("%H:%M:%S %a, %d %b %Y", time.localtime())
    
    # parameters
    rscript = '\n'
    rscript+=R.comment('%s' %timestamp)
    rscript+=R.comment('')
    rscript+=R.comment('ChIP annotation')
    rscript+=R.comment('')
    rscript+='\n'
    
    # PG1
    rscript+='\n'
    rscript+=R.comment('')
    rscript+=R.comment('Chromosomal Distribution')
    rscript+=R.comment('')
    rscript+= '\n'
    # set margin
    rscript+=R.par(mar=[4,4,5,3.8],oma=[4,2,4,2])

    #chromosome distribution
    rscript+=draw_chrom_barplot(genome_p,ChIP_p,pval)
    # put timestamp
    #rscript+=mtext(text=timestamp,side=1,line=2,font=3,outer=True,cex=0.8)
    
    # PG2
    # set the margin
    rscript+='\n'
    rscript+=R.comment('')
    rscript+=R.comment('Promoter,Bipromoter,Downstream, Gene and Regions of interest')
    rscript+=R.comment('')
    rscript+='\n'
    roi=True
    if genome_p['whole']['roi']==0.0: roi=False
    
    if roi: rscript+=R.par(mfrow=[5,1],mar=[4,4,5,3.8],oma=[4,2,4,2])
    else: rscript+=R.par(mfrow=[4,1],mar=[4,4,5,3.8],oma=[4,2,4,2])

    #promoter,bipromoter,downstream,gene
    rscript+=draw_promoter_barplot(genome_p,ChIP_p,pval,prom)
    rscript+=draw_bipromoter_barplot(genome_p,ChIP_p,pval,biprom)
    rscript+=draw_downstream_barplot(genome_p,ChIP_p,pval,down)
    rscript+=draw_gene_barplot(genome_p,ChIP_p,pval)
    if roi: rscript+=draw_roi_barplot(genome_p,ChIP_p,pval)
    # mark time stamp 
    #rscript+=mtext(text=timestamp,side=1,line=2,font=3,outer=True,cex=0.8)
        
    return rscript
dataset/ETHPy150Open taoliu/taolib/Assoc/inout.py/draw_CEAS/original