def _get(relative_path, genome=None):
    """
    :param relative_path: relative path of the file inside the repository
    :param genome: genome name. Can contain chromosome name after comma, like hg19-chr20,
                   in case of BED, the returning BedTool will be with added filter.
    :return: BedTools object if it's a BED file, or filepath
    """
    chrom = None
    if genome:
        if '-chr' in genome:
            genome, chrom = genome.split('-')
        check_genome(genome)
        relative_path = relative_path.format(genome=genome)

    path = abspath(join(dirname(__file__), relative_path))
    if not isfile(path) and isfile(path + '.gz'):
        path += '.gz'

    if path.endswith('.bed') or path.endswith('.bed.gz'):
        if path.endswith('.bed.gz'):
            bedtools = which('bedtools')
            if not bedtools:
                critical('bedtools not found in PATH: ' + str(os.environ['PATH']))
            debug('BED is compressed, creating BedTool')
            bed = BedTool(path)
        else:
            debug('BED is uncompressed, creating BedTool')
            bed = BedTool(path)

        if chrom:
            debug('Filtering BEDTool for chrom ' + chrom)
            bed = bed.filter(lambda r: r.chrom == chrom)
        return bed
    else:
        return path
def _get ( relative_path , genome = None ) : chrom = None if genome : if '-chr' in genome : genome , chrom = genome . split ( '-' ) check_genome ( genome ) relative_path = relative_path . format ( genome = genome ) path = abspath ( join ( dirname ( __file__ ) , relative_path ) ) if not isfile ( path ) and isfile ( path + '.gz' ) : path += '.gz' if path . endswith ( '.bed' ) or path . endswith ( '.bed.gz' ) : if path . endswith ( '.bed.gz' ) : bedtools = which ( 'bedtools' ) if not bedtools : critical ( 'bedtools not found in PATH: ' + str ( os . environ [ 'PATH' ] ) ) debug ( 'BED is compressed, creating BedTool' ) bed = BedTool ( path ) else : debug ( 'BED is uncompressed, creating BedTool' ) bed = BedTool ( path ) if chrom : debug ( 'Filtering BEDTool for chrom ' + chrom ) bed = bed . filter ( lambda r : r . chrom == chrom ) return bed else : return path
:param relative_path: relative path of the file inside the repository
    :param genome: genome name. Can contain chromosome name after comma, like hg19-chr20,
                   in case of BED, the returning BedTool will be with added filter.
    :return: BedTools object if it's a BED file, or filepath