def makeAnnotatorDistance( infile, 
                           outfile, 
                           builder,
                           workspace, 
                           workspace_label="direction",
                           annotations = None ):
    '''check statistical association between intervals and 
    transcription start sites.

    '''

    to_cluster = True

    target_path = os.path.join( os.path.abspath( PARAMS["exportdir"] ), 
                                "annotator_distance", 
                                outfile )

    if os.path.exists( target_path): shutil.rmtree( target_path)
    try:
        os.makedirs( target_path )
    except __HOLE__: 
        pass

    options = [] 

    if annotations: 
        options.append( "--filename-annotations=%s" % annotations )
        
    options = " ".join( options )

    statement = '''
	python %(scriptsdir)s/annotator_distance.py \
		--workspace=%(workspace)s \
		--segments=%(infile)s \
                --segments-format=bed \
		--counter=%(annodist_counter)s \
		--workspace-label=%(workspace_label)s \
		--sampler=permutation \
		--transform-counts=cumulative \
		--logscale=x \
                --remove-overhangs \
		--analysis=proximity \
		--num-samples=%(annodist_iterations)i \
		--num-bins=%(annodist_bins)i \
		--hardcopy=%(target_path)s/%%s.png \
		--output-filename-pattern=%(target_path)s/%%s.table \
                --workspace-builder=%(builder)s \
                --resolution=%(annodist_resolution_intergenic)s \
		--plot 
                %(options)s < /dev/null > %(outfile)s'''

    P.run()
dataset/ETHPy150Open CGATOxford/cgat/obsolete/pipeline_vitaminD_annotator.py/makeAnnotatorDistance