@follows( buildGeneRegions )
@files( [ ("%s.bed" % x, 
           "%s-expressionnopromotor.annodist" % (x) ) \
              for x in TRACKS_MASTER ] )
def makeAnnotatorDistanceWithoutPromotorExpression( infile, outfile):
    '''check statistical association between intervals and transcription
    start sites.

    Look at different expression sets.
    '''

    track,workspace = outfile[:-len(".annodist")].split("-")
    
    builder = "gtf-intergenic"

    tmpfilename = P.getTempFilename( ".")

    # build workspace: add 5kb on either side of
    # a transcription start site.
    statement = '''
    python %(scriptsdir)s/gff2gff.py 
            --genome=genome 
            --extend 
            --add-up-flank=%(promotor_size)i 
            --add-down-flank=%(promotor_size)i 
    < %(tss)s > %(tmpfilename)s
    '''

    P.run( **dict( locals().items() + PARAMS.items() ) )

    workspace = tmpfilename

    tmpannotations= PAnnotator.buildAnnotatorDistanceAnnotations( "expression" )
                                                    
    PAnnotator.makeAnnotatorDistance( infile, 
                                      outfile, 
                                      builder,
                                      workspace,
                                      workspace_label = "annotation",
                                      annotations = tmpannotations,
                                      )
    
    os.unlink( tmpannotations )


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