Software Installation Tester

This notebook simply tests if external programs have been installed correctly and can run in a Binder environment.


In [ ]:
import os.path as op

def check_path(path):
    """Check if the specified program is in the PATH and can be run in a shell."""
    import shutil
    
    checker = shutil.which(path)
    if checker:
        print('SUCCESS: {} found!'.format(path))
        return checker
    else:
        raise OSError('FAILURE: unable to find {}'.format(path))
        
def check_path_run(cmd):
    """Check if a command can be run and print out the stdout and stderr."""
    import shlex
    import subprocess
    program_and_args = shlex.split(cmd)
    try:
        command = subprocess.Popen(program_and_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = command.communicate()
    except FileNotFoundError:
        raise OSError('FAILURE: unable to run {}'.format(program_and_args[0]))
    
    print('*****STDOUT*****')
    print(out.decode("utf-8") )
    print('--------------\n')
    print('*****STDERR*****')
    print(err.decode("utf-8") )

DSSP


In [ ]:
dssp_exec = 'dssp'

In [ ]:
check_path(dssp_exec)

In [ ]:
check_path_run(dssp_exec)

MSMS


In [ ]:
msms_exec = 'msms'

In [ ]:
check_path(msms_exec)

In [ ]:
check_path_run(msms_exec)

STRIDE


In [ ]:
stride_exec = 'stride'

In [ ]:
check_path(stride_exec)

In [ ]:
check_path_run(stride_exec)

FreeSASA


In [ ]:
freesasa_exec = 'freesasa'

In [ ]:
check_path(freesasa_exec)

In [ ]:
check_path_run(freesasa_exec)

FATCAT


In [ ]:
fatcat_exec = 'fatcat'

In [ ]:
check_path(fatcat_exec)

In [ ]:
check_path_run(fatcat_exec)

SCRATCH


In [ ]:
scratch_exec = 'scratch'

In [ ]:
check_path(scratch_exec)

In [ ]:
check_path_run(scratch_exec)

EMBOSS

pepstats


In [ ]:
pepstats_exec = 'pepstats'

In [ ]:
check_path(pepstats_exec)

In [ ]:
check_path_run(pepstats_exec)

needle


In [ ]:
needle_exec = 'needle'

In [ ]:
check_path(needle_exec)

In [ ]:
check_path_run(needle_exec)

nglview


In [ ]:
import nglview
view = nglview.show_structure_file("../../ssbio/test/test_files/structures/1kf6.pdb")
view

TMHMM

Please see I-TASSER and TMHMM Install Guide for instructions on how to get this program installed.


In [ ]:
tmhmm_exec = 'tmhmm'

In [ ]:
check_path(tmhmm_exec)

In [ ]:
check_path_run(tmhmm_exec)

I-TASSER

Please see I-TASSER and TMHMM Install Guide for instructions on how to get this program installed.


In [ ]:
itasser_version = '5.1'
itasser_dir = op.expanduser('~/software/itasser/I-TASSER{}/'.format(itasser_version))
itasser_downloadlib = op.join(itasser_dir, 'download_lib.pl')
itasser_exec = op.join(itasser_dir, 'I-TASSERmod/runI-TASSER.pl')

In [ ]:
check_path(itasser_downloadlib)

In [ ]:
check_path(itasser_exec)

In [ ]:
check_path_run(itasser_exec)