@follows( buildPromotorRegions, buildGeneRegions, buildTSSRegions )
@files( [ ("%s.gtf" % x, "%s.bed" % x ) for x in ("ensembl", "promotors", "tss" ) ] )
def exportReferenceAsBed( infile, outfile ):
    '''export a reference gtf file as bed for computing overlap.'''

    bed = Bed.Bed()
    outfile = open( outfile, "w" )
    with open(infile, "r") as inf:
        for gff in GTF.iterator( infile ):
            bed.contig, bed.start, bed.end = gff.contig, gff.start, gff.end
            bed.fields = [ gff.gene_id ]
            outfile.write( "%s\n" % str(bed) )
    outfile.close()

############################################################
############################################################
############################################################
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD.py/exportReferenceAsBed/original