@transform( loadCapseqComposition, suffix(".replicated.capseq.composition.load"), ".replicated.gc.export" )
def exportCapseqGCProfiles( infile, outfile ):
    # Connect to DB
    dbhandle = sqlite3.connect( PARAMS["database"] )
    track = P.snip( os.path.basename( infile ), ".replicated.capseq.composition.load" ).replace("-","_").replace(".","_")
    # Extract data from db
    cc = dbhandle.cursor()
    query = '''SELECT c.gene_id, c.pGC, cc.pGC, c3.pGC, c5.pGC 
               FROM %(track)s_replicated_capseq_composition c
               left join %(track)s_replicated_composition_control cc on c.gene_id=cc.gene_id
               left join %(track)s_replicated_composition_flanking3 c3 on c.gene_id=c3.gene_id
               left join %(track)s_replicated_composition_flanking5 c5 on c.gene_id=c5.gene_id;''' % locals()
    cc.execute( query )
    E.info( query )
    # Write to file
    outs = open( outfile, "w")
    for result in cc:
        pre = ""
        for r in result:
          outs.write("%s%s" % (pre, str(r)) )
          pre = "\t"
        outs.write("\n")
    cc.close()
    outs.close()

############################################################
Export file of GC content
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_proj007.py/exportCapseqGCProfiles