INNER CODE UNIT · Python

locate_rnaseqc

getzlab/rnaseqc · python/rnaseqc/run.py:9

def locate_rnaseqc():
    """
    Search PATH for executable, then try up two directories
    (where compiled executable would exist in the git repo)
    """
    for path in os.environ['PATH'].split(os.pathsep):
        exe = os.path.join(path, 'rnaseqc')
        if test_rnaseqc(exe):
            return exe
    exe = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'rnaseqc')
    if test_rnaseqc(exe):
        return exe
    print("Unable to find rnaseqc executable", file=sys.stderr)
    return 'rnaseqc' # Just try it and see what happens, I guess

def test_rnaseqc(path):
    return os.path.isfile(path) and os.access(path, os.X_OK) and subprocess.run([path, '--version'], stdout=subprocess.PIPE).stdout.startswith(b'RNASeQC 2')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…