def is_exec(program):
    """checks if a program is in the global path and executable"""
    cmd = ['which', program]
    try:
        return procOps.call_proc_lines(cmd)[0].endswith(program)
    except ProcException:
        return False
Пример #2
0
def samtools_version():
    """checks the version of samtools installed"""
    try:
        r = procOps.call_proc_lines(['samtools', '--version'])
        if StrictVersion(r[0].split()[1].split('-')[0]) < '1.3':
            raise ToolMissingException('samtools version is not >= 1.3.0')
    except ProcException:
        raise ToolMissingException('samtools is not installed')
def samtools_version():
    """checks the version of samtools installed"""
    try:
        r = procOps.call_proc_lines(['samtools', '--version'])
        if StrictVersion(r[0].split()[1].split('-')[0]) < '1.3':
            raise ToolMissingException('samtools version is not >= 1.3.0')
    except ProcException:
        raise ToolMissingException('samtools is not installed')
Пример #4
0
def get_tree(hal):
    """
    Extracts a Tree object from a HAL
    :param hal: HAL file.
    :return: Tree object
    """
    cmd = ['halStats', '--tree', hal]
    newick = call_proc_lines(cmd)[0]
    return ete3.Tree(newick, format=1)
def get_tree(hal):
    """
    Extracts a Tree object from a HAL
    :param hal: HAL file.
    :return: Tree object
    """
    cmd = ['halStats', '--tree', hal]
    newick = call_proc_lines(cmd)[0]
    return ete3.Tree(newick, format=1)
def is_exec(program): 
    """checks if a program is in the global path and executable"""
    if running_in_container():
        # We assume containerized versions don't need to check if the
        # tools are installed--they definitely are, and calling docker
        # just to run "which" can be surprisingly expensive. But we do
        # check for the presence of Docker, since that should take
        # only a few ms.
        cmd = ['which', 'docker']
        pl = Procline(cmd, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null')
        try:
            pl.wait()
        except ProcException:
            raise ToolMissingException("Docker not found. Either install Docker, or install CAT's dependencies and use --binary-mode local.")
    cmd = ['which', program]
    try:
        return procOps.call_proc_lines(cmd)[0].endswith(program)
    except ProcException:
        return False